PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, August 13, 2022

[FIXED] How can i create mutiple nginx ingress controller in kubernetes

 August 13, 2022     google-kubernetes-engine, kubernetes, kubernetes-helm, nginx, nginx-ingress     No comments   

Issue

I have 2 namespaces in my kubernetes cluster, one called first-nginx and the other called second-nginx. I am using the chart ingress-nginx.. NOT the stable/nginx-ingress as that is now deprecated.

I am attemtping to install multiple nginx controllers, because i need them to be exposed by an already created static ip in GKE. I have successfully installed my first chart in the first-nginx namespace like this

helm install nginx-ingress ingress-nginx/ingress-nginx --namespace first-nginx --set ingress-class="nginx-devices --set controller.service.loadBalancerIP={first-IP-address}"

I am now attempting to do the same with in the second namespace like this

helm install nginx-ingress-2 ingress-nginx/ingress-nginx --namespace second-nginx --set ingress-class="nginx-devices --set controller.service.loadBalancerIP={second-IP-address}"

However i get an error as shown below.

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 "nginx-ingress-2": current value is "nginx-ingress"; annotation validation error: key "meta.helm.sh/release-namespace" must equal "second-nginx": current value is "first-nginx"

How do i solve this ? This seems to work when i use the stable/nginx-ingress chart where i can do something like this helm install nginx-ingress-devices stable/nginx-ingress --namespace second-nginx --set controller.ingressClass="nginx-devices"

How do i acheive the same thing with the ingress-nginx


Solution

You need to define additional controller.ingressClassResource.controllerValue for the second ingress-nginx, so that when an ingress resource refer to this class, it knows which controller to engage.

helm install nginx-ingress-devices ingress-nginx/ingress-nginx  \
  --namespace second-nginx \
  --set controller.ingressClassResource.name=second-nginx \
  --set controller.ingressClassResource.controllerValue="k8s.io/second-nginx" \
  --set controller.ingressClassResource.enabled=true \
  --set controller.ingressClassByName=true


Answered By - gohm'c
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing