Azure kubernates Connection refused

Artur Hovhannisyan 0 Reputation points
2024-02-14T18:06:14.8166667+00:00

I am new at Kubernetes . I have Duende identity server deployed on azure Kubernetes the pod is running, however when I open via browser I get 502 Bad Gateway- ingress logs 6818062 connect() failed (111: Connection refused) while connecting to upstream, client here is my service

apiVersion: v1
kind: Service
metadata:
  name: test-clusterip-srv
spec:
  type: LoadBalancer
  selector:
    app: test-server
  ports:
    - name: test-server-http
      protocol: TCP
      port: 80
      targetPort: 980
    - name: test-worker-https
      port: 443
      targetPort: 9443
      protocol: TCP

I tried to open it via external IP but got ERR_CONNECTION_TIMED_OUT. Here is my ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /test$1
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    cert-manager.io/cluster-issuer: letsencrypt
spec:
  ingressClassName: nginx
  tls:
  - hosts:
      - test.eastus.cloudapp.azure.com
    secretName: tls-secret  
  rules:
  - host: test.eastus.cloudapp.azure.com
    http:
      paths:
        - path: /test(.*)
          pathType: ImplementationSpecific
          backend:
            service:
              name: test-clusterip-srv
              port:
                number: 80

Developer technologies | ASP.NET | ASP.NET Core
Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,457 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anveshreddy Nimmala 3,550 Reputation points Microsoft External Staff Moderator
    2024-02-15T05:34:26.5033333+00:00

    Hi
    Artur Hovhannisyan

    Thankyou for replying back. the configuration looks correct. However, in ingress file the pathType field is set to ImplementationSpecific, which means that the path type is determined by the Ingress controller. This might cause issues if the Ingress controller is not configured to handle this path type. You might want to consider setting the pathType field to Prefix or Exact to ensure that the path type is correctly configured. In Deployment file the annotations field of the metadata section of the ServiceAccount resource is incomplete. It seems like the azure.workload.identity/client-id annotation is missing a value. You might want to update the annotation with the correct value. If you are still experiencing issues, you can try checking the logs of the Nginx Ingress Controller to see if there are any errors. You can use the following command to check the logs: kubectl logs <nginx-ingress-controller-pod-name> you can try checking the logs of the Pod to see if there are any errors. You can use the following command to check the logs:

    kubectl logs <pod-name>
    

    Hope the answer has been helpful, please consider accepting the answer to help increase visibility of this question for other members of the Microsoft Q&A community. If not, please let us know what is still needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.