Minikube’s Ingress controller is not a built-in feature; it’s an add-on you have to explicitly enable and configure.
Let’s get Nginx Ingress up and running in Minikube so you can start exposing your services.
First, we need to enable the Ingress addon for Minikube. This command downloads and deploys the Nginx Ingress controller to your Minikube cluster.
minikube addons enable ingress
Once enabled, Minikube will tell you it’s active. You can verify this by checking the status of the ingress-nginx deployment:
kubectl get deployment -n ingress-nginx ingress-nginx-controller
You should see one replica available. If not, give it a minute and try again.
Now, to actually use the Ingress controller, we need to create an Ingress resource. This resource defines how external traffic should be routed to your internal Kubernetes services. Let’s create a simple hello-world service and an Ingress to expose it.
First, create a deployment and service for a simple web application:
# hello-world-app.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
spec:
replicas: 1
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-world
image: nginxdemos/hello:plain-text
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: hello-world-service
spec:
selector:
app: hello-world
ports:
- protocol: TCP
port: 80
targetPort: 80
Apply this to your cluster:
kubectl apply -f hello-world-app.yaml
Next, create an Ingress resource that points to this service. We’ll use hello.minikube.internal as the hostname. Minikube’s Ingress addon configures the controller to respond to this specific hostname.
# hello-world-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hello-world-ingress
spec:
rules:
- host: hello.minikube.internal
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: hello-world-service
port:
number: 80
Apply this Ingress:
kubectl apply -f hello-world-ingress.yaml
To make hello.minikube.internal resolve to your Minikube instance, you need to update your local /etc/hosts file (or equivalent on Windows/macOS).
First, find the IP address of your Minikube Ingress controller:
kubectl get ingress -n ingress-nginx
You’ll see output like:
NAME CLASS HOSTS ADDRESS PORTS AGE
hello-world-ingress <none> hello.minikube.internal 192.168.49.100 80 5s
The ADDRESS is what you need. It’s usually the IP of your Minikube VM. On Linux/macOS, add this line to your /etc/hosts file:
192.168.49.100 hello.minikube.internal
(Replace 192.168.49.100 with the actual IP address shown in your kubectl get ingress output.)
On Windows, you’ll edit C:\Windows\System32\drivers\etc\hosts.
Now, you can test it by curling the hostname:
curl http://hello.minikube.internal
You should see the output from the nginxdemos/hello image.
The most surprising thing about Minikube’s Ingress setup is that it relies on a specific hostname (hello.minikube.internal by default, though this can be configured) to correctly route traffic. The Ingress controller itself is exposed via a NodePort service, and the minikube addons enable ingress command handles setting up this service and the associated ingress-nginx-controller deployment. The magic happens when you update your local hosts file to point that specific hostname to the Minikube VM’s IP address, allowing your local machine to resolve and reach the Ingress controller.
The ingress-nginx-controller deployment is managed by the ingress-nginx namespace. If you ever need to delete the Ingress controller, you can disable the addon: minikube addons disable ingress.
The next thing you’ll likely want to explore is how to configure TLS (HTTPS) for your Ingress resources.