Repairing Failed Pods in Kubernetes

Hands-On Lab

 

Photo of Chad Crowell

Chad Crowell

DevOps Training Architect II in Content

Length

01:00:00

Difficulty

Intermediate

As a Kubernetes Administrator, you will come across broken pods. Being able to identify the issue and quickly fix the pods is essential to maintaining uptime for your applications running in Kubernetes. In this hands-on lab, you will be presented with a number of broken pods. You must identify the problem and take the quickest route to resolve the problem in order to get your cluster back up and running.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Repairing Failed Pods in Kubernetes

In this hands-on lab, we will be presented with a number of broken pods. We must identify the problem and take the quickest route to resolve the problem in order to get our cluster back up and running.

Log in to the Kube Master server using the credentials on the lab page (either in your local terminal, using the Instant Terminal feature, or using the public IP), and work through the objectives listed.

Identify the broken pods.

  1. Use the following command to see what’s in the cluster:

    kubectl get all --all-namespaces
  2. To make this a little easier to read, you could run the following command to view services, pods, and deployments:

    kubectl get svc,po,deploy -n web

Find out why the pods are broken.

  1. Use the following command to inspect one of the broken pods and view the events:

    kubectl describe pod <pod_name>

Repair the broken pods.

  1. Use the following command to repair the broken pods in the most efficient manner:

    kubectl edit deploy nginx -n web
  2. Where it says image: nginx:191, change it to image: nginx. Save and exit.

Ensure pod health by accessing the pod directly.

  1. Use the following command to access the pod directly via its container port:

    wget -qO- <pod_ip_address>:8080

Conclusion

Congratulations on completing this lab!