Search code examples
dockerkuberneteskubernetes-container

How to see the full command used to run a container in a Kubernetes pod?


In Docker we can see the full command used to run a container using

docker ps --no-trunc

In case of containers inside pods in a Kubernetes cluster, how to find this same info?

I also tried to describe a pod using kubectl describe pods test-77f45b7bd7-hqvqh -n somenp but it doesn't show that information:

Containers:
  data-exploration:
    Container ID:   docker://XXXXXXXXXXXXXXXXXXXXXXXXXX
    Image:          docker_uri
    Image ID:       docker-pullable://docker_uri
    Port:           3002/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Fri, 22 Dec 2023 10:37:25 +0000
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     1
      memory:  5Gi
    Requests:
      cpu:     500m
      memory:  1Gi
    Environment:

Solution

  • kubectl only output the command (ENTRYPOINT) and args (CMD) that you have defined in the container manifest section (if any). kubectl does not output the default ENTRYPOINT/CMD set in the image like what docker ps --no-trunc does.