Linux Foundation CKA Exam - Topic 3 Question 64 Discussion
Score:7%ContextAn existing Pod needs to be integrated into the Kubernetes built-in logging architecture (e. g. kubectl logs). Adding a streaming sidecar container is a good and common way to accomplish this requirement.TaskAdd a sidecar container named sidecar, using the busybox Image, to the existing Pod big-corp-app. The new sidecar container has to run the following command:/bin/sh -c tail -n+1 -f /va r/log/big-corp-app.logUse a Volume, mounted at /var/log, to make the log file big-corp-app.log available to the sidecar container.
A) Explanation:
Solution:
#
kubectl get pod big-corp-app -o yaml
#
apiVersion: v1
kind: Pod
metadata:
name: big-corp-app
spec:
containers:
- name: big-corp-app
image: busybox
args:
- /bin/sh
- -c
- >
i=0;
while true;
do
echo '$(date) INFO $i' >> /var/log/big-corp-app.log;
i=$((i+1));
sleep 1;
done
volumeMounts:
- name: logs
mountPath: /var/log
- name: count-log-1
image: busybox
args: [/bin/sh, -c, 'tail -n+1 -f /var/log/big-corp-app.log']
volumeMounts:
- name: logs
mountPath: /var/log
volumes:
- name: logs
emptyDir: {
}
#
kubectl logs big-corp-app -c count-log-1
Burma
7 months agoDorian
7 months agoTanesha
7 months agoTegan
7 months agoCarlton
8 months agoLeigha
8 months agoIrma
8 months agoAlyssa
8 months agoFelicia
8 months agoStephanie
8 months agoAnabel
8 months agoFabiola
8 months agoStephaine
8 months agoGoldie
9 months agoAntione
9 months agoOliva
9 months agoPaola
9 months agoLewis
2 years agoSherman
2 years agoCorinne
2 years agoGerman
2 years agoJose
2 years agoElin
2 years agoLayla
2 years agoEve
2 years agoFernanda
2 years agoSheridan
2 years agoHerman
2 years agoVallie
2 years agoLezlie
2 years agoMarla
2 years ago