Ho can I specify the path to a secret in a cron job yaml?

6/28/2019

I have a cron job in yaml and I am using some secrets in it:

example:

- name: username
    valueFrom:
      secretKeyRef:
        name: {{ .Values.secrets.mysecret.username.name }}
        key: {{ .Values.secrets.mysecret.username.key }}

this means that name of the secret is stored in a values.yaml file under:

.secrets.mysecret.username.name

And there, in the values.yaml file, I have this:

mysecret:
  username:
    name: nameofthesecretfile
    key: username

so "nameofthesecretfile" is the name of the secret. I have other secrets referenced in the same way and they are found and used as should. The problem with this secret is that it is not on the same path with the others so it doesn't find it.

for example when i run

$ kubectl get secrets 

nameofthesecretfile secret is not listed because it is in AWS in a different folder from the other ones. example:

  • root\secrets\one - here are all the secrets
  • root\secrets\two - here is the secret that I cannot see

so my setup is configured to see all secrets from folder one.

But how can I specify the path to folder two (which is on amazon S3) in that yaml file. Should I do it in cron job yaml? and if so, how?

-- Daniel
kubernetes-helm
kubernetes-secrets

0 Answers