Hello Team,
I am working on task DevOps task 54. Task says to create side container to store the logs. and in the steps, it says to create the side container as a initcontainer. If I create the side-container as a normal container, and when I submit, I get error messages saying the sidecar-container does not exist, if I create sidecar-container as initcontainer with the given command, it creates a loop and does not create the nginx-container. Below are the logs, kindly help complete the task.
Events:
Type Reason Age From Message
Normal Scheduled 2m50s default-scheduler Successfully assigned default/webserver to jump-host
Normal Pulling 2m50s kubelet Pulling image “ubuntu:latest”
Normal Pulled 2m50s kubelet Successfully pulled image “ubuntu:latest” in 352ms (352ms including waiting). Image size: 41582068 bytes.
Normal Created 2m50s kubelet Created container: sidecar-container
Normal Started 2m50s kubelet Started container sidecar-container
Normal Pulling 2m50s kubelet Pulling image “nginx:latest”
Normal Pulled 2m49s kubelet Successfully pulled image “nginx:latest” in 468ms (468ms including waiting). Image size: 66343926 bytes.
Normal Created 2m49s kubelet Created container: nginx-container
Normal Started 2m49s kubelet Started container nginx-container
thor@jump-host ~$ k get pods
NAME READY STATUS RESTARTS AGE
webserver 2/2 Running 0 33s
thor@jump-host ~$ k exec webserver -c sidecar-container – ls -la /var/log/nginx
total 12
drwxrwxrwx 2 root root 4096 Sep 3 13:34 .
drwxr-xr-x 1 root root 4096 Sep 3 13:34 …
-rw-r–r-- 1 root root 0 Sep 3 13:34 access.log
-rw-r–r-- 1 root root 1308 Sep 3 13:34 error.log
thor@jump-host ~$ k exec webserver -c nginx-container – ls -la /var/log/nginx
total 16
drwxrwxrwx 2 root root 4096 Sep 3 13:34 .
drwxr-xr-x 1 root root 4096 Sep 2 21:04 …
-rw-r–r-- 1 root root 0 Sep 3 13:34 access.log
-rw-r–r-- 1 root root 1308 Sep 3 13:34 error.log
thor@jump-host ~$ thor@jump-host ~$ k describe pod
Name: webserver
Namespace: default
Priority: 0
Service Account: default
Node: jump-host/10.244.73.189
Start Time: Thu, 03 Sep 2026 13:34:17 +0000
Labels: run=webserver
Annotations:
Status: Running
IP: 10.22.0.12
IPs:
IP: 10.22.0.12
Containers:
sidecar-container:
Container ID: containerd://a48dd5a9031d7c3935b7fdb7f159e9dd9d47fd0c66138e39082655e14adf9e8f
Image: ubuntu:latest
Image ID: Docker Hub Container Image Library | App Containerization
Port:
Host Port:
Command:
sh
-c
while true; do cat /var/log/nginx/access.log /var/log/nginx/error.log; sleep 30; done
State: Running
Started: Thu, 03 Sep 2026 13:34:18 +0000
Ready: True
Restart Count: 0
Environment:
Mounts:
/var/log/nginx from shared-logs (rw)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-n4nlq (ro)
nginx-container:
Container ID: containerd://1ce358427b989adf0b14136b975e73848cee3f13b3ed6ffc6d60578d86be58a3
Image: nginx:latest
Image ID: Docker Hub Container Image Library | App Containerization
Port:
Host Port:
State: Running
Started: Thu, 03 Sep 2026 13:34:19 +0000
Ready: True
Restart Count: 0
Environment:
Mounts:
/var/log/nginx from shared-logs (rw)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-n4nlq (ro)
Conditions:
Type Status
PodReadyToStartContainers True
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
shared-logs:
Type: EmptyDir (a temporary directory that shares a pod’s lifetime)
Medium:
SizeLimit:
kube-api-access-n4nlq:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
Optional: false
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors:
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
Normal Scheduled 2m50s default-scheduler Successfully assigned default/webserver to jump-host
Normal Pulling 2m50s kubelet Pulling image “ubuntu:latest”
Normal Pulled 2m50s kubelet Successfully pulled image “ubuntu:latest” in 352ms (352ms including waiting). Image size: 41582068 bytes.
Normal Created 2m50s kubelet Created container: sidecar-container
Normal Started 2m50s kubelet Started container sidecar-container
Normal Pulling 2m50s kubelet Pulling image “nginx:latest”
Normal Pulled 2m49s kubelet Successfully pulled image “nginx:latest” in 468ms (468ms including waiting). Image size: 66343926 bytes.
Normal Created 2m49s kubelet Created container: nginx-container
Normal Started 2m49s kubelet Started container nginx-container