How to overwrite a value during deployment via helm-chart in a multi-container pod?

8/4/2019

I have a definition in my values.yaml to deploy 2 containers in one pod. When running a custom CI/CD pipeline I would like to overwrite the tag(version) of the container which changes.

Normally I would do something like that:

helm upgrade --install app-pod-testing --set container.tag=0.0.2

The values.yaml has 2 containers defined:

containers:
        - repo: services/qa/helloworld1
          tag: 843df3a1fcc87489d7b52b152c50fc6a9d59744d
          pullPolicy: Always
          ports:
            container: 8080
          resources:
              limits:
                memory: 128Mi
          securityContext:
            allowPrivilegeEscalation: false
        - repo: services/qa/helloword2 
          tag: bdaf287eaa3a8f9ba89e663ca1c7785894b5128f
          pullPolicy: Always
          ports:
            container: 9080
          resources:
              limits:
                memory: 128Mi
          securityContext:
            allowPrivilegeEscalation: true

How do I do set to overwrite only tag for repo services/qa/helloword2 during deployment ? Any help/suggestions appreciate.

-- FreshMike
docker
kubernetes
kubernetes-helm

2 Answers

8/5/2019

Are you the author of this helm chart? If yes, you can just use different property path for each container in the template.

-- popcorny
Source: StackOverflow

8/4/2019

Do:

helm upgrade --install app-pod-testing --set containers[1].tag=0.0.2

See Helm docs.

-- Amit Kumar Gupta
Source: StackOverflow