|
| 1 | +--- |
| 2 | +title: Connect NGINX Ingress Controller to NGINX One Console |
| 3 | +toc: true |
| 4 | +weight: 200 |
| 5 | +nd-content-type: how-to |
| 6 | +nd-product: NGINX One |
| 7 | +--- |
| 8 | + |
| 9 | +This document explains how to connect F5 NGINX Ingress Controller and F5 NGINX Gateway Fabric to F5 NGINX One Console using NGINX Agent. |
| 10 | +Connecting NGINX Ingress Controller to NGINX One Console enables centralized monitoring of all controller instances. |
| 11 | + |
| 12 | +Once connected, you'll see a **read-only** configuration of NGINX Ingress Controller and NGINX Gateway Fabric. For each instance, you can review: |
| 13 | + |
| 14 | +- Read-only configuration file |
| 15 | +- F5 NGINX App Protect WAF policies |
| 16 | +- SSL/TLS certificates |
| 17 | +- CVEs |
| 18 | + |
| 19 | +## Prerequisites |
| 20 | + |
| 21 | +Before connecting NGINX Ingress Controller to NGINX One Console, you need to create a Kubernetes Secret with the data plane key. Use the following command: |
| 22 | + |
| 23 | +```shell |
| 24 | +kubectl create secret generic dataplane-key --from-literal=dataplane.key=<Your Dataplane Key> -n <namespace> |
| 25 | +``` |
| 26 | + |
| 27 | +When you create a Kubernetes Secret, use the same namespace where NGINX Ingress Controller is running. |
| 28 | +If you use `-watch-namespace` or `watch-secret-namespace` arguments with NGINX Ingress Controller, |
| 29 | +you need to add the dataplane key secret to the watched namespaces. This secret will take approximately 60 - 90 seconds to reload on the pod. |
| 30 | + |
| 31 | +{{<note>}} |
| 32 | +You can also create a data plane key through the NGINX One Console. Once loggged in, select **Manage > Control Planes > Add Control Plane**, and follow the steps shown. |
| 33 | +{{</note>}} |
| 34 | + |
| 35 | +## Deploy NGINX Ingress Controller with NGINX Agent |
| 36 | + |
| 37 | +{{<tabs name="deploy-config-resource">}} |
| 38 | +{{%tab name="Helm"%}} |
| 39 | + |
| 40 | +Edit your `values.yaml` file to enable NGINX Agent and configure it to connect to NGINX One Console: |
| 41 | + |
| 42 | +```yaml |
| 43 | +nginxAgent: |
| 44 | + enable: true |
| 45 | + dataplaneKeySecretName: "<Your Dataplane Key Secret Name>" |
| 46 | +``` |
| 47 | +
|
| 48 | +The `dataplaneKey` is used to authenticate the agent with NGINX One Console. See the [NGINX One Console Docs]({{< ref "/nginx-one/connect-instances/create-manage-data-plane-keys.md" >}}) |
| 49 | +for instructions on to generate your dataplane key from the NGINX One Console. |
| 50 | + |
| 51 | +Follow the [Installation with Helm]({{< ref "/nic/installation/installing-nic/installation-with-helm.md" >}}) instructions to deploy NGINX Ingress Controller. |
| 52 | + |
| 53 | +{{%/tab%}} |
| 54 | +{{%tab name="Manifests"%}} |
| 55 | + |
| 56 | +Add the following flag to the Deployment/DaemonSet file of NGINX Ingress Controller: |
| 57 | + |
| 58 | +```yaml |
| 59 | +args: |
| 60 | +- -agent=true |
| 61 | +``` |
| 62 | + |
| 63 | +Create a `ConfigMap` with an `nginx-agent.conf` file: |
| 64 | + |
| 65 | +```yaml |
| 66 | +kind: ConfigMap |
| 67 | +apiVersion: v1 |
| 68 | +metadata: |
| 69 | + name: nginx-agent-config |
| 70 | + namespace: <namespace> |
| 71 | +data: |
| 72 | + nginx-agent.conf: |- |
| 73 | + log: |
| 74 | + # set log level (error, info, debug; default "info") |
| 75 | + level: info |
| 76 | + # set log path. if empty, don't log to file. |
| 77 | + path: "" |
| 78 | + |
| 79 | + allowed_directories: |
| 80 | + - /etc/nginx |
| 81 | + - /usr/lib/nginx/modules |
| 82 | + |
| 83 | + features: |
| 84 | + - certificates |
| 85 | + - connection |
| 86 | + - metrics |
| 87 | + - file-watcher |
| 88 | + |
| 89 | + ## command server settings |
| 90 | + command: |
| 91 | + server: |
| 92 | + host: product.connect.nginx.com |
| 93 | + port: 443 |
| 94 | + auth: |
| 95 | + tokenpath: "/etc/nginx-agent/secrets/dataplane.key" |
| 96 | + tls: |
| 97 | + skip_verify: false |
| 98 | +``` |
| 99 | + |
| 100 | +Make sure to set the namespace in the nginx-agent.config to the same namespace as NGINX Ingress Controller. |
| 101 | +Mount the ConfigMap to the deployment/daemonset file of NGINX Ingress Controller: |
| 102 | + |
| 103 | +```yaml |
| 104 | +volumeMounts: |
| 105 | +- name: nginx-agent-config |
| 106 | + mountPath: /etc/nginx-agent/nginx-agent.conf |
| 107 | + subPath: nginx-agent.conf |
| 108 | +- name: dataplane-key |
| 109 | + mountPath: /etc/nginx-agent/secrets |
| 110 | +volumes: |
| 111 | +- name: nginx-agent-config |
| 112 | + configMap: |
| 113 | + name: nginx-agent-config |
| 114 | +- name: dataplane-key |
| 115 | + secret: |
| 116 | + secretName: <Your Dataplane Key Secret Name> |
| 117 | +``` |
| 118 | + |
| 119 | +Follow the [Installation with Manifests]({{< ref "/nic/installation/installing-nic/installation-with-manifests.md" >}}) instructions to deploy NGINX Ingress Controller. |
| 120 | + |
| 121 | +{{%/tab%}} |
| 122 | +{{</tabs>}} |
| 123 | + |
| 124 | +## Verify a connection to NGINX One Console |
| 125 | + |
| 126 | +After deploying NGINX Ingress Controller or NGINX Gateway Fabricwith NGINX Agent, you can verify the connection to NGINX One Console. |
| 127 | +Log in to your NGINX One Console account and navigate to the Instances dashboard. Your instances should appear in the list, where the instance name will be the pod name. |
| 128 | + |
| 129 | +## Troubleshooting |
| 130 | + |
| 131 | +If you encounter issues connecting your instances to NGINX One Console, try the following commands: |
| 132 | + |
| 133 | +Check the NGINX Agent version: |
| 134 | + |
| 135 | +```shell |
| 136 | +kubectl exec -it -n <namespace> <nginx-ingress-pod-name> -- nginx-agent -v |
| 137 | +``` |
| 138 | + |
| 139 | +If nginx-agent version is v3, continue with the following steps. |
| 140 | +Otherwise, make sure you are using an image that does not include NGINX App Protect. |
| 141 | + |
| 142 | +Check the NGINX Agent configuration: |
| 143 | + |
| 144 | +```shell |
| 145 | +kubectl exec -it -n <namespace> <nginx-ingress-pod-name> -- cat /etc/nginx-agent/nginx-agent.conf |
| 146 | +``` |
| 147 | + |
| 148 | +Check NGINX Agent logs: |
| 149 | + |
| 150 | +```shell |
| 151 | +kubectl exec -it -n <namespace> <nginx-ingress-pod-name> -- nginx-agent |
| 152 | +``` |
| 153 | + |
| 154 | +For each connected NGINX Ingress Controller and Gateway Fabric instance, you can review: |
| 155 | + |
| 156 | +- Read-only configuration file |
| 157 | +- F5 NGINX App Protect WAF policies |
| 158 | +- SSL/TLS certificates |
| 159 | +- CVEs |
0 commit comments