Writing a custom Ingress Controller - cannot asign Address to Ingress

9/30/2016

I'm following instructions on how to write a custom Ingress Controller - however for me they stop short of quite an important step - how to assign an Address to the Ingress claimed by this Controller.

So far I've tried to execute the following steps:

  1. Deploy the Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: myWebAppIngress
spec:
  backend:
    serviceName: myWebAppBackendSvc
    servicePort: 8090
  1. Deploy the RC with the custom Ingress Controller setting up the ports as below
ports:
    - containerPort: 80
      hostPort: 80
    - containerPort: 443
      hostPort: 443
  1. Note the external IP of the Node on which the Ingress Controller was deployed and
  2. Patch the Ingress with this IP: kubectl patch ingress myWebAppIngress -p='{"status": {"loadBalancer": {"ingress": [{"ip": "<IP noted below>"}]}}}'

However, this has not assigned an address to my Ingress, as I can see in kubectl get ingress myWebAppIngress Does anyone know what I need to do in order to assign an address to the Ingress?

-- Marcin Nowrot
kubernetes

1 Answer

9/30/2016

hostPort exposes your application on given ports on nodes that this app is launched on. This will not give you external IP as it does not ie. provision cloud loadbalancer.

If you want to stick to fully automated k8s setup for this, then first you should be able to correctly use services with LoadBalancer type, and define such service for your ingress controller http://kubernetes.io/docs/user-guide/services/#type-loadbalancer

another approach can be to use service of NodePort type (it has the advantage of the nodePort being managed by kube-proxy hence available also on nodes not running the ingress pod) and manually configure your loadbalancer to point to assigned nodePorts.

sidenote: you should never need to fiddle with status field contents

-- Radek 'Goblin' Pieczonka
Source: StackOverflow