How to Install NGINX Ingress Controller on Kubernetes
To install the
nginx ingress controller on Kubernetes, apply the official YAML manifest using kubectl apply -f from the NGINX Ingress repository. This deploys the controller and necessary resources to manage external access to your services.Syntax
The basic command to install the NGINX Ingress Controller is:
kubectl apply -f <manifest-url>: Downloads and applies the Kubernetes manifest file that creates all required resources.- The manifest URL points to the official NGINX Ingress Controller YAML file hosted on GitHub.
- This command creates namespaces, deployments, services, and RBAC rules automatically.
bash
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.9.1/deploy/static/provider/cloud/deploy.yamlExample
This example installs the NGINX Ingress Controller on a Kubernetes cluster using the official manifest. It sets up the controller in the ingress-nginx namespace and creates all necessary components.
bash
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.9.1/deploy/static/provider/cloud/deploy.yaml
kubectl get pods -n ingress-nginxOutput
namespace/ingress-nginx created
serviceaccount/ingress-nginx created
configmap/ingress-nginx-controller created
clusterrole.rbac.authorization.k8s.io/ingress-nginx created
clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx created
deployment.apps/ingress-nginx-controller created
service/ingress-nginx-controller created
NAME READY STATUS RESTARTS AGE
ingress-nginx-controller-7d7f7f7f7f-abcde 1/1 Running 0 30s
Common Pitfalls
Common mistakes when installing the NGINX Ingress Controller include:
- Using an outdated or incorrect manifest URL, which can cause installation failure.
- Not waiting for the controller pods to be in
Runningstate before creating ingress resources. - Missing cluster role bindings, which prevent the controller from managing resources.
- Trying to install on unsupported Kubernetes versions or environments without proper permissions.
Always verify the manifest URL matches the latest stable release and check pod status with kubectl get pods -n ingress-nginx.
bash
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/old-branch/deploy.yaml # Wrong: old manifest URL kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.9.1/deploy/static/provider/cloud/deploy.yaml # Right: latest stable manifest URL
Quick Reference
Summary tips for installing NGINX Ingress Controller:
- Use the official manifest URL from the
ingress-nginxGitHub repository. - Check pod status in the
ingress-nginxnamespace after installation. - Ensure your Kubernetes cluster version is compatible (usually 1.19+).
- Use
kubectl delete -f <manifest-url>to uninstall cleanly.
Key Takeaways
Install NGINX Ingress Controller by applying the official manifest with kubectl.
Always use the latest stable manifest URL from the ingress-nginx GitHub repository.
Verify the controller pods are running in the ingress-nginx namespace before use.
Avoid outdated manifests and check Kubernetes version compatibility.
Use kubectl commands to manage installation and uninstallation cleanly.