Reputation: 181
We have a dev application that used to work but the local project works just fine. I need to find out why the dev version stopped working.
It's possible that the Kubernetes image that is being run in the dev environment is different than the one that is in the local developer's environment but I wants me to prove this.
I have run various kubectl
commands but so far haven't been able to find the one(s) that I need to see what image version is in the local environment and what is currently running in the dev environment in order to do a comparison.
Any suggestions are greatly appreciated.
Upvotes: 0
Views: 785
Reputation: 181
So I figured out what kubectl command to use to get me what I wanted and that got me exactly what I wanted --
kubectl get pods --namespace global-grid -o jsonpath="{.items[*].spec.containers[*].image}"
I was able to use this information and then go into the kubernetes deployment .yaml file for that environment and see what the tag should be that gets appended to the image - they didn't match so then it became a simple issue of redeploying the image using the kubectl command line from the deployment yaml file and this got the image tagged and deployed correctly.
All good now. Bill
Upvotes: 0
Reputation: 346
Hy,
if you describe your POD you should see the Image Id a Hash that you can compare.
kubectl describe pod <PODNAME>
Containers:
***:
Container ID: containerd://bb57f04e34e6e5e49b956dabc4d99eab1a23106a8cde03d058c2acfbbcf83561
Image: ****/***:12544
Image ID: ****/***@sha256:c197064bb83f386bc23bc5012c1a929b8a6b428288ddad7d6ab72a80227a6754
Upvotes: 2
Reputation: 5625
So the version that the cluster is pulling is not working, but the one on the developer's machine is?
Easy way to verify this is to push the developers copy to a different tag, or different image.
So for example if the image is myimages/myimage
, the developer can do:
docker tag myimages/myimage myimages/myimage:test
docker push myimages/myimage:test
Then set the kubernetes deployment to use myimages/myimage:test
and see if that works.
If it works with that version, but doesn't when you use myimages/myimage
then the developer's version is indeed different to the one used by the kubernetes cluster, most likely they made a code change and rebuilt the image but forgot to push to the registry.
Upvotes: 1