- Apply the Required RBAC (Role-Based Access Control) and Service Account
- Create a service account for the NGINX Ingress Controller and assign it the necessary permissions.
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yamlThis will create all the necessary resources for the NGINX Ingress Controller, including:
- Service accounts
- ClusterRoles and ClusterRoleBindings
- Deployments
- Services
- ConfigMaps
- Ingress Class
- Verify Ingress Controller Installation
- After applying the YAML file, verify that the NGINX Ingress Controller is installed and running.
kubectl get pods -n ingress-nginxThis should show the ingress-nginx-controller pods running.
- Expose the NGINX Ingress Controller (Optional)
- If you want to access the Ingress controller externally (e.g., via LoadBalancer), the ingress-nginx-controller service should be of type LoadBalancer.
To modify the service type, you can run:
kubectl patch svc ingress-nginx-controller -n ingress-nginx -p '{"spec": {"type": "LoadBalancer"}}'This will expose the NGINX Ingress Controller via a LoadBalancer, allowing you to access your applications from outside the cluster.