Why do Kubernetes secrets have both a key and name?

12/26/2019

I'm curious why Kubernetes secrets require both a key and a name. When I create a secret I typically use the same value for both so I'm confused as to why they're both necessary.

-- anthonator
kubernetes

1 Answer

12/26/2019

It is just a design flexibility as reusability. If you want to use custom names at deployment time you can change the secret key names. Also you reuse the secrets in other deployments with different keys

-- P Ekambaram
Source: StackOverflow