I have several files stored as Kubernetes secrets. I can access one of them, but obviously I need them all. How do I access all of them? I tried this but they seem to be overwriting each other.
// In deployment
volumes:
- name: my-secret-volume
secret:
secretName: some-file.yaml
- name: my-secret-volume
secret:
secretName: another-file.yaml
...
volumeMounts:
- name: my-secret-volume
mountPath: /var/config
readOnly: true
Volumes names should be different. Also you should only give the secret name not the yaml. You can use like below:
volumes:
- name: my-secret-volume1
secret:
secretName: some-secret
- name: my-secret-volume2
secret:
secretName: another-secret
...
volumeMounts:
- name: my-secret-volume1
mountPath: /var/config
readOnly: true
- name: my-secret-volume2
mountPath: /var/config
readOnly: true