3

I'm trying to mount several secrets in the same secret-volume for a kubernetes pod blueprint, but it's not accepted.

Tried and can't be created :

"spec": {
        "volumes": [
            {
              "name": "secret-volume",
              "secret": [
                  { "secretName": "secret1" },
                  { "secretName": "secret2" },
                  { "secretName": "secret3" }
              ]
            }

Like this it will just override them:

"volumes": [
   {
    "name": "secret-volume",
       "secret": { "secretName": "secret1" },
       "secret": { "secretName": "secret2" },
       "secret": { "secretName": "secret3" }
   }
]

Is there any way to mount a list of secrets in the same volume ? Or only 1 secret / volume at the moment?

Thanks

Clau St
  • 970
  • 9
  • 14
  • 1
    You can try k8s projected volumes. https://stackoverflow.com/questions/59079318/how-to-mount-multiple-files-secrets-into-common-directory-in-kubernetes – Aaron Balson Aug 17 '20 at 20:55

1 Answers1

12

Only one secret is allowed per secret volume

Jordan Liggitt
  • 16,933
  • 2
  • 56
  • 44
  • That's what I found out later by checking the src, but I hoped that I could use more then 1. – Clau St Aug 12 '15 at 13:16
  • 8
    not sure if this helps, but a single secret can contain multiple files (its data field is a map of names to values) – Jordan Liggitt Aug 13 '15 at 13:52
  • I knew that I could "package" multiple files, but the problem was that 1 group of users could add 1 file as a secret, while another could add a different file as a secret, so it was easier to link those 2 secrets in 1 secret-volume :) – Clau St Aug 15 '15 at 11:23