繁体   English   中英

AWS 负载均衡器 Controller:无法识别“”:版本 .networking.k8s.io/v1 中种类“IngressClass”没有匹配项”

[英]AWS Load Balancer Controller: unable to recognize "": no matches for kind "IngressClass" in version "networking.k8s.io/v1"

我正在尝试在我的 EKS 集群中安装 AWS 负载均衡器 Controller,它用于在我的 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

这是我的入口。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 Load Balancer Controller (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/cobra@v1.3.0/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
        github.com/spf13/cobra@v1.3.0/command.go:974
github.com/spf13/cobra.(*Command).Execute
        github.com/spf13/cobra@v1.3.0/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 

看起来您正在使用使用入口 class 注释的旧清单(早于 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 ingress 文档中有很多信息。

✌️

暂无
暂无

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

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