kubernetes ingress-nginx controller- connect() failed (111: connection refused) while connecting to upstream

127 Views Asked by At
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-skyway-host
  annotations:
    # kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: "true"
    # nginx.ingress.kubernetes.io/websocket-services: "chat-srv-service"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
  ingressClassName: nginx
  # tls:
  #   - hosts:

  #       - "focuspoint.shop"
  #     secretName: focuspoint-shop-tls
  rules:
    - host: "flyway.website"
      http:
        paths:
          - path: /api/chat-srv/
            pathType: Prefix
            backend:
              service:
                name: chat-srv-service
                port:
                  number: 4003
          - pathType: Prefix
            path: /api/user-srv
            backend:
              service:
                name: user-srv-service
                port:
                  number: 3000
          - pathType: Prefix
            path: /api/venture-srv
            backend:
              service:
                name: venture-srv-service
                port:
                  number: 3001
          - path: /api/admin-srv
            pathType: Prefix
            backend:
              service:
                name: admin-srv-service
                port:
                  number: 3002
          - path: "/"
            pathType: Prefix
            backend:
              service:
                name: client-srv-service
                port:
                  number: 5173
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: chat-srv-deployment
  labels:
    app: chat-srv
spec:
  replicas: 1
  selector:
    matchLabels:
      app: chat-srv
  template:
    metadata:
      labels:
        app: chat-srv
    spec:
      restartPolicy: Always
      containers:
        - name: chat-srv
          image: muhammedajmal/skyway-chat-srv:v14
---
apiVersion: v1
kind: Service
metadata:
  name: chat-srv-service
spec:
  # type: NodePort
  selector:
    app: chat-srv
  ports:
    - protocol: TCP
      port: 4003
      targetPort: 4003


Iam facing one of the error ..basically the problem is in microservices i have four services . i deployed to digital ocean k8s cluster . i gave here my ingress configration as well..every servervices are working fine except chat-srv-service ..it's not about chat problem ,The service did'nt get the API call's. when try to access the chat-srv-service showing bad gateway 502 error . when i check the k8s services object and deployment object everything is fine. when login the appropritate pod that also working fine ..there will be have no problem when describing the ingress that also perfect like the endpoints are correct . after ..iam try to access the chat base (chat service base api https://flyway.website/api/chat-srv/) api after checking the ingress logs there will be showing error like that image.(

2024/02/02 13:45:56 [error] 448#448: *1959729 connect() failed (111: Connection refused) while connecting to upstream, client: 162.158.22.16, server: flyway.website, request: "GET /api/chat-srv/ HTTP/1.1", upstream: "http://10.244.0.36:4003/api/chat-srv/", host: "flyway.website"

2024/02/02 14:07:02 [crit] 448#448: *1970788 SSL_do_handshake() failed (SSL: error:0A00006C:SSL routines::bad key share) while SSL handshaking, client: 10.122.0.5, server: 0.0.0.0:443) !Errror showing like this when login ingress:- (https://i.stack.imgur.com/Egb3A.jpg)

container is running fine . But Api call not reaching to chat-srv

Any one resolved like This issue.. please share you experience and how you solve this.That could be very help for me

0

There are 0 best solutions below