Use Ingress In Minikube

Source: https://kubernetes.world

At the beginning

With minikube addons enable ingress we can easy to get started with Ingress in Minikube. We can resolve the host name set in Ingress on the local name server to use it more comfortably. It’s also easy to use instead of Minikube’s standard Ingress Controller, which is more comfortable with a custom Cluster Add-on. If you are using Ingress in production, you want to use Ingress to verify the operation on your local Minikube.

To use Ingress, you need an Ingress Controller that configures L7 LB based on the created Ingress object. For example in GKE, there is an Ingress Controller that controls the Google Cloud Load Balancer (GCLB), and the GCLB is set according to the definition of the Ingress object. The local cluster created by Minikube, of course, does not have L7 LB.

Minikube provides a feature called addons that allows you to manage add-ons such as Kubernetes Dashboard, heapstar, and kube-dns. One of the add-ons is , nginx-ingress-controller that uses nginx as L7 LB of Ingress is provided, so you can easily start using Ingress.

Let’s start

Check if Your Minikube is Up and runnign if not just start minikube.

Once the cluster is created , use the command to enable Ingress.

After a few minutes, should be created in the namespace.

⚠️ If You see in output just delete it with using

Check Ingress

To see how it works, let’s deploy nginx and access it via Ingress LB.

Example deployment:

Now we will expose our deployment, and create Ingress

All path requests to nginx be forwarded to service port 80 with the host name example.kube.com

Example ingress configuration:

Now we can apply this configuration with

⚠️ Sometimes when creating Ingres error may occur as

To fix this error, just execute

Our cluster created with Minikube runs on a single master node machine, and of course the L7 LB nginx used by Ingress also runs on the same machine. Add the Host header to this IP address to access it and test if our Ingress works properly

Resolve hostnames by Ingress Controller

In this case for name resolution, we will use dnsmasq installed on the host machine.

Configuration:

With using above settings, the IP address of the machine output in example.kube.com the result of name resolution ip address will be returned, and it will be possible to access with the host name defined in Ingress Controller

DevOps Consultant. I’m strongly focused on automation, security, and reliability.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store