我正在尝试在我的 EKS 集群中安装 AWS 负载均衡器控制器,该控制器用于在我的 EKS 集群的当前版本中工作。在进行全新部署时(向同事展示它是多么容易......doh!),我现在收到错误。详情如下:
EKS 集群:1.18(未更改)
头盔:v3.8.1
kubectl apply -k "github.com/aws/eks-charts/stable/aws-load-balancer-controller//crds?ref=master"
helm repo add eks https://aws.github.io/eks-charts
helm upgrade \
--install aws-load-balancer-controller eks/aws-load-balancer-controller \
--set clusterName=EKSCluster-d7lBmlStzxdg \
--set image.tag=v2.3.1 \
--set serviceAccount.create=true \
--set serviceAccount.name=aws-load-balancer-controller \
--set serviceAccount.annotations.eks\.amazonaws\.com/role-arn=arn:aws:iam::xxxxxxxxxxxx:role/aws-load-balancer-controller-EKSCluster-xxxxxxxx \
--set rbac.create=true \
--set region=us-west-2 \
--set vpcId=vpc-xxxxxxxxxxxxx
--namespace kube-system
这是我的 ingress.yaml:
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}]'
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/certificate-arn: {{ .Values.endpoint.acmTlsArn }}
alb.ingress.kubernetes.io/wafv2-acl-arn: {{ .Values.endpoint.wafv2Arn }}
alb.ingress.kubernetes.io/healthcheck-port: traffic-port
external-dns.alpha.kubernetes.io/hostname: {{ .Values.endpoint.fqdn }}
kots.io/app-slug: stoplight-platform
generation: 1
labels:
app.kubernetes.io/component: platform-ingress
app.kubernetes.io/instance: platform
app.kubernetes.io/name: stoplight
name: platform-platform-ingress
namespace: {{ .Values.app.namespace }}
spec:
rules:
- host: {{ .Values.endpoint.fqdn }}
http:
paths:
- backend:
serviceName: platform-nginx
servicePort: 80
每次我收到此错误时:
Release "aws-load-balancer-controller" does not exist. Installing it now.
Error: unable to build kubernetes objects from release manifest: unable to recognize "": no matches for kind "IngressClass" in version "networking.k8s.io/v1"
我认为这是因为较新版本的AWS负载均衡器控制器(v2.4.0)需要k8s v1.19+,所以我设置要使用的图像标签:
--set image.tag=v2.3.1
,它应该与k8s 1.18兼容。但同样的错误。
任何帮助将不胜感激,我还是一个 k8s 新手。再说一次,所有这些都可以正常工作,但有些东西已经改变了,我不知道是什么。
更新: 与
--debug
一起运行我得到这个:
customresourcedefinition.apiextensions.k8s.io/ingressclassparams.elbv2.k8s.aws configured
customresourcedefinition.apiextensions.k8s.io/targetgroupbindings.elbv2.k8s.aws configured
"eks" already exists with the same configuration, skipping
/opt/homebrew/bin/helm upgrade --install aws-load-balancer-controller eks/aws-load-balancer-controller --set clusterName=EKSCluster-d7lBmlStzxdg --set image.tag=v2.3.1 --set serviceAccount.create=true --set serviceAccount.name=aws-load-balancer-controller --set serviceAccount.annotations.eks\.amazonaws\.com/role-arn=arn:aws:iam::xxxxxxxxxxxxx:role/aws-load-balancer-controller-EKSCluster-d7lBmlStzxdg --set rbac.create=true --set region=us-west-2 --set vpcId=vpc-xxxxxxxxxxxxxxx --namespace kube-system
history.go:56: [debug] getting history for release aws-load-balancer-controller
Release "aws-load-balancer-controller" does not exist. Installing it now.
install.go:178: [debug] Original chart version: ""
install.go:195: [debug] CHART PATH: /Users/conlann/Library/Caches/helm/repository/aws-load-balancer-controller-1.4.1.tgz
client.go:128: [debug] creating 2 resource(s)
install.go:151: [debug] CRD ingressclassparams.elbv2.k8s.aws is already present. Skipping.
Error: unable to build kubernetes objects from release manifest: unable to recognize "": no matches for kind "IngressClass" in version "networking.k8s.io/v1"
helm.go:84: [debug] unable to recognize "": no matches for kind "IngressClass" in version "networking.k8s.io/v1"
unable to build kubernetes objects from release manifest
helm.sh/helm/v3/pkg/action.(*Install).RunWithContext
helm.sh/helm/v3/pkg/action/install.go:277
main.runInstall
helm.sh/helm/v3/cmd/helm/install.go:264
main.newUpgradeCmd.func2
helm.sh/helm/v3/cmd/helm/upgrade.go:120
github.com/spf13/cobra.(*Command).execute
github.com/spf13/[email protected]/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
github.com/spf13/[email protected]/command.go:974
github.com/spf13/cobra.(*Command).Execute
github.com/spf13/[email protected]/command.go:902
main.main
helm.sh/helm/v3/cmd/helm/helm.go:83
runtime.main
runtime/proc.go:255
runtime.goexit
runtime/asm_arm64.s:1133
make: *** [controller-alb-ingress] Error
看起来您正在使用较旧的清单(K8s 1.18 之前的版本),该清单使用入口类注释:
kubernetes.io/ingress.class: alb
在较新的 Ingress 资源定义(K8s 1.18+)中,您将其指定为资源中规范的一部分:
示例:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: alb
rules:
- http:
...
IngressClass
:
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
labels:
app.kubernetes.io/component: controller
name: nginx-example
annotations:
ingressclass.kubernetes.io/is-default-class: "true"
spec:
controller: k8s.io/ingress-nginx
K8s 入口文档中有大量信息。
✌️