1

我正在尝试在我的 Azure Kubernetes 服务 (AKS) 集群上添加 argocd 入口资源。我遵循本指南https://argoproj.github.io/argo-cd/operator-manual/ingress/#kubernetesingress-nginx

当我在 kubernete AKS 集群上应用入口资源时。它给出了以下错误消息。它正在 AKS kubernete 集群上运行v1.18.14

有人遇到过同样的问题吗?

集群环境:

Client Version: v1.20.0
Server Version: v1.19.6

错误信息

error validating data: [ValidationError(Ingress.spec.rules[0].http.paths[0].backend): unknown field "serviceName" in io.k8s.api.networking.v1.IngressBackend, ValidationError(Ingress.spec.rules[0].http.paths[0].backend): unknown field "servicePort" in io.k8s.api.networking.v1.IngressBackend]; if you choose to ignore these errors, turn validation off with --validate=false
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: argocd-server-http-ingress
  namespace: argocd
  annotations:
    kubernetes.io/ingress.class: "nginx-internal"
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
spec:
  rules:
    - http:
        paths:
          - path: /argocd
            pathType: ImplementationSpecific
            backend:
              serviceName: argocd-server
              servicePort: http
      host: argocd.example.com
  tls:
    - hosts:
        - argocd.example.com
      secretName: argocd-secret # do not change, this is provided by Argo CD
4

2 回答 2

5

请在下面找到1.19 Kubernetes 版本的示例入口

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /testpath
        pathType: Prefix
        backend:
          service:
            name: test
            port:
              number: 80

你可以阅读更多:https ://kubernetes.io/docs/concepts/services-networking/ingress/#the-ingress-resource

如果您运行的是Kubernetes 1.18

示例入口将类似于

apiVersion: "networking.k8s.io/v1beta1"
kind: "Ingress"
metadata:
  name: "example-ingress"
spec:
  ingressClassName: "external-lb"
  rules:
  - host: "*.example.com"
    http:
      paths:
      - path: "/example"
        pathType: "Prefix"
        backend:
          serviceName: "example-service"
          servicePort: 80

您可以在 Kubernetes 官方博客中阅读更多关于改进的信息:https ://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/

于 2021-04-20T04:31:49.383 回答
0

尝试:apiVersion:extensions/v1beta1而不是networking.k8s.io/v1

于 2021-04-20T05:48:33.363 回答