Troubleshooting a Broken Kubernetes Python App with kubectl

🔹 Day 64 of #100DaysOfDevOps — Troubleshooting a Broken Python App on Kubernetes 🔹 Today’s task was not about deploying from scratch, but about debugging a broken Kubernetes application — exactly the kind of issue you face in real projects. A Python (Flask) app was already deployed, but it was not coming up and was not accessible via NodePort. 🔍 Step 1: Checked Deployment & Pod Status Started with the basics: kubectl get deploy kubectl get pods The pod was stuck in: ImagePullBackOff 🔎 Step 2: Used kubectl describe to Find the Root Cause kubectl describe pod <pod-name> From the Events section, it was clear that Kubernetes was failing to pull the image due to an incorrect image name. 🛠 Step 3: Fixed the Image Issue Using kubectl edit Edited the deployment directly: kubectl edit deployment python-deployment-xfusion Corrected the container image name Saved and exited the editor Kubernetes automatically recreated the pod, and this time it moved to Running state. ✅ 🔌 Step 4: Fixed the Service Port Misconfiguration Even after the pod was running, the app wouldn’t have been reachable because the Service was pointing to the wrong target port. Checked the Service: kubectl describe svc python-deployment-xfusion Then fixed it using: kubectl edit svc python-deployment-xfusion Updated targetPort from 8080 ➝ 5000 (Flask default port) Ensured nodePort was set to 32345 ✅ Final Result Deployment status: READY 1/1 Pod status: Running Application accessible via NodePort 32345 🧠 Key Learning This task reinforced that most Kubernetes issues are configuration mismatches, and the fastest way to debug them is: kubectl get → check status kubectl describe → read Events carefully kubectl edit → fix directly and let Kubernetes self-heal Real DevOps work is less about YAML creation and more about systematic troubleshooting. #100DaysOfDevOps #Day64 #Kubernetes #DevOps #Python #Flask #Containers #Debugging #LearningByDoing #CloudEngineering #kubectl

To view or add a comment, sign in

Explore content categories