Search⌘ K
AI Features

Challenge: Troubleshooting Kubernetes

Explore how to identify and fix common Kubernetes deployment problems such as pods stuck in pending state, image errors, and pod resource overloads. This lesson guides you through practical steps to troubleshoot and optimize your Kubernetes clusters effectively.

Problem 1: Resolving resource error issues

We deployed the application below and it’s not running yet. When we check its status, it shows that the pod is in a pending state. Troubleshoot the issue and figure out a way to resolve it.

YAML
apiVersion: v1
kind: Pod
metadata:
name: app
spec:
containers:
- name: container
image: busybox
command: ["/bin/sh", "-c", "while true; do echo 'Running...'; sleep 10; done"]
resources:
requests:
cpu: "6"
memory: "10Gi"

Use the following run commands while you practice:

Shell
# To get pod status
kubectl get pods
# To get logs of pod
kubectl logs <pod_name>
# To get more details on pod
kubectl describe pod <pod_name>
# To edit pod
nano pod.yaml
# To delete a pod
kubectl delete pod <pod_name>
# To create a pod after solving the issue
kubectl apply -f pod.yaml
...