K8s 1.24.x 的 Azure DevOps Nginx 部署错误

K8s 1.24.x 的 Azure DevOps Nginx 部署错误

我尝试使用 yaml 在 AKS 中部署 nginx 入口控制器。部署时出现以下错误:

unable to build kubernetes objects from current release manifest: resource mapping not found for name: "icat-backend-ingress" namespace: "" from "": no matches for kind "Ingress" in version "extensions/v1beta1"

我尝试按照文档更改 yaml,但仍然失败。

以下是示例 yaml:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: xxxxxxxxx
  annotations:
    kubernetes.io/ingress.class: nginx
    # cert-manager.io/cluster-issuer: letsencrypt-staging
    # nginx.ingress.kubernetes.io/rewrite-target: /$1
    # {{- if .Values.service.resourceGroup }}
    # {{- range $key, $value := .Values.service.resourceGroup }}
    # {{ $key }}: {{ $value | quote }}
    # {{- end }}
    # {{- end }}    
    # nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
    # nginx.ingress.kubernetes.io/keepalive: "600"
    # nginx.ingress.kubernetes.io/proxy-body-size: 30m
    # nginx.ingress.kubernetes.io/client-max-body-size: 30m
spec:
  tls:
  - hosts:
    - {{ .Values.ingressUrl }}
    secretName: tls-secret
  rules:
  - host: {{ .Values.ingressUrl }}
    http:
      paths:
      - path: /(.*)
        pathType: "Prefix"
        backend:
          service:
            name: xxxxxxxx
            port:
              number: 80
      - path: /(api.*)
        pathType: "Prefix"
        backend:
          service:
            name: xxxxxxx
            port:
              number: 80

答案1

删除所有旧版本并重新部署

您的构建仍然引用旧版本的清单,因此失败,因为这些 API 已被弃用。因此,删除过去构建中的旧版本并重新部署后,它应该会通过

相关内容