Backend Protocol

使用 backend-protocol 注解可以配置 Nginx 使用哪种协议转发给 backend service

有效值: HTTP, HTTPS, GRPC, GRPCS, AJP and FCGI

Nginx 默认使用 HTTP

Example:

nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"

yaml example

因为 k8s-dashboard 默认使用 https 协议,所以需要使用

nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-dashboard
  namespace: kube-system
  annotations:
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
  rules:
    - host: dashboard.example.com
      http:
        paths:
          - backend:
              service:
                name: kubernetes-dashboard
                port:
                  number: 8443
            path: /
            pathType: Prefix