Kubernetes 101: Excercise 3 for CKA (create a pod nginx, update and describe a pod)


Following our journey on the preparation towards the exam CKA (Certified Kubernetes Administrator), we continue this time with the exercise number 3. 

Exercise 3:

  • Let's create the nginx pod with version 1.17.4 and expose it on port 80
  • Now change the Image version to 1.15-alpine for that pod and verify that
  • Change the Image version back to 1.17.1 for the pod you just updated and observe the changes
  • Try to type a command that it will allow you to check the image version of this pod without using the command describe

Solution:

kubectl run nginx --image=nginx:1.17.4 --restart=Never --port=80
kubectl set image pod/nginx nginx=nginx:1.15-alpine

kubectl describe po nginx
kubectl set image pod/nginx nginx=nginx:1.17.1
kubectl describe po nginx
kubectl get po nginx -w # watch it
kubectl get po nginx -o jsonpath='{.spec.containers[].image}{"\n"}'






Comments

Leave as a comment:

Archive