Challenge 5
Use the following command to break something in the cluster
curl -s https://learn.exoscale.dev/cka/ch/set5.sh | bashThe nginx deployment in namespace app1 does not work. Check why and fix it.
Solution
- Test
The single replica is not running
kubectl get deploy,po -n app1
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/nginx 0/1 1 0 79m
NAME READY STATUS RESTARTS AGE
pod/nginx-7b4b5bbf6f-dth6d 0/1 ImagePullBackOff 0 79mThe description of the nginx Pod gives additional information
kubectl describe po pod/nginx-7b4b5bbf6f-dth6d
...
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal BackOff 16s (x351 over 80m) kubelet Back-off pulling image "ngnix:1.26"- Fix it
Edit the Deployment and replace the image name ngnix:1.26 with nginx:1.26, a little typo can have big consequences :)
kubectl edit deploy/nginx -n app1- Verification
The Pod is now running fine
$ kubectl get deploy,po -n app1
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/nginx 1/1 1 1 83m
NAME READY STATUS RESTARTS AGE
pod/nginx-8f58f5d59-hfg5j 1/1 Running 0 5s