Wednesday, 15 October 2025

Troubleshooting Kubernetes: Fixing ImagePullBackOff & Port Mismatch in Flask App Deployment

Our course you can check :-   Udemy course  


Ques:-  

One of the DevOps engineers was trying to deploy a python app on Kubernetes cluster. Unfortunately, due to some mis-configuration, the application is not coming up. Please take a look into it and fix the issues. Application should be accessible on the specified nodePort.

The deployment name is python-deployment-xfusion, its using poroko/flask-demo-app. The deployment and service of this app is already deployed.

nodePort should be 32345 and targetPort should be python flask app's default port.


Ans:-

raj@jumphost ~$ kubectl get all

NAME                                             READY   STATUS             RESTARTS   AGE

pod/python-deployment-xfusion-5dcd4fff84-tzhs5   0/1     ImagePullBackOff   0          2m7s


NAME                             TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE

service/kubernetes               ClusterIP   10.96.0.1      <none>        443/TCP          3m35s

service/python-service-xfusion   NodePort    10.96.235.60   <none>        8080:32345/TCP   2m7s


NAME                                        READY   UP-TO-DATE   AVAILABLE   AGE

deployment.apps/python-deployment-xfusion   0/1     1            0           2m7s


NAME                                                   DESIRED   CURRENT   READY   AGE

replicaset.apps/python-deployment-xfusion-5dcd4fff84   1         1         0       2m7s


raj@jumphost ~$ kubectl edit deploy python-deployment-xfusion


raj@jumphost ~$ kubectl get all

NAME                                             READY   STATUS    RESTARTS   AGE

pod/python-deployment-xfusion-74f98d699b-65lk9   1/1     Running   0          34s


NAME                             TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE

service/kubernetes               ClusterIP   10.96.0.1      <none>        443/TCP          12m

service/python-service-xfusion   NodePort    10.96.235.60   <none>        8080:32345/TCP   10m


NAME                                        READY   UP-TO-DATE   AVAILABLE   AGE

deployment.apps/python-deployment-xfusion   1/1     1            1           10m


NAME                                                   DESIRED   CURRENT   READY   AGE

replicaset.apps/python-deployment-xfusion-74f98d699b   1         1         1       34s



Conclusion:-

In this practical DevOps tutorial, we dive into a real-world Kubernetes troubleshooting scenario involving a Python Flask application. A DevOps engineer attempts to deploy the app, but it fails to come up due to two critical misconfigurations:

  1. ImagePullBackOff & ErrImagePull — caused by an incorrect or inaccessible Docker image.
  2. Port Mismatch — the container port in the deployment doesn't match the target port in the service, preventing proper routing.

You'll learn how to:

  • Analyze Kubernetes event logs for deployment and service issues
  • Resolve image pull errors from Docker Hub
  • Correct port mismatches between deployment and service
  • Ensure the app is accessible via a specified nodePort (32345)

This video is ideal for DevOps engineers, SREs, and Kubernetes learners looking to strengthen their debugging and configuration skills in a hands-on way.

No comments:

Post a Comment