Kubernetes nginx ingress is not resolving services

8/22/2018

Cloud: Google Cloud Platform.

I have the following configuration

kind: Deployment
apiVersion: apps/v1
metadata:
  name: api
spec:
  replicas: 2
  selector:
    matchLabels:
      run: api
  template:
    metadata:
      labels:
        run: api
    spec:
      containers:
      - name: api
        image: gcr.io/*************/api
        ports:
        - containerPort: 8080
        livenessProbe:
          httpGet:
            path: /_ah/health
            port: 8080
          initialDelaySeconds: 10
          periodSeconds: 5
---
kind: Service
apiVersion: v1
metadata:
  name: api
spec:
  selector:
    run: api
  type: NodePort
  ports:
  - protocol: TCP
    port: 8080
    targetPort: 8080
---
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: main-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - http:
      paths:
      - path: /api/*
        backend:
          serviceName: api
          servicePort: 8080

All set. GKE saying that all deployments are okay, pods number are met and main ingress with nginx-ingress-controllers are set as well. But I'm not able to reach any of the services. Even application specific 404. Nothing. Like, it's not resolved at all.

Another related question I see to entrypoints. The first one through main-ingress. It created it's own LoadBalancer with own IP address. The second one address from nginx-ingress-controller. The second one is at least returning 404 from default backend, but also not pointing to expected api service.

enter image description here

-- QuestionAndAnswer
google-cloud-platform
kubernetes
nginx

0 Answers