To bind nginx-ingress to a public IP with minikube, you can follow these steps:
- Start minikube with a specific IP address: Run the following command to start minikube with a specific IP address:
minikube start --extra-config='kube-proxy.externalTrafficPolicy=Local' --extra-config='apiserver.service-node-port-range=1-35000' --apiserver-ips
- Enable the NGINX Ingress Controller: First, make sure the NGINX Ingress Controller is enabled in minikube by running the following command:
minikube addons enable ingress
- Create an Ingress resource: Use the desired specifications to create an Ingress resource. For example, create an ingress.yaml file with the following content:
- Apply the Ingress resource: Run the following command to apply the Ingress resource:
kubectl apply -f ingress.yaml
- Verify the setup: Verify that the ingress is created and that the NGINX Ingress Controller is handling traffic by checking the ingress status and external IP:
kubectl get ingress
- Map the public IP with your domain: If you are using a domain name, make sure you map the public IP address with your domain in your DNS provider's settings.
Now, the NGINX Ingress Controller should be bound to the public IP specified in the minikube startup command and ready to handle incoming traffic.
Note: Using minikube, the public IP address specified is only accessible from your local machine or the network where minikube is running, and not from the global internet.