<p>I'm new to using Kubernetes and AWS so there are a lot of concepts I may not understand. I hope you can help me with this problem I am having.</p>
<p>I have 3 services, <strong>frontend</strong>, <strong>backend</strong> and <strong>auth</strong> each with their corresponding <strong>nodeport</strong> and an <strong>ingress</strong> that maps the one host to each service, everything is running on EKS and for the ingress deployment I am using <strong>AWS ingress controller</strong>. Once everything is deployed I try to register the node-group in the targets the frontend and auth services work correctly but backend stays in unhealthy state. I thought it could be a port problem but if you look at auth and backend they have almost the same deployment defined and both are api created with dotnet core. One thing to note is that I can do <code>kubectl port-forward &lt;backend-pod&gt; 80:80</code> and it is running without problems. And when I run the <code>kubectl describe ingresses</code> command I get this:</p>
<pre><code>Name:             ingress
Labels:           app.kubernetes.io/managed-by=Helm
Namespace:        default
Address:          xxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxx.elb.amazonaws.com
Ingress Class:    \&lt;none\&gt;
Default backend:  \&lt;default\&gt;
Rules:
Host                                  Path  Backends

----------------

domain.com
/   front-service:default-port (10.0.1.183:80,10.0.2.98:80)
back.domain.com
/   backend-service:default-port (\&lt;none\&gt;)
auth.domain.com
/   auth-service:default-port (10.0.1.30:80,10.0.1.33:80)
alb.ingress.kubernetes.io/listen-ports: \[{&quot;HTTPS&quot;:443}, {&quot;HTTP&quot;:80}\]
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/ssl-redirect: 443
kubernetes.io/ingress.class: alb

Events:
Type    Reason                  Age                   From     Message

-------------------------

Normal  SuccessfullyReconciled  8m20s (x15 over 41h)  ingress  Successfully reconciled
</code></pre>
<h3>Frontend</h3>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: front
  labels:
    name: front
spec:
  replicas: 2
  selector:
    matchLabels:
      name: front
  template:
    metadata:
      labels:
        name: front
    spec:
      containers:
      - name: frontend
        image:  {{ .Values.image }}
        imagePullPolicy: Always
        ports:
          - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: wrfront-{{ .Values.namespace }}-service
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80
    name: default-port
    protocol: TCP
  selector:
    name: front
---
</code></pre>
<h3>Auth</h3>
<pre class="lang-yaml prettyprint-override"><code>kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-wrauth-keys
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 200Gi
---
apiVersion: &quot;v1&quot;
kind: &quot;ConfigMap&quot;
metadata:
  name: &quot;auth-config-ocpm&quot;
  labels:
    app: &quot;auth&quot;
data:
  ASPNETCORE_URL: &quot;http://+:80&quot;
  ASPNETCORE_ENVIRONMENT: &quot;Development&quot;
  ASPNETCORE_LOGGINGCONSOLEDISABLECOLORS: &quot;true&quot;
---
apiVersion: &quot;apps/v1&quot;
kind: &quot;Deployment&quot;
metadata:
  name: &quot;auth&quot;
  labels:
    app: &quot;auth&quot;
spec:
  replicas: 2
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: &quot;auth&quot;
  template:
    metadata:
      labels:
        app: &quot;auth&quot;
    spec:
      volumes:
        - name: auth-keys-storage
          persistentVolumeClaim:
            claimName: pvc-wrauth-keys
      containers:
        - name: &quot;api-auth&quot;
          image: {{ .Values.image }}
          imagePullPolicy: Always
          ports:
            - containerPort: 80
          volumeMounts:
            - name: auth-keys-storage
              mountPath: &quot;/app/auth-keys&quot;
          env:
            - name: &quot;ASPNETCORE_URL&quot;
              valueFrom:
                configMapKeyRef:
                  key: &quot;ASPNETCORE_URL&quot;
                  name: &quot;auth-config-ocpm&quot;
            - name: &quot;ASPNETCORE_ENVIRONMENT&quot;
              valueFrom:
                configMapKeyRef:
                  key: &quot;ASPNETCORE_ENVIRONMENT&quot;
                  name: &quot;auth-config-ocpm&quot;
            - name: &quot;ASPNETCORE_LOGGINGCONSOLEDISABLECOLORS&quot;
              valueFrom:
                configMapKeyRef:
                  key: &quot;ASPNETCORE_LOGGINGCONSOLEDISABLECOLORS&quot;
                  name: &quot;auth-config-ocpm&quot;
