Ingress

K8s Load Balancer

NGINX Ingress

Deploy NGINX ingress

Deploy NGINX ingress:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml

Deploy NGINX ingress service (example for bare-metal):

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

Check if the service was created:

kubectl get services --namespace=ingress-nginx

Output example:

NAME            TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
ingress-nginx   NodePort   10.111.35.186   <none>        80:32022/TCP,443:31845/TCP   29m
circle-info

Note port(s) of the service. It will be used later to access your host.

Test a deployment

Let's create two different deployments to test.

Create the first deployment:

Create the second deployment:

Create ingress

Text:

Check the ingress:

Test

Get your cluster IP:

Edit your hosts file accordingly, for example:

http://test-001.com:30808/arrow-up-right http://test-002.com:30808/arrow-up-right http://test-003.com:30808/test-001arrow-up-right http://test-003.com:30808/test-002arrow-up-right

circle-info

Use you ingress service port.

References

http://fabricioveronez.net/2019/04/05/kubernetes-ingress-controller/arrow-up-right

https://kubernetes.github.io/ingress-nginx/deploy/arrow-up-right

https://itnext.io/kubernetes-ingress-controllers-how-to-choose-the-right-one-part-1-41d3554978d2arrow-up-right

https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/rewrite/README.mdarrow-up-right

Last updated