Cherry-pick #23865 to 7.x: [Elastic Agent] Enroll with Fleet Server#24064
Merged
blakerouse merged 1 commit intoelastic:7.xfrom Feb 16, 2021
Merged
Cherry-pick #23865 to 7.x: [Elastic Agent] Enroll with Fleet Server#24064blakerouse merged 1 commit intoelastic:7.xfrom
blakerouse merged 1 commit intoelastic:7.xfrom
Conversation
* Add test and changelog. * Add ability to enroll through a local Fleet Server started by the running Elastic Agent daemon. * Fix tests. * Fix changelog. * Fixes from code review. * Cleanup from merge into master. (cherry picked from commit ae0f29e)
Contributor
|
Pinging @elastic/ingest-management (Team:Ingest Management) |
Contributor
|
Pinging @elastic/agent (Team:Agent) |
Contributor
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
michalpristas
approved these changes
Feb 16, 2021
Contributor
michalpristas
left a comment
There was a problem hiding this comment.
Backport looks good
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Cherry-pick of PR #23865 to 7.x branch. Original message:
What does this PR do?
This adds the ability to enroll the Elastic Agent with Fleet Server executed locally on the same machine. To get this work a few things needed to be added to Elastic Agent.
status.Controllerto the socket control protocol.Note: This has a breaking change in the parameters to
enroll.kibana_urlandenrollment_tokenmove to being parameters instead of positional arguments. This makesinstallandenrolltake the same parameters, and closes #21897.Why is it important?
So that Fleet Server can be bootstrapped on a machine with Fleet Server also running on that same machine.
How does it work?
The
enrollcommand handles the coordination of controlling the running Elastic Agent daemon. Theinstallcommand proxies to theenrollcommand so this can be ran from theinstallor from the DEB/RPM.Breakdown of the steps that are completed to handle the bootstrap:
--fleet-serverparameter. This parameter is a connection string for Fleet Server to communicate to elasticsearch. (Example:--fleet-server http://elastic:changeme@localhost:9200)fleet.ymlwithfleet.serverconfiguration, withfleet.server.bootstrap: true.statusGRPC of the Elastic Agent until Fleet Server is started and is in degraded state (should be degraded, because the Elastic Agent is not enrolled yet).fleet.ymlwith enrollment information and thefleet.serverinformation. Thefleet.server.bootstrapis removed (aka. False).fleet.serveris set in thefleet.yml).Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Author's Checklist
--fleet-serverworks.How to test this PR locally
Run the latest
8.0.0-SNAPSHOTof elasticsearch and Kibana. Start Kibana with thexpack.fleet.agents.fleetServerEnabled: true.Add the
Fleet Serverintegration to a policy.Look up the policy ID (as this is currently needed until a default policy for Fleet Server is added to Kibana).
Start Elastic Agent.
Run the following command to bootstrap and enroll the Elastic Agent.
./elastic-agent enroll --insecure --url http://localhost:8000 --enrollment-token {token} --fleet-server http://elastic:changeme@localhost:9200 --fleet-server-policy {policy_id}Related issues