---
apiVersion: v1
kind: Service
metadata:
  name: auth-service
spec:
  type: NodePort
  selector:
    app: auth
  ports:
  - name: default-port
    protocol: TCP
    port: 80
    targetPort: 80

</code></pre>
<h3>Backend (Service with problem)</h3>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend
  labels:
    app: backend
spec:
  replicas: 2
  selector:
    matchLabels:
      app: backend
  template:
    metadata:
      labels:
        app: backend
    spec:
      containers:
        - name: backend
          image: {{ .Values.image }}
          imagePullPolicy: Always
          ports:
            - containerPort: 80        
---
apiVersion: v1
kind: Service
metadata:
  name: backend-service
spec:
  type: NodePort
  selector:
    name: backend
  ports:
  - name: default-port
    protocol: TCP
    port: 80
    targetPort: 80
</code></pre>
<h3>Ingress</h3>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress
  annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
    kubernetes.io/ingress.class: alb
    # SSL Settings
    alb.ingress.kubernetes.io/listen-ports: '[{&quot;HTTPS&quot;:443}, {&quot;HTTP&quot;:80}]'
    alb.ingress.kubernetes.io/ssl-redirect: '443'
    alb.ingress.kubernetes.io/certificate-arn: {{ .Values.certificate }}
spec:
  rules:
    - host: {{ .Values.host }}
      http:
        paths:
          - path: /
            backend:
              service:
                name: front-service
                port:
                  name: default-port
            pathType: Prefix
    - host: back.{{ .Values.host }}
      http:
        paths:
          - path: /
            backend:
              service:
                name: backend-service
                port:
                  name: default-port
            pathType: Prefix
    - host: auth.{{ .Values.host }}
      http:
        paths:
          - path: /
            backend:
              service:
                name: auth-service
                port:
                  name: default-port
            pathType: Prefix
</code></pre>
<p>I've tried to deploy other services and they work correctly, also running only backend or only another service, but always the same thing happens and always with the backend.</p>
<p>What could be happening? Is it a configuration problem? Some error in Ingress or Deployment? Or is it just the backend service?</p>
<p>I would be very grateful for any help.</p>

Sandor Martin Leyva
<pre><code>domain.com
/   front-service:default-port (10.0.1.183:80,10.0.2.98:80)
back.domain.com
/   backend-service:default-port (\&lt;none\&gt;)
auth.domain.com
/   auth-service:default-port (10.0.1.30:80,10.0.1.33:80)
</code></pre>
<p>This one is saying that your backend service is not registered to the Ingress.</p>
<p>One thing to remember is that Ingress registers Services by pods' ClusterIP, like your Ingress output &quot;10.0.1.30:80&quot;, not NodePort. And according to <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport" rel="nofollow noreferrer">docs</a> , I don't know why you can have multiple NodePort services with the same port. But when you do port-forward, you actually open that port on all your instances, I assume you have 2 instances, and then your ALB health check that port and return healthy.</p>
<p>But I think your issue is from your Ingress that can not locate your backend service.</p>
<p>My suggestions are:</p>
<ul>
<li><p>Trying with only backend-service with port changed, and maybe without auth and frontend services. Default range of NodePort is 30000 - 32767</p>
</li>
<li><p>Going inside that pod or create a new pod, make a request to that service using its URL to check what it returns. By default, ALB only accept status 200 from its homepage.</p>
</li>
</ul>
