Getting an Kubernetes Ingress endpoint/IP address

I had the same issue on my bare metal installation - or rather something close to that (kubernetes virtual cluster - set of virtual machines connected via Host-Only-Adapter). Here is link to my kubernetes vlab.

First of all make sure that you have ingress controller installed. Currently there are two ingress controller worth trying kubernetes nginx ingress controller and nginx kubernetes ingress controller -I installed first one.

Installation

Go to installation instructions and execute first step

# prerequisite-generic-deployment-command
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml

Next get IP addresses of cluster nodes.

$ kubectl get nodes -o wide
NAME     STATUS   ROLES    ...   INTERNAL-IP    
master   Ready    master   ...   192.168.121.110
node01   Ready    <none>   ...   192.168.121.111
node02   Ready    <none>   ...   192.168.121.112

Further, crate ingress-nginx service of type LoadBalancer. I do it by downloading NodePort template service from installation tutorial and making following adjustments in svc-ingress-nginx-lb.yaml file.

$ curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/baremetal/service-nodeport.yaml > svc-ingress-nginx-lb.yaml

# my changes svc-ingress-nginx-lb.yaml
type: LoadBalancer
externalIPs:
  - 192.168.121.110
  - 192.168.121.111
  - 192.168.121.112
externalTrafficPolicy: Local

# create ingress- service
$ kubectl apply -f svc-ingress-nginx-lb.yaml

Verification

Check that ingress-nginx service was created.

$ kubectl get svc -n ingress-nginx
NAME            TYPE           CLUSTER-IP     EXTERNAL-IP                                                       PORT(S)                      AGE
ingress-nginx   LoadBalancer   10.110.127.9   192.168.121.110,192.168.121.111,192.168.121.112   80:30284/TCP,443:31684/TCP   70m

Check that nginx-ingress-controller deployment was created.

$ kubectl get deploy -n ingress-nginx
NAME                       DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
nginx-ingress-controller   1         1         1            1           73m

Check that nginx-ingress pod is running.

$ kubectl get pods --all-namespaces -l 

app.kubernetes.io/name=ingress-nginx
NAMESPACE       NAME                                        READY   STATUS    RESTARTS   AGE
ingress-nginx   nginx-ingress-controller-5cd796c58c-lg6d4   1/1     Running   0          75m

Finally, check ingress controller version. Don't forget to change pod name!

$ kubectl exec -it nginx-ingress-controller-5cd796c58c-lg6d4 -n ingress-nginx -- /nginx-ingress-controller --version
-------------------------------------------------------------------------------
NGINX Ingress controller
  Release:    0.21.0
  Build:      git-b65b85cd9
  Repository: https://github.com/aledbf/ingress-nginx
-------------------------------------------------------------------------------

Testing

Test that ingress controller is working by executing steps in this tutorial -of course, you will omit minikube part.

Successful, execution of all steps will create ingress controler resource that should look like this.

$ kubectl get ing
NAME               HOSTS                                ADDRESS                                          PORTS    AGE
ingress-tutorial   myminikube.info,cheeses.all          192.168.121.110,192.168.121.111,192.168.121.112   80      91m

And pods that looks like this.

$ kubectl get pods 
NAME                              READY   STATUS             RESTARTS   AGE
cheddar-cheese-6f94c9dbfd-cll4z   1/1     Running            0          110m
echoserver-55dcfbf8c6-dwl6s       1/1     Running            0          104m
stilton-cheese-5f6bbdd7dd-8s8bf   1/1     Running            0          110m

Finally, test that request to myminikube.info propagates via ingress load balancer.

$ curl myminikube.info
CLIENT VALUES:
client_address=10.44.0.7
command=GET
real path=/
query=nil
request_version=1.1
request_uri=http://myminikube.info:8080/

SERVER VALUES:
server_version=nginx: 1.10.0 - lua: 10001

HEADERS RECEIVED:
accept=*/*
host=myminikube.info
user-agent=curl/7.29.0
x-forwarded-for=10.32.0.1
x-forwarded-host=myminikube.info
x-forwarded-port=80
x-forwarded-proto=http
x-original-uri=/
x-real-ip=10.32.0.1
x-request-id=b2fb3ee219507bfa12472c7d481d4b72
x-scheme=http
BODY:

It was a long journey to make ingress working on bear metal like environment.Thus, i will include relevant links that helped me along.

  • reproducable tutorial
  • installation of minikube on ubuntu
  • ingress I
  • ingress II
  • digging
  • reverse engineering on ingress in kubernetes

It seems that your cluster is missing Ingress controller.

In general, Ingress controller works as follows: 1. search for a certain type of objects (ingress,"nginx") in a cluster 2. parse that object and create configuration section for a specific ingress pod. 3. update that pod object (restart it with updated configuration)

That particular pod is responsible for processing traffic from incoming ports (usually a couple of dedicated ports on nodes) to configured traffic destination in cluster.

You can choose from two supported and maintained controllers - Nginx and GCE

The ingress controller consists of several components that you create during installation. Here is installation part from Nginx Ingress documentation:

curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/namespace.yaml              | kubectl apply -f -
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/default-backend.yaml        | kubectl apply -f -
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/configmap.yaml              | kubectl apply -f -
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/tcp-services-configmap.yaml | kubectl apply -f -
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/udp-services-configmap.yaml | kubectl apply -f -

If you have RBAC authorization configured in your cluster:

curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/rbac.yaml      | kubectl apply -f -
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/with-rbac.yaml | kubectl apply -f -

If no RBAC configured:

curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/without-rbac.yaml | kubectl apply -f -

In case you create cluster from scratch:

curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/baremetal/service-nodeport.yaml | kubectl apply -f -

Verify your installation:

kubectl get pods --all-namespaces -l app=ingress-nginx --watch

You should see something like:

NAMESPACE       NAME                                       READY     STATUS    RESTARTS   AGE
ingress-nginx   nginx-ingress-controller-699cdf846-nj2rw   1/1       Running   0          1h

Check available services and their parameters:

kubectl get services --all-namespaces

If you are using custom service provider deployment (minikube, AWS, Azure, GKE), follow Nginx Ingress documentation for installation details.

See official Kubernetes Ingress documentation for details about Ingress.


Check if you have an ingress controller in your cluster:

$ kubectl get po --all-namespaces

You should see something like:

kube-system nginx-ingress-controller-gwts0   1/1  Running   0    18d

It's only possible to create an ingress to address services inside the namespace in which the Ingress resides. Cross-namespace ingresses are not implemented for security reasons.