Get current image of kubernetes deployment

Andy Hume picture Andy Hume · Aug 22, 2016 · Viewed 25.8k times · Source

How can I use kubectl or the API to retrieve the current image for containers in a pod or deployment?

For example, in a deployment created with the below configuration, I want to retrieve the value eu.gcr.io/test0/brain:latest.

apiVersion: v1
   kind: Deployment
   metadata:
     name: flags
   spec:
     replicas: 6
     template:
       metadata:
      labels:
        app: flags
       spec:
         containers:
         - name: flags
           image: eu.gcr.io/test0/brain:latest

Answer

Daniel Perez picture Daniel Perez · Jul 5, 2017

From kubectl 1.6 the -o wide option does this, so

kubectl get deployments -o wide

will show the current image in the output.