1

I have a couple of deployments in Kubernetes packaged using Helm. Both the deployments are different but they share the same config map.

When performing installation via Helm the first deployment is successful but the second deployment fails with the below error.

Error: rendered manifests contain a resource that already exists. Unable to continue with install: ConfigMap "appconfig" in namespace "testnamespace" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-name" must equal "app2": current value is "app2"

1 Answer 1

1

Couple of possible solutions:

  1. Control the configmap from a third chart and add the third chart as a dependency in both the charts. This will duplicate the secret and can cause a skew in the values being used both the charts since if they have independent release cycles
  2. Create the configmap in one namespace and refer to it using an external reference. You can see several examples of such at https://github.com/helm/charts/search?q=existingSecret&type=code

I personally prefer option 1 since there is explicit dependency specification and gives the ability to deploy the charts individually

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.