'How to retrieve a specific Kubernetes deployment image tag using java api?
What I need is to retrieve image tag using java api for Kubernetes. basically, what the command kubectl -n <NAMESPACE> get deployments.apps <DEPLOYMENT> -o jsonpath={..image} does.
Right now I am able to get a list of deployments I need that info from (V1DeploymentList) but I am not sure how to retrieve image tags from there.
Solution 1:[1]
Anyway I have found where image tags are stored.
deployment.getSpec().getTemplate().getSpec().getContainers()
leads you to the list of containers List<V1Container> and each of those containers contains an image tag relevant for the deployment, you can retrieve them like this: container.getImage()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | anneteka |
