skip to Main Content

I have created an ingress controller using Helm with default configuration

default        nginx-ingress-controller        LoadBalancer   10.0.182.128   xx.xxx.xx.90     80:32485/TCP,443:31756/TCP   62m
default        nginx-ingress-default-backend   ClusterIP      10.0.12.39     <none>           80/TCP                       62m

using Helm:

helm install nginx-ingress stable/nginx-ingress          
--set controller.replicaCount=2      
--set controller.nodeSelector."beta.kubernetes.io/os"=linux 
--set defaultBackend.nodeSelector."beta.kubernetes.io/os"=linux 
--set controller.service.loadBalancerIP="Created static IP" 
--set controller.service.annotations."service.beta.kubernetes.io/azure-dns-label-name"="XXX-aks-ingress"

this ingress is running in the default namespace.

Now, I wanted to add a second ingress controller, from the official doc I have specific Ingress class

helm install nginx-ingress stable/nginx-ingress      
--namespace ingress-nginx-devices  #I create this namespace first 
--set controller.ingressClass="nginx-devices"    # custom class to use for different ingress resources  
--set controller.replicaCount=2      
--set controller.nodeSelector."beta.kubernetes.io/os"=linux 
--set defaultBackend.nodeSelector."beta.kubernetes.io/os"=linux 
--set controller.service.loadBalancerIP="A second static Ip address created before" 
--set controller.service.annotations."service.beta.kubernetes.io/azure-dns-label-name"="serviceIot-aks-ingress-iot"

but I keep getting this error:

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

What could be wrong here ?
Any help is appreciated 🙂

3

Answers


  1. you can try, what we are changing is name : nginx-ingress-devices instead of nginx-ingress

    helm install nginx-ingress-devices stable/nginx-ingress      
    --namespace ingress-nginx-devices  #I create this namespace first 
    --set controller.ingressClass="nginx-devices"    # custom class to use for different ingress resources  
    --set controller.replicaCount=2      
    --set controller.nodeSelector."beta.kubernetes.io/os"=linux 
    --set defaultBackend.nodeSelector."beta.kubernetes.io/os"=linux 
    --set controller.service.loadBalancerIP="A second static Ip address created before" 
    --set controller.service.annotations."service.beta.kubernetes.io/azure-dns-label-name"="serviceIot-aks-ingress-iot"
    

    error you are getting is due to already there is cluster role with same name : nginx-ingress due to that you are getting the error.

    ClusterRoleBindings grant a user, group, or service account a
    ClusterRole’s power across the entire cluster.

    You can get the reference file here : https://github.com/helm/charts/blob/master/stable/nginx-ingress/templates/clusterrole.yaml

    Login or Signup to reply.
  2. For my case the issue was with ingressclass existed already. I have simply deleted the ingresclass and it worked like a charm.

    # kubectl get ingressclass --all-namespaces
    

    This will return the name of already existing ingressclass. For my case, it was nginx. Delete that ingressclass.

    # kubectl delete ingressclass nginx --all-namespaces
    

    Verify that ingressclass is deleted

    # kubectl get ingressclass --all-namespaces
    No resources found
    

    Rerun the helm update command should work.

    You can also run multiple ingrss controller in parallel with new ingressClassName & ingressClassResourceName. First of all get list of all existing class name.

    kubectl get ingressclass --all-namespaces
    NAME        CONTROLLER             PARAMETERS   AGE
    nginx       k8s.io/ingress-nginx   <none>       203d
    

    Create a new ingress controller with unique className with this command.

    helm install nginx-ingress stable/nginx-ingress      
    --namespace ingress-nginx-devices  #I create this namespace first 
    --set controller.ingressClass="nginx-devices"    # custom class to use for different ingress resources 
    --set controller.ingressClassResource.name="nginx-devices" # custom classResourceName   
    --set controller.replicaCount=2      
    --set controller.nodeSelector."beta.kubernetes.io/os"=linux 
    --set defaultBackend.nodeSelector."beta.kubernetes.io/os"=linux 
    --set controller.service.loadBalancerIP="A second static Ip address created before" 
    --set controller.service.annotations."service.beta.kubernetes.io/azure-dns-label-name"="serviceIot-aks-ingress-iot"
    
    Login or Signup to reply.
  3. With recent releases "controller.ingressClassResource.name" needs to get a different name when trying to deploy a second ingress.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search