简体   繁体   English

无法在 Azure k8s 集群中使用带有自定义 class 的 helm 创建第二个入口 controller

[英]cant create a second ingress controller using helm with custom class in Azure k8s cluster

I have created an ingress controller using Helm with default configuration我使用 Helm 和默认配置创建了一个入口 controller

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现在,我想添加第二个入口 controller,从官方文档我有特定的入口 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:)任何帮助表示赞赏:)

you can try, what we are changing is name: nginx-ingress-devices instead of nginx-ingress你可以试试,我们改的是名字: nginx-ingress-devices而不是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.你得到的错误是由于已经有同名的集群角色: nginx-ingress因为你得到了错误。

ClusterRoleBindings grant a user, group, or service account a ClusterRole's power across the entire cluster. ClusterRoleBindings 授予用户、组或服务帐户 ClusterRole 在整个集群中的权力。

You can get the reference file here: https://github.com/helm/charts/blob/master/stable/nginx-ingress/templates/clusterrole.yaml您可以在此处获取参考文件: https://github.com/helm/charts/blob/master/stable/nginx-ingress/templates/clusterrole.yaml

For my case the issue was with ingressclass existed already.就我而言,问题在于 ingressclass 已经存在。 I have simply deleted the ingresclass and it worked like a charm.我只是删除了 ingresclass,它就像一个魅力。

# kubectl get ingressclass --all-namespaces

This will return the name of already existing ingressclass.这将返回已经存在的 ingressclass 的名称。 For my case, it was nginx.就我而言,它是 nginx。 Delete that ingressclass.删除该入口类。

# kubectl delete ingressclass nginx --all-namespaces

Verify that ingressclass is deleted验证 ingressclass 是否已删除

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

Rerun the helm update command should work.重新运行 helm update 命令应该可以工作。

With recent releases "controller.ingressClassResource.name" needs to get a different name when trying to deploy a second ingress.在最近的版本中,“controller.ingressClassResource.name”在尝试部署第二个入口时需要获得不同的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM