Search code examples
dockersslkuberneteskubernetes-helmkubernetes-secrets

Helm chart to use secrets from cert-manager


I want to automate the use a certificate, that is created by cert-manager as documented here, in a Helm chart. For example, the YAML below.

---
apiVersion: v1
kind: Pod
metadata:
  name: mypod
  labels:
    app: mypod
spec:
  containers:
    - name: mypod
      image: repo/image:0.0.0
      imagePullPolicy: Always
      volumeMounts:
        - name: certs
          mountPath: /etc/certs
          readOnly: true
      ports:
        - containerPort: 4443
          protocol: TCP
  volumes:
    - name: certs
      secret:
        secretName: as_created_by_cert-manager

How do I submit the YAML for getting a Certificate from cert-manager and then plugin the generated Secret into the Pod YAML above, in a Helm chart?


Solution

  • I am posting David's comment as a community wiki answer as requested by the OP:

    You should be able to write the YAML for the Certificate in the same chart, typically in its own file. I'd expect it would work to create them together, the generated Pod would show up as "Pending" in kubectl get pods output until cert-manager actually creates the matching Secret. – David Maze