Can I get more container details?

Yes, you can retrieve more detailed information about the containers in your pods using the following command:

kubectl get pods -l app=web -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.containers[*].name}{"\t"}{.spec.containers[*].image}{"\t"}{.spec.containers[*].ports[*].containerPort}{"\n"}{end}'

This command will provide:

  • Pod Name: The name of each pod.
  • Container Names: The names of all containers within each pod.
  • Container Images: The images used by those containers.
  • Container Ports: The ports exposed by the containers.

Breakdown:

  • {.spec.containers[*].name}: Retrieves the names of all containers in each pod.
  • {.spec.containers[*].image}: Retrieves the images of all containers.
  • {.spec.containers[*].ports[*].containerPort}: Retrieves the container ports.

This will give you a comprehensive view of the container details for each pod labeled with app=web. If you need further customization or have more questions, let me know!

0 Comments

no data
Be the first to share your comment!