Kubernetes Ingress not accessible (localhost)

7/20/2017

I am setting up a minimal Kubernetes cluster on localhost on a Linux machine (starting with hack/local-up-cluster from the checked out repo). In my deployment file I defined an ingress, which should make the services, which are deployed in the cluster, accessible from the outside. Deployment.yml:

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: foo-service-deployment
spec:
  replicas: 2
  template:
    metadata:
      labels:
        app: foo-service
    spec:
      containers:
        - name: foo-service
          image: images/fooservice
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 7778
---
apiVersion: v1
kind: Service
metadata:
  name: foo-service-service
spec:
  ports:
    - port: 7778
  selector:
    app: foo-service
  type: NodePort
---    
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: api-gateway-ingress
spec:
  rules:
  - host:
    http:
      paths:
      - path: /foo
        backend:
          serviceName: foo-service-service
          servicePort: 7779
      - path: /bar
        backend:
          serviceName: bar-service-service
          servicePort: 7776

I can not access the services. kubectl describe shows the following for my ingress:

Name:           api-gateway-ingress
Namespace:      default
Address:        
Default backend:    default-http-backend:80 (<none>)
Rules:
  Host  Path    Backends
  ----  ----    --------
  * 
        /foo    foo-service-service:7779 (<none>)
        /bar    bar-service-service:7776 (<none>)
Annotations:
Events: <none>

Is it because there is not address set for my ingress, that it is not visible to outside world yet?

-- Skeffington
kubectl
kubernetes
kubernetes-go-client

1 Answer

7/20/2017

An Ingress resource is just a definition for your cluster how to handle ingress traffic. It needs an Ingress Controller to actually process these definitions; creating an Ingress resource without having deployed an Ingress controller will not have any effect.

From the documentation:

In order for the Ingress resource to work, the cluster must have an Ingress controller running. This is unlike other types of controllers, which typically run as part of the kube-controller-manager binary, and which are typically started automatically as part of cluster creation. You need to choose the ingress controller implementation that is the best fit for your cluster, or implement one.

There are several Ingress controllers available that you can deploy by yourself (typically, via a Deployment resource), like for example the NGINX ingress controller (which is part of the Kubernetes project) or third-party ingress controllers like Traefik, Envoy or Voyager.

-- helmbert
Source: StackOverflow