CKA EXAM QS-5 2025
- Ingress now
- Oct 20
- 1 min read
Update existing Deployment synergy-leverager, adding a co-located container named sidecar using the busybox:stable image to the existing Pod.
The new co-located container has to run the following command:
# /bin/sh -c "tail n+1 -f /var/log/synergy-leverager.log"
Use a Volume mounted at /var/log to make the log file synergy-leverager.log available to the co-locator container.
Do not modify the specification of the existing container other then adding the required volume mount:
==========================================================
1) Backup (you already had this — repeat safe)
kubectl get deployment synergy-leverager -o yaml > synergy-leverager.yaml
vi synergy-leverage.yaml
# --- paste/replace only the template.spec part in your existing Deployment YAML ---
template:
metadata:
# keep existing labels/annotations here if present
spec:
volumes:
- name: varlog
emptyDir: {}
containers:
- name: monitor
image: ifcert/monitor:latest
ports:
- containerPort: 80
name: http
protocol: TCP
env:
- name: LOG_FILENAME
value: /var/log/synergy-leverager.log
# ONLY add this volumeMount to the existing container (no other changes)
volumeMounts:
- name: varlog
mountPath: /var/log
- name: sidecar
image: busybox:stable
command:
- /bin/sh
- -c
- tail -n +1 -f /var/log/synergy-leverager.log
# keep sidecar lightweight; mount the same volume
volumeMounts:
- name: varlog
mountPath: /var/log
# ---
Apply the change
kubectl apply -f synergy-leverager.yaml
kubectl get pod
Name Ready Status Restarts Age
deployment-name-xxxx-yyyy 2/2 ready 0 2s
=============================================================
Note:
Open kubernetes and search sidecar log >
var log
volumeMounts:
- name: varlog
mountPath: /var/log
volumes:
- name: varlog
emptyDir: {}




Comments