禁用Kubernetes NGINX ingress的SSL重定向

时间:2018-04-29 14:17:33

标签: nginx kubernetes

默认情况下,在Kubernetes NGINX入口中启用SSL重定向。怎么能被禁用?目前的实施如下:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: project_name-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /
        backend:
          serviceName: project_name
          servicePort: 80

1 个答案:

答案 0 :(得分:7)

ingress.kubernetes.io/ssl-redirect: "false"添加到annotations将禁用SSL重定向:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: project_name-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - http:
      paths:
      - path: /
        backend:
          serviceName: project_name
          servicePort: 80

请注意,false包含在引号中。我发现如果没有这种字符串拼接,它就无法工作。