0

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
  • 314
  • 1
  • 13
  • I think, the variables are not expanded because volumes section is one level up from the env section. – Subramanian Manickam Jan 27 '20 at 15:55
  • The volumes and containers section are sharing the same indentation. I have removed some content for simplicity. I am fine with not working it that way, due to scope limitation, I am just asking if there's a way to expand the variable into a different section ? In this case containers section vs volumes – Recoba20 Jan 27 '20 at 15:59
  • I'm not sure whether it can achieved on volumes section. – Subramanian Manickam Jan 27 '20 at 16:38
  • Well the answer says `Kubernetes allows you to use previously defined environment variables as part of subsequent environment variables` here you are trying to expand a volume url, which isn't an environment variable so it makes sense. – Tummala Dhanvi Jan 27 '20 at 22:24

0 Answers0