Nginx ingress - (Connection refused) while connecting to upstream

1/10/2020

I'm trying to expose my deployment on my Kubernetes cluster using a service and a Nginx ingress. I currently have following configuration.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mira-api-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mira-api
  template:
    metadata:
      labels:
        app: mira-api
    spec:
      containers:
        - name: backend
          image: registry.gitlab.com/izit/mira-backend
          ports:
            - containerPort: 8080
              name: http
              protocol: TCP

--- 

apiVersion: v1
kind: Service
metadata:
  name: mira-api-service
spec:
  ports:
  - port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    app: mira-api
  type: NodePort

---

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: mira-api-ingress
spec:
  tls:
    - hosts:
      - kubernetes.mira-appservice.be
      secretName: mirasecret
  rules:
    - host: kubernetes.mira-appservice.be
      http:
          paths:
            - backend:
                serviceName: mira-api-service
                servicePort: 8080

This configuration makes my deployment publically available over HTTPS with the correct certificate etc. The only problem is that I receive a HTTP 502 error message when making a request. When I check the logs of the ingress is see following error message: enter image description here

When I describe the ingress I get the following information: enter image description here

Is the configuration of my service correct? Or is there something else missing in the configuration?


UPDATE

Output for service: enter image description here enter image description here

-- Riraldy
kubernetes
kubernetes-ingress
nginx-ingress

0 Answers