kubernetes / ingress-nginx

Ingress NGINX Controller for Kubernetes
https://kubernetes.github.io/ingress-nginx/
Apache License 2.0
17.46k stars 8.25k forks source link

Sporadically 502 response #10588

Open amarkevich opened 1 year ago

amarkevich commented 1 year ago

What happened:

Elastic Heartbeat within the cluster perform HEAD requests to https://app.corp.com/context/ every 15 seconds. Application runs in the same cluster. Once per 2-3 hrs there is 502 response.

What you expected to happen:

Succeeded response

NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.): 1.9.4

Kubernetes version (use kubectl version): 1.26.6

Environment:

Custom CoreDNS configuration:

corp.com:53 {
  errors
  cache 30
  forward . %ONPREM_DNS1% %ONPREM_DNS2%
}

app.corp.com resolved to Ingress NGINX Controller ExternalIP

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: app
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
    nginx.ingress.kubernetes.io/affinity: "cookie"
    nginx.ingress.kubernetes.io/session-cookie-name: "JSESSIONID"
spec:
  tls:
  - hosts:
    - app.corp.com
    secretName: server-tls
  rules:
    - host: app.corp.com
      http:
        paths:
          - backend:
              service:
                name: app
                port:
                  number: 443
            path: /
            pathType: Prefix

How to reproduce this issue:

Anything else we need to know:

k8s-ci-robot commented 1 year ago

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
tao12345666333 commented 1 year ago

502 is a backend error, you should check your service

amarkevich commented 1 year ago

502 is a backend error, you should check your service

upstream: "https://0.0.0.1:80/context/" means due to hostname resolution issue request goes to 0.0.0.1 instread of service/pod IP

longwuyuan commented 1 year ago

so hostname resolution issues are better discussed in sig-networking channel of K8S slack maybe. I am curious about the problem in ingress-controller on this issue.

/remove-kind bug

amarkevich commented 12 months ago

@longwuyuan this is a part of NGINX configuration:

http {
    upstream upstream_balancer {
            server 0.0.0.1; # placeholder

same time another application works correctly

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: app2
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/proxy-buffer-size: "128k"
    nginx.ingress.kubernetes.io/affinity: "cookie"
    nginx.ingress.kubernetes.io/session-cookie-name: "AUTH_SESSION_ID"
spec:
  tls:
  - hosts:
    - app2.corp.com
    secretName: server-tls
  rules:
  - host: app2.corp.com
    http:
      paths:
        - backend:
            service:
              name: app2
              port:
                number: 8080
          path: /
          pathType: Prefix
github-actions[bot] commented 11 months ago

This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach #ingress-nginx-dev on Kubernetes Slack.