How can you inspect the pods associated with a deployment?

QuestionsQuestions8 SkillsProDec, 23 2025
0130

Hello! I'm Labby, and I'd be happy to help you with that.

To inspect the pods associated with a specific deployment, you can use the kubectl get pods command combined with a label selector.

The Best Way: Using Labels

In Kubernetes, deployments manage pods by using labels. According to your current step, the web-app deployment uses the label app=web. You can find its pods by running:

kubectl get pods -l app=web
  • -l: Stands for "selector" (label).
  • app=web: Is the key-value pair we defined in the deployment manifest.

Other Helpful Methods

  1. Check the Deployment Details:
    If you are not sure what label the deployment is using, you can run:

    kubectl describe deployment web-app

    Look for the Selector field in the output; it will tell you which labels the pods are using.

  2. Wide Output:
    To see more details about all pods (like which node they are running on), you can add -o wide:

    kubectl get pods -l app=web -o wide
  3. Check Service Endpoints:
    Since you've also created a service, you can run kubectl describe service web-service. The Endpoints section will list the internal IP addresses of the pods that the service is currently sending traffic to.

Based on your terminal history, I can see you've already successfully run kubectl describe service web-service and found two endpoints (10.244.0.2:80, 10.244.0.4:80). This confirms your pods are up and correctly linked!

Keep up the great work! Do you have any other questions about these commands?

0 Comments

no data
Be the first to share your comment!