Install NGINX Ingress Controller LTS with Manifests
This guide explains how to use Manifests to install F5 NGINX Ingress Controller LTS, then create both common and custom resources and set up role-based access control.
If you are using NGINX Plus, get the NGINX Ingress Controller LTS JWT and create a license secret.
We recommend installing the latest LTS patch release of NGINX Ingress Controller LTS, available on the GitHub repository’s releases page.
Choose one of the following methods to get the NGINX Ingress Controller LTS image:
- NGINX Plus Ingress Controller: You have two options for this, both requiring an NGINX Ingress Controller LTS subscription.
- Build your own image: To build your own image, follow the Build NGINX Ingress Controller LTS topic.
Clone the NGINX Ingress Controller LTS repository using the command shown below, and replace <version_number> with the specific release you want to use.
git clone https://github.com/nginx/kubernetes-ingress.git --branch <version_number>For example, if you want to use version 5.5.0, the command would be:
git clone https://github.com/nginx/kubernetes-ingress.git --branch v5.5.0This guide assumes you are using the latest release.
Change the active directory.
cd kubernetes-ingressAdmin access requiredTo complete these steps you need admin access to your cluster. Refer to to your Kubernetes platform’s documentation to set up admin access. For Google Kubernetes Engine (GKE), you can refer to their Role-Based Access Control guide.
-
Create a namespace and a service account:
kubectl apply -f deployments/common/ns-and-sa.yaml -
Create a cluster role and binding for the service account:
kubectl apply -f deployments/rbac/rbac.yaml
If you’re planning to use F5 WAF for NGINX or F5 DoS for NGINX, additional roles and bindings are needed.
-
(F5 WAF for NGINX only) Create the App Protect role and binding:
kubectl apply -f deployments/rbac/ap-rbac.yaml -
(F5 DoS for NGINX only) Create the App Protect DoS role and binding:
kubectl apply -f deployments/rbac/apdos-rbac.yaml
In this section, you’ll create resources that most NGINX Ingress Controller installations require:
-
(Optional) Create a secret for the default NGINX server’s TLS certificate and key. Complete this step only if you’re using the default server TLS secret command-line argument. If you’re not, feel free to skip this step.
By default, the server returns a 404 Not Found page for all requests when no ingress rules are set up. Although we provide a self-signed certificate and key for testing purposes, we recommend using your own certificate.
shell make secrets kubectl apply -f examples/shared-examples/default-server-secret/default-server-secret.yaml -
Create a ConfigMap to customize your NGINX settings:
kubectl apply -f deployments/common/nginx-config.yaml -
Create an
IngressClassresource. NGINX Ingress Controller won’t start without anIngressClassresource.kubectl apply -f deployments/common/ingress-class.yamlIf you want to make this NGINX Ingress Controller instance your cluster’s default, uncomment the
ingressclass.kubernetes.io/is-default-classannotation. This action will auto-assignIngressClassto new ingresses that don’t specify aningressClassName.
You have three options for deploying NGINX Ingress Controller LTS:
- Deployment. Choose this method for the flexibility to dynamically change the number of NGINX Ingress Controller LTS replicas.
- DaemonSet. Choose this method if you want NGINX Ingress Controller LTS to run on all nodes or a subset of nodes.
- StatefulSet. Choose this method when you need stable, persistent storage and ordered deployment/scaling for your NGINX Ingress Controller LTS pods.
Before you start, update the command-line arguments for the NGINX Ingress Controller LTS container in the relevant manifest file to meet your specific requirements.
For additional context on managing containers using Kubernetes Deployments, refer to the official Kubernetes Deployments documentation.
When you deploy NGINX Ingress Controller as a Deployment, Kubernetes automatically sets up a single NGINX Ingress Controller pod.
-
For NGINX, run:
kubectl apply -f deployments/deployment/nginx-ingress.yaml -
For NGINX Plus, run:
kubectl apply -f deployments/deployment/nginx-plus-ingress.yamlUpdate the
nginx-plus-ingress.yamlfile to include your chosen image from the F5 Container registry or your custom container image.
For additional context on managing containers using Kubernetes DaemonSets, refer to the official Kubernetes DaemonSets documentation.
When you deploy NGINX Ingress Controller as a DaemonSet, Kubernetes creates an Ingress Controller pod on every node in the cluster.
-
For NGINX, run:
kubectl apply -f deployments/daemon-set/nginx-ingress.yaml -
For NGINX Plus, run:
kubectl apply -f deployments/daemon-set/nginx-plus-ingress.yamlUpdate the
nginx-plus-ingress.yamlfile to include your chosen image from the F5 Container registry or your custom container image.
For additional context on managing containers using Kubernetes StatefulSets, refer to the official Kubernetes StatefulSets documentation.
When you deploy NGINX Ingress Controller as a StatefulSet, Kubernetes creates pods with stable network identities and persistent storage.
-
For NGINX, run:
kubectl apply -f deployments/stateful-set/nginx-ingress.yaml -
For NGINX Plus, run:
kubectl apply -f deployments/stateful-set/nginx-plus-ingress.yamlUpdate the
nginx-plus-ingress.yamlfile to include your chosen image from the F5 Container registry or your custom container image.
StatefulSets include persistent volume claims for nginx cache storage viavolumeClaimTemplates. You may need to configure a StorageClass in your cluster or modify the volumeClaimTemplates section in the manifest to match your storage requirements. Other volumes (like those needed for App Protect modules) are configured in the regularvolumessection, not in volumeClaimTemplates.
To confirm the NGINX Ingress Controller pods are operational, run:
kubectl get pods --namespace=nginx-ingressFor Deployments and StatefulSets, you have two options for accessing NGINX Ingress Controller LTS pods.
For more information about the NodePort service, refer to the Kubernetes documentation.
-
To create a service of type NodePort, run:
kubectl create -f deployments/service/nodeport.yamlKubernetes automatically allocates two ports on every node in the cluster. You can access NGINX Ingress Controller LTS by combining any node’s IP address with these ports.
For more information about the LoadBalancer service, refer to the Kubernetes documentation.
-
To set up a LoadBalancer service, run one of the following commands based on your cloud provider:
-
GCP or Azure:
kubectl apply -f deployments/service/loadbalancer.yaml -
AWS:
kubectl apply -f deployments/service/loadbalancer-aws-elb.yamlFor more details see service guide here
-
-
AWS users: Follow these additional steps to work with ELB in TCP mode.
-
Add the following keys to the
nginx-config.yamlConfigMap file, which you created in the Create common resources section.yaml proxy-protocol: "True" real-ip-header: "proxy_protocol" set-real-ip-from: "0.0.0.0/0" -
Update the ConfigMap:
kubectl apply -f deployments/common/nginx-config.yaml
AWS users have more customization options for their load balancers. These include choosing the load balancer type and configuring SSL termination. Refer to the Kubernetes documentation to learn more. -
-
To access NGINX Ingress Controller LTS, get the public IP of your load balancer.
-
For GCP or Azure, run:
kubectl get svc nginx-ingress --namespace=nginx-ingress -
For AWS find the DNS name:
kubectl describe svc nginx-ingress --namespace=nginx-ingressResolve the DNS name into an IP address using
nslookup:nslookup <dns-name>
You can also find more details about the public IP in the status section of an ingress resource. For more details, refer to the Reporting Resources Status doc.
-
Connect to ports 80 and 443 using the IP address of any node in the cluster where NGINX Ingress Controller LTS is running.
WarningProceed with caution when performing these steps, as they will remove NGINX Ingress Controller LTS and all related resources, potentially affecting your running services.
-
Delete the nginx-ingress namespace: To remove NGINX Ingress Controller LTS and all auxiliary resources, run:
kubectl delete namespace nginx-ingress -
Remove the cluster role and cluster role binding:
shell kubectl delete clusterrole nginx-ingress kubectl delete clusterrolebinding nginx-ingress -
Delete the Custom Resource Definitions:
Delete core custom resource definitions:
kubectl delete -f https://raw.githubusercontent.com/nginx/kubernetes-ingress/v5.5.0/deploy/crds.yamlDelete core custom resource definitions:
kubectl delete -f config/crd/bases/crds.yaml