Using k8s secret in httpHeaders for livenessProbe

7/24/2019

I want to do a livenessProbe for my service.

However, this service requires a special http-header with secret content. The secret is stored in k8s secrets. How can I access it in my helm chart?

I tried:

livenessProbe:
          httpGet:
            path: /health
            port: 5100
            httpHeaders:
              - name: x-api-key
                value: $MY_API_KEY

with

env:
        - name: MY_API_KEY
          valueFrom:
            secretKeyRef:
              name: my-secrets
              key: x-api-key

However, this does not work.

I think the workaround would be to write a bash script that wraps the curl call. This script should read the environment, right? But is there a better way?

-- Thomas Seehofchen
kubernetes-helm

0 Answers