kuberneteskubernetes-helm

helm says secret doesn't exist although it does


Got a helm chart with an environment variable being imported from a kubernetes secret:

env:
  MONGO_URI:
   name: mongo-secret
   type: secret
   key: mongodb-uri

But when I try rendering the template, I get the following error:

error calling required: HELM_ERR_START
Attempted to reference unknown object mongo-secret. Either create it or add it to externalReferences HELM_ERR_END

But the secret exists:

$ kubectl get secrets

NAME                                                   TYPE                 DATA       AGE
mongo-secret                                           Opaque               1           1d

Am I missing something? How do I fix this error?


Solution

  • I had to add the secret to externalReferences just as the error asked me to. Here is how I added it to the chart:

    externalReferences:
      mongo-secret: 'mongo-secret'