# NGINX WAF Ingress - [Deploy NGINX Ingress Controller Operator](#deploy-nginx-ingress-controller-operator) - [Create an instance of NginxIngress](#create-an-instance-of-nginxingress) - [Deploy an app and expose it at the Ingress](#deploy-an-app-and-expose-it-at-the-ingress) - [Deploy RateLimit and a WAF Policy](#deploy-ratelimit-and-a-waf-policy) - [Helpful Sites](#helpful-sites) - [Clean Up](#clean-up) ## Deploy NGINX Ingress Controller Operator _We are deploying via the certified NGINX Ingress Operator, therefore, create the `ns`, `subs`, and `og` for the operator._ ```yaml kubectl create -f -< _If we go with this method of implementation for the WAF, this is an opportunity for us to contribute back upstream. This operator is a [helm-operator](https://github.com/nginxinc/nginx-ingress-helm-operator/blob/v1.3.0/docs/nginx-ingress-controller.md) and we need to expose the `securityContext`. **UPDATE**: THIS IS ALREADY A [WIP](https://github.com/nginxinc/kubernetes-ingress/tree/main/deployments/deployment)_. > Secondly, I don't think this error is very bad. This service account is localized to only one deployment. We can implement network policies in the cluster if we need to ease concern from prodsec Fix this issue for now by adding a `ClusterRole` to the ServiceAccount `nginx-ingress` which allows it to create `SecurityContext`. Read more about [SecurityContext](https://docs.openshift.com/container-platform/4.12/authentication/managing-security-context-constraints.html): ```yaml kubectl create -f -< Welcome to nginx!

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

``` ## Deploy RateLimit and a WAF Policy **IGNORE THIS - You still must have nginx plus** [Skip to Clean Up](#clean-up) When we deployed the Nginx operator, we deployed a CRD called Policy, it has both WAF and RateLimit. Let's check it out: ```bash k explain policies.spec --recursive ``` output ```yaml KIND: Policy VERSION: k8s.nginx.org/v1 RESOURCE: spec DESCRIPTION: PolicySpec is the spec of the Policy resource. The spec includes multiple fields, where each field represents a different policy. Only one policy (field) is allowed. FIELDS: accessControl allow <[]string> deny <[]string> basicAuth realm secret egressMTLS ciphers protocols serverName sessionReuse sslName tlsSecret trustedCertSecret verifyDepth verifyServer ingressClassName ingressMTLS clientCertSecret verifyClient verifyDepth jwt jwksURI keyCache realm secret token oidc authEndpoint clientID clientSecret jwksURI redirectURI scope tokenEndpoint zoneSyncLeeway rateLimit burst delay dryRun key logLevel noDelay rate rejectCode zoneSize waf apPolicy enable securityLog apLogConf enable logDest securityLogs <[]Object> apLogConf enable logDest ``` ```bash kubectl apply -f -<