即使设置了configmap和注解,nginx入口也始终重定向到https

时间:2018-11-29 09:31:53

标签: kubernetes nginx-ingress

我有一个配置如下的入口:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: connect-app
  namespace: default
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - host: it.tufts.edu
    http:
      paths:
      - path: "/"
        backend:
          serviceName: connect-it
          servicePort: 80

,nginx控制器具有如下配置图:

apiVersion: v1
items:
- apiVersion: v1
  data:
    ssl-redirect: "false"
  kind: ConfigMap
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"v1","data":null,"kind":"ConfigMap","metadata":{"annotations":{},"name":"nginx-config","namespace":"nginx-ingress"}}
    creationTimestamp: 2018-11-13T20:56:49Z
    name: nginx-config
    namespace: nginx-ingress
    resourceVersion: "3633400"
    selfLink: /api/v1/namespaces/nginx-ingress/configmaps/nginx-config
    uid: a3ec70bc-e786-11e8-be24-005056a401f6
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

根据文档,这应该禁用从http到https的重定向,但似乎没有用,我在做什么错了?

谢谢

1 个答案:

答案 0 :(得分:1)

我相信这是:

  • 您的nginx入口控制器未更新可用于检查的配置的问题:

    $ kubectl cp <nginx-ingress-controller-pod>:nginx.conf .
    $ cat nginx.conf
    
  • 您的apache配置从HTTP(端口80)重定向到HTTPS的问题