I have a brand new (so empty) AKS cluster. I want to install two instances of the nginx ingress controller, in different namespaces and with different ingress class, using helm.
I start with the first:
helm install ingress1 ingress-nginx/ingress-nginx --namespace namespace1 --set controller.ingressClass=class1
NAME: ingress1
LAST DEPLOYED: Fri Sep 24 20:46:28 2021
NAMESPACE: namespace1
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The ingress-nginx controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
All good
Now I go with the second:
helm install ingress2 ingress-nginx/ingress-nginx --namespace namespace2 --set controller.ingressClass=class2
Error: rendered manifests contain a resource that already exists. Unable to continue with install: IngressClass "nginx" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-name" must equal "ingress2": current value is "ingress1"; annotation validation error: key "meta.helm.sh/release-namespace" must equal "namespace2": current value is "namespace1"
What is the correct way to install multiple nginx ingress controller instances in the same cluster?
I think that you're setting the wrong values, thus the class name is nginx
in both installs. Take a look at the template here: controller-ingressclass
If you're using the official ingress-nginx Helm repository: https://kubernetes.github.io/ingress-nginx
then try setting this instead: controller.ingressClassResource.name=class1|class2
instead:
helm install ingress1 ingress-nginx/ingress-nginx --namespace namespace1 --set controller.ingressClassResource.name=class1
helm install ingress2 ingress-nginx/ingress-nginx --namespace namespace2 --set controller.ingressClassResource.name=class2
depending on your needs, you may also require to change the other values of the ingressClassResource