To set up Ingress in Minikube, follow these steps:
- Start by installing Minikube. You can find the installation steps for your operating system in the official Minikube documentation.
- Once Minikube is installed, start your Minikube cluster by running the following command:
- Verify that your cluster is up and running using the following command:
- Enable the Ingress addon for Minikube by executing the following command:
minikube addons enable ingress
This will deploy the Ingress controller in your Minikube cluster.
- Verify that the Ingress controller is deployed and running by executing the following command and checking if the Ingress controller pod is in the Running state:
kubectl get pods -n kube-system
- Set up a DNS entry or update your hosts file to map the hostname to the IP address of your Minikube cluster.
- Create an Ingress resource definition to define the routing rules for your application. For example, create an ingress.yaml file with the following content:
- host: myapp.example.com
- path: /app
This example Ingress definition will route requests with the hostname myapp.example.com/app to the my-app service running on port 80.
- Apply the Ingress resource definition to your Minikube cluster:
kubectl apply -f ingress.yaml
- Verify that the Ingress resource is created and the rules are correctly defined by running the following command:
kubectl get ingress
You should see the my-ingress Ingress resource with the defined rules.
- Configure your DNS or hosts file to map the desired hostname to the IP address of your Minikube cluster.
- Test the Ingress configuration by accessing your application using the defined hostname and path. For example, if you configured myapp.example.com/app, open your web browser and access http://myapp.example.com/app.
That's it! You have successfully set up Ingress in Minikube.