-
Notifications
You must be signed in to change notification settings - Fork 150
Add v2 to v3 migration guide #1843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nginx-seanmoloney
wants to merge
17
commits into
main
Choose a base branch
from
agent/upgrade-v2-v3-doc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3fcf9ac
Add v2 to v3 migration guide
nginx-seanmoloney 1188708
Improve instructions when running with a mounted file
nginx-seanmoloney ab21ecc
Refactor the update page
nginx-seanmoloney e6137ae
docs(agent): migrate v2→v3 upgrade guide; update installation docs; a…
nginx-seanmoloney c6c4de1
Update content/nginx-one-console/agent/install-upgrade/migration/dock…
nginx-seanmoloney 7fa3b98
Update content/nginx-one-console/agent/install-upgrade/migration/dock…
nginx-seanmoloney 1d62582
Update content/nginx-one-console/agent/install-upgrade/migration/dock…
nginx-seanmoloney d014b58
Update content/nginx-one-console/agent/install-upgrade/migration/dock…
nginx-seanmoloney c4a552a
Update content/nginx-one-console/agent/install-upgrade/migration/dock…
nginx-seanmoloney 840ec70
Update content/nginx-one-console/agent/install-upgrade/migration/kube…
nginx-seanmoloney 241c6c1
Update content/nginx-one-console/agent/install-upgrade/update.md
nginx-seanmoloney 2ce3655
Feedback from pr
nginx-seanmoloney 76790e3
Update content/nginx-one-console/agent/install-upgrade/migration/kube…
nginx-seanmoloney c52cb11
Update content/nginx-one-console/agent/install-upgrade/migration/kube…
nginx-seanmoloney b78b317
Update content/nginx-one-console/agent/install-upgrade/migration/vm.md
nginx-seanmoloney 672a005
Update content/nginx-one-console/agent/install-upgrade/migration/vm.md
nginx-seanmoloney 61a6fea
Update content/nginx-one-console/agent/install-upgrade/migration/vm.md
nginx-seanmoloney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
226 changes: 226 additions & 0 deletions
226
content/nginx-one-console/agent/install-upgrade/upgrade-v2-v3.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,226 @@ | ||
| --- | ||
| title: Migrate NGINX Agent v2 to v3 | ||
| weight: 600 | ||
| toc: true | ||
| nd-docs: DOCS-1227 | ||
| nd-content-type: how-to | ||
| nd-product: NAGENT | ||
| --- | ||
|
|
||
| This guide explains how to migrate deployments from **NGINX Agent v2** to **NGINX agent v3**. Agent v3 introduces architectural and configuration changes. As a result, migrating from v2 to v3 should be approached as a controlled migration. | ||
|
|
||
| {{< call-out class="warning" title="Breaking Changes in NGINX Agent v3 Migration" >}} | ||
|
|
||
| The migration from Agent v2 to Agent v3 introduces critical changes that may disrupt existing workflows: | ||
|
|
||
| - **Environment Variables**: | ||
| - Environment variables renamed (v2 → v3): | ||
| - `NGINX_AGENT_SERVER_HOST` -> `NGINX_AGENT_COMMAND_SERVER_HOST` | ||
| - `NGINX_AGENT_SERVER_GRPCPORT` -> `NGINX_AGENT_COMMAND_SERVER_PORT` | ||
| - `NGINX_AGENT_SERVER_TOKEN` -> `NGINX_AGENT_COMMAND_AUTH_TOKEN` | ||
| - Ensure the new variables are correctly updated in Agent v3 configuration before deployment. | ||
|
|
||
| - **Config Sync Groups** | ||
| - In v3 config sync groups are defined using the following format: | ||
| ```yaml | ||
| - name: NGINX_AGENT_LABELS | ||
| value: "config-sync-group=<Config Sync Group Name>" | ||
| ``` | ||
| {{< /call-out >}} | ||
|
|
||
| ## Migrate NGINX Agent running using Virtual Machines | ||
| {{< include "/agent/installation/update.md" >}} | ||
|
|
||
|
|
||
|
|
||
| ## Migrate NGINX Agent running in Kubernetes | ||
|
|
||
| {{< call-out class="info">}} | ||
| Docker images are available in the [Deploying NGINX and NGINX Plus on Docker](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-docker/) NGINX documentation. | ||
| {{< /call-out >}} | ||
|
|
||
| - Prepare NGINX Agent v3 Deployment YAML, for example: | ||
| ```yaml | ||
| containers: | ||
| - name: nginx-agent | ||
| image: <registry>/nginx-plus/agent/debian:r36 | ||
| env: | ||
| - name: NGINX_AGENT_COMMAND_SERVER_HOST | ||
| value: "agent.connect.nginx.com" | ||
| - name: NGINX_AGENT_COMMAND_SERVER_PORT | ||
| value: "443" | ||
| - name: NGINX_AGENT_COMMAND_TLS_SKIP_VERIFY | ||
| value: "false" | ||
| - name: NGINX_AGENT_COMMAND_AUTH_TOKEN | ||
| value: "<auth-token>" | ||
| - name: NGINX_LICENSE_JWT | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: nginx-secret | ||
| key: NGINX_LICENSE_JWT | ||
| ``` | ||
| - Deploy the Updated Manifest, Apply the Deployment using kubectl: | ||
| ```shell | ||
| kubectl apply -n <namespace> -f nginx-agent-v3-deployment.yaml | ||
| ``` | ||
| - Monitor the Rollout Progress | ||
| ```shell | ||
| kubectl rollout status deployment/<deployment-name> -n <namespace> | ||
| ``` | ||
|
|
||
| - Validate the Replacement | ||
| Once the rollout is complete, ensure all v2 pods have been replaced with v3 pods: | ||
|
|
||
| - Confirm all pods transistion to running: | ||
| ```shell | ||
| kubectl get pods -n <namespace> | ||
| ``` | ||
|
|
||
| ### Post-Migration Validations | ||
|
|
||
| 1. Check for agent connected message, example: **msg="Agent connected"** | ||
| ```shell | ||
| kubectl logs <pod-name> -n <namespace> | ||
| ``` | ||
| 2. Search for the Instance on NGINX One Console | ||
|
|
||
| 1. **Open the Instances View**: | ||
| - Navigate to the **Instances View** in the NGINX One Console. | ||
|
|
||
| 2. **Search for the NGINX Instance**: | ||
| - Enter the **Pod Name** in the search field located in the top-right corner of the Instances View. | ||
|
|
||
| 3. **Check Instance Availability Status**: | ||
| - Ensure the **Availability** status of the instance shows **Online**. | ||
|
|
||
| 4. **Check Config Sync Group (If Applicable)**: | ||
| - If your instance is part of a **Config Sync Group**: | ||
| - Open the **Config Sync Groups** section. | ||
| - Locate your specific **Config Sync Group**. | ||
| - Verify that instances listed in the group are also shown as **Online** in the **Instances Section**. | ||
|
|
||
|
|
||
| ### Troubleshooting | ||
|
|
||
| If issues arise during migration, follow these steps: | ||
|
|
||
| 1. Check for any errors in the logs: | ||
| ```shell | ||
| kubectl logs <pod-name> -n <namespace> | ||
| ``` | ||
| 2. Environment Variables: | ||
| Inspect the pod to confirm all environment variables are correctly set: | ||
| ```shell | ||
| kubectl describe pod <pod-name> -n <namespace> | ||
| ``` | ||
| 3. Rollback to NGINX Agent v2 | ||
| ```shell | ||
| kubectl apply -f nginx-agent-v2-deployment.yaml | ||
| ``` | ||
|
|
||
| ## Migrate NGINX Agent running using docker compose | ||
|
|
||
| #### v2 Docker Compose Configuration | ||
|
|
||
| ```yaml | ||
| version: "3.8" | ||
| services: | ||
| nginx-agent: | ||
| image: <registry>/nginx-agent:v2 | ||
| environment: | ||
| NGINX_AGENT_SERVER_HOST: agent.connect.nginx.com | ||
| NGINX_AGENT_SERVER_GRPCPORT: "443" | ||
| NGINX_AGENT_SERVER_TOKEN: ${NGINX_AGENT_SERVER_TOKEN} | ||
| NGINX_LICENSE_JWT: ${NGINX_LICENSE_JWT} | ||
|
|
||
| ``` | ||
|
|
||
| #### v3 Docker Compose Configuration | ||
|
|
||
| ```yaml | ||
| version: "3.8" | ||
| services: | ||
| nginx-agent: | ||
| image: <registry>/nginx-plus/agent/debian:<v3-tag> | ||
| environment: | ||
| NGINX_AGENT_COMMAND_SERVER_HOST: agent.connect.nginx.com | ||
| NGINX_AGENT_COMMAND_SERVER_PORT: "443" | ||
| NGINX_AGENT_COMMAND_TLS_SKIP_VERIFY: "false" | ||
| NGINX_AGENT_COMMAND_AUTH_TOKEN: ${NGINX_AGENT_COMMAND_AUTH_TOKEN} | ||
| NGINX_LICENSE_JWT: ${NGINX_LICENSE_JWT} | ||
| NGINX_AGENT_LABELS: config-sync-group=<config-sync-group-name> | ||
| ``` | ||
|
|
||
| ### Migration Steps for Docker Compose | ||
| 1. Backup Your Existing Configuration | ||
| - Save a copy of your current docker-compose.yaml file to ensure you can roll back if necessary. | ||
|
|
||
| 2. Modify the Configuration | ||
| - Update your service configuration as shown in the v3 Docker Compose Configuration. | ||
|
|
||
| 3. Restart the Agent Service | ||
| - Bring down the existing agent running with v2: | ||
| ```bash | ||
| docker-compose down | ||
| ``` | ||
| - Start the agent with the updated v3 configuration: | ||
| ```bash | ||
| docker-compose up -d | ||
| ``` | ||
| 4. Validate the Migration | ||
| - Confirm the agent is running with the v3 changes: | ||
| ```bash | ||
| docker logs <nginx-agent-container-name> | ||
| ``` | ||
| - Check the logs for successful connection messages: | ||
| ```msg="Agent connected"``` | ||
|
|
||
| 5. Check in NGINX One Console | ||
| - Ensure the updated instance is listed and active in the Instances View. | ||
| - If the agent belongs to a Config Sync Group, verify that it is displayed as Online under the Config Sync Groups section. | ||
|
|
||
| ## Rollback Procedure | ||
|
|
||
| If any issues occur, you can roll back to v2 by replacing the configuration with the v2 docker-compose.yaml and restarting the service: | ||
| ```bash | ||
| $ docker-compose down | ||
| $ docker-compose up -d | ||
| ``` | ||
| ## Migrate NGINX Agent running in containers | ||
| 1. Pull a docker image | ||
| ```shell | ||
| sudo docker pull private-registry.nginx.com/nginx-plus/agentv3:debian | ||
| ``` | ||
| 2. Run the container | ||
| ```shell | ||
| sudo docker run \ | ||
| --env=NGINX_LICENSE_JWT="YOUR_JWT_HERE" \ | ||
| --env=NGINX_AGENT_COMMAND_SERVER_PORT=443 \ | ||
| --env=NGINX_AGENT_COMMAND_SERVER_HOST=agent.connect.nginx.com \ | ||
| --env=NGINX_AGENT_COMMAND_AUTH_TOKEN="<DATA PLANE KEY>" \ | ||
| --env=NGINX_AGENT_COMMAND_TLS_SKIP_VERIFY=false \ | ||
| --restart=always \ | ||
| --runtime=runc \ | ||
| -d private-registry.nginx.com/nginx-plus/agentv3:debian | ||
| ``` | ||
|
|
||
|
|
||
| Note: If you container is setup to run with a mounted configuration file use the following steps to convert to a v3 configuration file. | ||
| 1. Download the conversion script (v3 branch): | ||
| ```shell | ||
| wget https://raw.githubusercontent.com/nginx/agent/v3/scripts/packages/upgrade-agent-config.sh | ||
| chmod +x upgrade-agent-config.sh | ||
| ``` | ||
|
|
||
| 2. Run the script to conver the configuration file. | ||
| ```shell | ||
| ./upgrade-agent-config.sh --v2-config-file=./nginx-agent-v2.conf --v3-config-file=./nginx-agent-v3.conf | ||
| ``` | ||
| If your v2 agent belonged to a Config Sync Group, manually add the Config Sync Group label to the v3 config. See “Add Config Sync Group” in your docs. | ||
|
|
||
|
|
||
| ### Rollback Procedure | ||
|
|
||
| If you need to roll back your environment to NGINX Agent v2, the upgrade process creates a backup of the NGINX Agent v2 config in the file `/etc/nginx-agent/nginx-agent-v2-backup.conf`. | ||
|
|
||
| Replace the contents of `/etc/nginx-agent/nginx-agent.conf` with the contents of `/etc/nginx-agent/nginx-agent-v2-backup.conf` and then reinstall an older version of NGINX Agent. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| github.com/nginxinc/nginx-hugo-theme/v2 v2.0.5/go.mod h1:TAmEMc0T/RKTQ0pI4LROWoUmyLXstrRmM2jE2ErdxWY= | ||
| github.com/nginxinc/nginx-hugo-theme/v2 v2.0.7 h1:p00vkLFPgg7tEHt2ZJIg6jjxo8evJf9fYzWzkI3brrM= | ||
| github.com/nginxinc/nginx-hugo-theme/v2 v2.0.7/go.mod h1:TAmEMc0T/RKTQ0pI4LROWoUmyLXstrRmM2jE2ErdxWY= | ||
| github.com/nginxinc/nginx-hugo-theme/v2 v2.0.7/go.mod h1:TAmEMc0T/RKTQ0pI4LROWoUmyLXstrRmM2jE2ErdxWY= |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the new template for how-to guides
https://github.com/nginx/documentation/blob/main/templates/how-to/guide-how-to.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @JTorreG , yes I have followed the best practices on the linked template.