Skip to content

Commit f190d54

Browse files
[Fleet] Add docs for re-enrolling multiple agents after migration (#3216)
Co-authored-by: Colleen McGinnis <[email protected]>
1 parent 8dd8487 commit f190d54

File tree

1 file changed

+36
-18
lines changed

1 file changed

+36
-18
lines changed

reference/fleet/migrate-elastic-agent.md

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ After the restart, {{integrations-server}} will enroll a new {{agent}} for the {
179179
::::
180180

181181

182-
183182
### Confirm your policy settings [migrate-elastic-agent-confirm-policy]
184183

185184
Now that the {{fleet}} settings are correctly set up, it pays to ensure that the {{agent}} policy is also correctly pointing to the correct entities.
@@ -200,7 +199,6 @@ If you modified the {{fleet-server}} and the output in place these would have be
200199
::::
201200
202201
203-
204202
## Agent policies in the new target cluster [migrate-elastic-agent-migrated-policies]
205203
206204
By creating the new target cluster from a snapshot, all of your policies should have been created along with all of the agents. These agents will be offline due to the fact that the actual agents are not checking in with the new, target cluster (yet) and are still communicating with the source cluster.
@@ -210,7 +208,11 @@ The agents can now be re-enrolled into these policies and migrated over to the n
210208
211209
## Migrate {{agent}}s to the new target cluster [migrate-elastic-agent-migrated-agents]
212210
213-
In order to ensure that all required API keys are correctly created, the agents in your current cluster need to be re-enrolled into the new, target cluster.
211+
::::{note}
212+
Agents to be migrated cannot be tamper-protected or running as a {{fleet-server}}.
213+
::::
214+
215+
In order to ensure that all required API keys are correctly created, the agents in your current cluster need to be re-enrolled into the new target cluster.
214216
215217
This is best performed one policy at a time. For a given policy, you need to capture the enrollment token and the URL for the agent to connect to. You can find these by running the in-product steps to add a new agent.
216218
@@ -224,27 +226,43 @@ This is best performed one policy at a time. For a given policy, you need to cap
224226
:screenshot:
225227
:::
226228
227-
5. On the host machines where the current agents are installed, enroll the agents again using this copied URL and the enrollment token:
229+
5. Choose an approach:
228230
229-
```shell
230-
sudo elastic-agent enroll --url=<fleet server url> --enrollment-token=<token for the new policy>
231-
```
231+
::::{tab-set}
232+
:::{tab-item} Fleet UI
232233
233-
The command output should be like the following:
234+
{applies_to}`stack: ga 9.2` Migrate remote agents directly from the {{fleet}} UI:
234235
235-
:::{image} images/migrate-agent-install-command-output.png
236-
:alt: Install command output
237-
:screenshot:
236+
1. In the source cluster, select the agents you want to migrate. Click the three dots next to the agents, and select **Migrate agents**.
237+
2. In the migration dialog, provide the URI and enrollment token you obtained from the target cluster.
238+
3. Use `replace_token` (Optional): When you are migrating a single agent, you can use the `replace_token` field to preserve the agent's original ID from the source cluster. This step helps with event matching, but will cause the migration to fail if the target cluster already has an agent with the same ID.
238239
:::
239240

240-
6. The agent on each host will now check into the new {{fleet-server}} and appear in the new target cluster. In the source cluster, the agents will go offline as they won’t be sending any check-ins.
241+
:::{tab-item} Command line
241242

242-
:::{image} images/migrate-agent-newly-enrolled-agents.png
243-
:alt: Newly enrolled agents in the target cluster
244-
:screenshot:
245-
:::
243+
Run the `enroll` command on each individual host:
244+
245+
1. On the host machines where the current agents are installed, enroll the agents again using the URL and enrollment token you obtained from the target cluster:
246+
247+
```shell
248+
sudo elastic-agent enroll --url=<fleet server url> --enrollment-token=<token for the new policy>
249+
```
250+
251+
The command output should resemble this:
252+
253+
:::{image} images/migrate-agent-install-command-output.png
254+
:alt: Install command output
255+
:screenshot:
256+
:::
257+
258+
2. The agent on each host will now check into the new {{fleet-server}} and appear in the new target cluster. In the source cluster, the agents will go offline as they won’t be sending any check-ins.
246259

247-
7. Repeat this procedure for each {{agent}} policy.
260+
:::{image} images/migrate-agent-newly-enrolled-agents.png
261+
:alt: Newly enrolled agents in the target cluster
262+
:screenshot:
263+
:::
248264

249-
If all has gone well, you’ve successfully migrated your {{fleet}}-managed {{agent}}s to a new cluster.
265+
3. Repeat this procedure for each {{agent}} policy.
266+
:::
267+
::::
250268

0 commit comments

Comments
 (0)