简体   繁体   中英

Kubernetes Ingress with 302 redirect loop

I have an ingress with role with two paths:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
metadata:
  name: myservice-production
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "30"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"
    cert-manager.io/cluster-issuer: letsencrypt-prod
    acme.cert-manager.io/http01-edit-in-place: "true"
spec:
  rules:
    - host: ra2.myservice.com.br
      http:
        paths:
          - path: /
            backend:
              serviceName: myservice-production-deployment-nodeport
              servicePort: 80
          - path: /conteudo/
            backend:
              serviceName: seo-production-deployment-nodeport
              servicePort: 80
  tls:
    - hosts:
        - ra2.myservice.com.br
      secretName: ra-production-us2-certmanager-certificate

The SEO deployment is correct:

kind: Service apiVersion: v1 metadata: name: seo-production-deployment-nodeport spec: selector: app: seo-production-deployment ports: - name: http port: 80 targetPort: 3003 protocol: TCP type: NodePort

But when I try to access any route from my conteudo path I'm getting a 302 redirect loop. It's just when using this ingress. If I change, for example, to:

- host: ra2.myservice.com.br
  http:
    paths:
      - path: /
        backend:
          serviceName: seo-production-deployment-nodeport
          servicePort: 80

It starts working normally. I could not find a reasonable motive to be with this behavior.

Remove this annotation: nginx.ingress.kubernetes.io/rewrite-target: / Also the change the annotation: nginx.ingress.kubernetes.io/ssl-redirect: "true" to this one nginx.ingress.kubernetes.io/force-ssl-redirect: "true" Edit the path - path: /conteudo/ to - path: /conteudo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM