You can Watch all our Tutorials and Training Videos for Free on ourYouTube Channel

Kubernetes Ingress Explained - Setup Ingress Controller

kubernetes ingress explained, setup ingress controller, create kubernetes ingress controller, configure ingress controller, create nginx ingress
This post will explain you about Kubernetes Ingress. This post covers below topics,

1. What is Kubernetes Ingress?
2. How Kubernetes Ingress is different from Kubernetes Services (Difference of Kubernetes Ingress vs Kubernetes Services) with architecture?
3. How to create ingress rules with Sample examples
4. What is kubernetes ingress controller?
5. Project that supports Kubernetes Ingress Controller?
6. How to setup kubernetes nginx ingress controller?

If you are new to kubernetes and want to learn about kubernetes from basics, Refer the below links and also you can checkout all tutorial videos for free on YouTube and do subscribe for more free videos.

What is Kubernetes - Learn Kubernetes from Basics
How to Install Kubernetes on Linux (RedHat / CentOS)
How to Install Kubernetes On Ubuntu 16.04 LTS
How to Create Kubernetes Deployment, Services & Pods Using Kubectl
How to Create Kubernetes YAML for Deployment, Service & Pods
Kubernetes Volumes Explained with Examples
Kubernetes Persistent Volumes and Claims Explained

Also You can Watch this Entire Tutorial video with more examples on our YouTube Channel.

Kubernetes Ingress Explained - Setup Ingress Controller

Lets get started.

What is Kubernetes Ingress?
what is kubernetes ingress

Kubernetes ingress is also a Kubernetes resource that allows access to your Kubernetes services from outside the Kubernetes cluster. Which means that routes traffic using collection of rules where we define which inbound connections should reach to which target services.

How Kubernetes Ingress is different from Kubernetes Services?

Kubernetes services also helps us to access our applications from outside the cluster. But ingress do a lot more than kubernetes services. Because, its a single resource that help us for loadbalancing, name based virtualhosting, ssl termination and more.

Lets take an example to understand kubernetes ingress vs kubernetes service.

Example Kubernetes Architecture without Ingress Controller:
kubernetes ingress examples

Above example architecture shows that some applications running within a cluster and if we want to access it from outside the cluster, what would you do, you will create a service either nodeport or loadbalancer to expose the application. Here we used loadbalancer for each application.

And also you must add these into dns for name resolution with A record. If you have multiple domains with multiple dns records for all applications, then, You will have multiple entrypoint to your kubernetes cluster to access your application hosted within it.

How about if I have single entrypoint for all my application that forwards the traffic to the respective services as like  a regular proxy servers in a kubernetes cluster as shown in the below architecture with ingress controller.
kubernetes ingress

So you dont need to expose all your application outside the cluster using nodeport or loadbalancer service type, instead just change all your application services to clusterip and keep your application safe within the cluster like private applications.

Then create a ingress controller that will be facing the external network, ingress controller is nothing but its a pod only that should be created to route the traffic and just define the rules in ingress resource.

Now you will expose only your ingress controller to outside the cluster using nodeport or loadbalancer. Edit your DNS and modify all the domain names to point our ingress controller.

At this point, we will have single entrypoint to all our applications.

If you access any of the application through url obviously traffic will be redirected to the ingress controller. There you will have ingress rules that controls the routing traffic, so Based on the domain and url pages you access,  traffic will be forwarded to target service.

How the ingress rules will be created?

It is also a kubernetes resources, so just create a file with ingress kind, it should be like this.

apiVersion: extensions/v1beta1
kind: Ingress
name: demo-ingress
- host:
- backend:
serviceName: Sales-svc
servicePort: 80
- host:
- backend:
serviceName: Purchase-svc
servicePort: 80
- host:
- backend:
serviceName: Examples-svc
servicePort: 80

Best part of this kubernetes ingress is that support virtualhosting. Which means you can host multiple domains in a single cluster even with different urls. Instead of having single ip address for each domain, you can have multiple domain can point to single target.

Also it supports both http port 80 and https 443.

Also controlling the traffic to the cluster can be easily managed through the ingress rules itself.

All of this rules can be done once you have setup your kubernetes ingress controller.

But without setting up ingress controller in the kubernetes cluster, ingress rules will not work.

There are many projects support kubernetes  ingress controller, some are nginx, haproxy, istio, traefix, and on public clouds, we have google cloud, amazon azure and many more.

Its upto us to choose which controller are we going to use in our cluster. I will setup my kubernetes ingress controller using nginx project.

Setting up Nginx Ingress Controller:

Clone the nginx project from github repository:

git clone

Deploy the Ingress Controller:

kubectl apply -f ingress-nginx/deploy/static/provider/aws/deploy.yaml

This deployment is for aws environment, if you have any other environment (aws, baremetal, cloud, do, kind), replace 'aws' with your provider.

Verify the namespace and pods running for ingress controller:

kubectl get ns

You must have namespace created for ingress controller "ingress-nginx".

kubectl -n ingress-nginx get pods -o wide

Make sure all pods running within this namespace ingress-nginx. Also check the service type for this ingress should be either LoadBalancer or NodePort.

kubectl -n ingress-nginx get svc

Bydefault this ingress controller use service type LoadBalancer, so you must have external ip issued by ELB if you have this kubernetes setup on AWS. So it can be used to access our kubernetes cluster from externally. Ports that is exposed or port 80 and 443.

You can create ingress rules for your applications and apply the ingress to access the applications.

Also You can Watch this Entire Tutorial video with more examples on our YouTube Channel. Make use of it.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.
whatsapp logo