Reputation: 263
I would like to display docker container tags in Kubernetes. Currently I deploy my services with helm. My images look like this:
spec:
containers:
- name: my-service
image: my-service:latest
The image my-service.latest has tags like git commit hash and branch name. In helm I do not know about the image tags, so it is not possible to set the tags over helm with "--set".
What is the way in Kubernetes to read the image tags?
Upvotes: 0
Views: 3872
Reputation: 263
Sometimes it is necessary to deploy a helm release without building your images. I solved my problem as followed:
Add additional tags after cloud build like git branch, commit hash and build time. https://cloud.google.com/sdk/gcloud/reference/beta/container/images/add-tag
In the last step of my deployment pipeline I patch the labels of my deployments with
kubectl patch deployment
command. That works for me quite well.
Upvotes: 0
Reputation: 557
In helm I do not know about the image tags, so it is not possible to set the tags over helm with "--set".
Yes you can update image tag using helm. I have used it with jenkins before.
helm upgrade demo ./demo/ -f app/demo.yaml --set image.repository=3xxxxx55.dkr.ecr.eu-west-1.amazonaws.com/demo,image.tag=$BUILD_NUMBER --install --namespace demo --wait --timeout 600 --kube-context demo.k8s.net
Also you can use kubectl to update image tags for deployment.
Upvotes: 1
Reputation: 384
If you're looking for a way to get what tags are currently running, this is what I've used the past:
kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec.containers[*].image}" | tr -s ' ' '\n'
Upvotes: 2