Expanding a manifest secret variable into a volume section

1/27/2020

The chart is efs-provisioner. I am trying to tweak it a little bit and inject some of the fields by consuming some existing k8s secrets, however for the volumes part I must provide a value referencing the secrets. I tried with this approach Combining multiple k8s secrets into an env variable, but it seems it's not applicable to a volume section.

Is there a way to do this ?

The pod is not able to start and fails with: mount.nfs: Failed to resolve server $(FILE_SYSTEM_ID).efs.$(AWS_REGION).amazonaws.com: Name or service not known

  containers:
  - name: {{ template "efs-provisioner.fullname" . }}
    image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
    imagePullPolicy: {{ .Values.image.pullPolicy }}
    env:
    - name: FILE_SYSTEM_ID
      valueFrom:
        secretKeyRef:
          name: efs-id-secret
          key: String
    - name: AWS_REGION
      valueFrom:
        secretKeyRef:
          name: aws-region-secret
          key: String
  volumes:
  - name: pv-volume
    nfs:
      server: $(FILE_SYSTEM_ID).efs.$(AWS_REGION).amazonaws.com
-- Recoba20
amazon-efs
kubernetes
kubernetes-helm

0 Answers