Can we describe 1 container in a pod using command like kubectl describe container

2/27/2019

Is it possible to describe just 1 container in a pod?

$ kubectl describe pod <pod_name>

describes all the containers in that pod.

Thanks.

-- user674669
kubectl
kubernetes

2 Answers

2/27/2019

There is no option to describe specific container in a pod.

one way to look at events from a specific container from a pod is to use events api.

try below

kubectl get ev |grep <pod-name>|grep <container-name>
-- P Ekambaram
Source: StackOverflow

2/27/2019

No, there is no a dedicated command to do that. But you can use kubectl get pods to show the infor per container. For example with jq you can get info for a container by its name:

kubectl get po <pod_name> -n <namespace_name>-o json | jq -c  '.spec.containers[] | select( .name | contains("<container_name>"))'
-- Anna Slastnikova
Source: StackOverflow