elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.48k stars 8.04k forks source link

[Fleet] Add option to upgrade all agents on the same policy from the UI #171023

Closed criamico closed 1 week ago

criamico commented 8 months ago

We could easily add an option to quickly upgrade all the agents belonging to the same policy from the actions:

Screenshot 2023-11-10 at 14 37 41

We already have a similar action to uninstall the agents on the policy, so it would make sense to add one to quickly upgrade them. Ideally this would open the bulk upgrade modal, however the query passed to select the agents should be different.

Currently there is a way to obtain this by the API with the following query:

POST kbn:/api/fleet/agents/bulk_upgrade
{
  "agents": "fleet-agents.policy_id: POLICY_ID",
  "version": "8.11.0",
}

But we could also fine tune this query to better select the agents. For instance, to avoid upgrading the agents that are already on this version would be

POST kbn:/api/fleet/agents/bulk_upgrade
{
  "agents": "fleet-agents.policy_id: POLICY_ID and fleet-agents.agent.version < 8.11.0",
  "version": "8.11.0",
}

This would be a similar feature to this one, with the difference that the action needs be triggered manually rather than being automatic.

elasticmachine commented 8 months ago

Pinging @elastic/fleet (Team:Fleet)

mbudge commented 2 months ago

We're planning to deploy elastic-agent on to virtual desktop infrastructure (VDI) servers in the next 1-2 months. VDI runs a pool of workstations which staff access when they log in via citrix from home. The pool increases as more staff log in via citrix. Every 24 hours workstations which aren't in use are terminated. When the workstations are re-created they have the same hostname, however as they are re-built we expect elastic-agent to re-enroll into Fleet as a new host. This is fine as the old agent will go offline and disappear from view eventually.

The problem we expect is Fleet handing upgrades. We could trigger an upgrade of active/healthy online hosts we select in the VDI Fleet policy. However then the workstations are re-built the previous version of elastic-agent will be re-enrolled back into Fleet. The only work around would be us upgrading the MSI package to a newer release. We want to avoid this as IT will have to put the agent through an extensive testing and release process.

We'd like to see Fleet manage the upgrades so when new elastic-agents enroll into the Fleet policy they are automatically upgraded (maybe with a delay) to the same version we're running on the rest of the network.

criamico commented 2 months ago

@nimarezainia is there any plan to implement automatical upgrades for agents attached to a policy?

nimarezainia commented 2 months ago

@mbudge please refer to https://github.com/elastic/kibana/issues/120735, describes the same use case. It is on the roadmap but a bit lower on the priority list. Hope to get to it soon.