Task Summary
SSH into the correct node: cka000037
Modify existing deployment synergy-leverager
Add a sidecar container:
Name: sidecar
Image: busybox:stable
Command:
/bin/sh -c " tail -n+1 -f /var/log/synergy-leverager.log "
Use a shared volume mounted at /var/log
Don ' t touch existing container config except adding volume mount
Step-by-Step Solution
1️⃣ SSH into the correct node
ssh cka000037
⚠️ Skipping this will result in a zero score.
2️⃣ Edit the deployment
kubectl edit deployment synergy-leverager
This opens the deployment YAML in your default editor (vi or similar).
3️⃣ Modify the spec as follows
???? Inside the spec.template.spec, do these 3 things:
✅ A. Define a shared volume
Add under volumes: (at the same level as containers):
volumes:
- name: log-volume
emptyDir: {}
✅ B. Add volume mount to the existing container
Locate the existing container under containers: and add this:
volumeMounts:
- name: log-volume
mountPath: /var/log
???? Do not change any other configuration for this container.
✅ C. Add the sidecar container
Still inside containers:, add the new container definition after the first one:
- name: sidecar
image: busybox:stable
command:
- /bin/sh
- -c
- " tail -n+1 -f /var/log/synergy-leverager.log "
volumeMounts:
- name: log-volume
mountPath: /var/log
spec:
containers:
- name: main-container
image: your-existing-image
volumeMounts:
- name: log-volume
mountPath: /var/log
- name: sidecar
image: busybox:stable
command:
- /bin/sh
- -c
- " tail -n+1 -f /var/log/synergy-leverager.log "
volumeMounts:
- name: log-volume
mountPath: /var/log
volumes:
- name: log-volume
emptyDir: {}
Save and exit
If using vi or vim, type:
bash
CopyEdit
wq
5️⃣ Verify
Check the updated pods:
kubectl get pods -l app=synergy-leverager
Pick a pod name and describe it:
kubectl describe pod < pod-name >
Confirm:
2 containers running (main-container + sidecar)
Volume mounted at /var/log
ssh cka000037
kubectl edit deployment synergy-leverager
# Modify as explained above
kubectl get pods -l app=synergy-leverager
kubectl describe pod < pod-name >