Skip to content
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

9.0: Direct users to install with --install-servers when --fleet-server-* options are used without it #6656

Open
cmacknz opened this issue Jan 30, 2025 · 3 comments · May be fixed by #6727
Open
Assignees
Labels
bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Comments

@cmacknz
Copy link
Member

cmacknz commented Jan 30, 2025

On the latest 9.0.0-SNAPSHOT, if you attempt to install an agent as a Fleet Server but do not specify the servers flavor, you get a very vague and unhelpful message. We should detect use of the --fleet-server-* options at install time and immediately error if --install-servers was not also provided on the command line.

Here is example error output:

sudo ./elastic-agent install \
  --fleet-server-es=http://localhost:9200 \
  --fleet-server-service-token=XXXXXXXX \
  --fleet-server-policy=fleet-server-policy \
  --fleet-server-port=8220 --develop
Installing into development namespace; this is an experimental and currently unsupported feature.
Elastic Agent will be installed at /Library/Elastic/Agent-Development and will run as a service. Do you want to continue? [Y/n]:y
[    ] Service Started  [3s] Elastic Agent successfully installed, starting enrollment.
[    ] Waiting For Enroll...  [8s] {"log.level":"info","@timestamp":"2025-01-30T13:13:38.943-0500","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/cmd.(*enrollCmd).prepareFleetTLS","file.name":"cmd/enroll_cmd.go","file.line":437},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
[=   ] Waiting For Enroll...  [8s] {"log.level":"info","@timestamp":"2025-01-30T13:13:39.598-0500","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/cmd.(*enrollCmd).daemonReloadWithBackoff","file.name":"cmd/enroll_cmd.go","file.line":483},"message":"Restarting agent daemon, attempt 0","ecs.version":"1.6.0"}
[ ===] Waiting For Enroll...  [10s] {"log.level":"info","@timestamp":"2025-01-30T13:13:41.613-0500","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/cmd.waitForFleetServer.func1","file.name":"cmd/enroll_cmd.go","file.line":794},"message":"Waiting for Elastic Agent to start Fleet Server","ecs.version":"1.6.0"}
[=   ] Waiting For Enroll...  [2m8s] Error: fleet-server failed: timed out waiting for Fleet Server to start after 2m0s
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/9.0/fleet-troubleshooting.html
[====] Uninstalled  [2m9s] Error uninstalling. Printing logs
2025-01-30T18:15:39.902Z        DEBUG   [install]       Loaded configuration from /Users/cmackenzie/Downloads/builds/elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64/elastic-agent.yml
2025-01-30T18:15:39.902Z        DEBUG   [install]       Merged configuration from /Users/cmackenzie/Downloads/builds/elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64/elastic-agent.yml into result
2025-01-30T18:15:39.902Z        DEBUG   [install]       Merged all configuration files from [/Users/cmackenzie/Downloads/builds/elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64/elastic-agent.yml], no external input files
2025-01-30T18:15:40.060Z        DEBUG   [install]       Loaded configuration from /Users/cmackenzie/Downloads/builds/elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64/elastic-agent.yml
2025-01-30T18:15:40.060Z        DEBUG   [install]       Merged configuration from /Users/cmackenzie/Downloads/builds/elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64/elastic-agent.yml into result
2025-01-30T18:15:40.060Z        DEBUG   [install]       Merged all configuration files from [/Users/cmackenzie/Downloads/builds/elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64/elastic-agent.yml], no external input files
2025-01-30T18:15:40.060Z        DEBUG   [install.composable]    Starting controller for composable inputs
2025-01-30T18:15:40.060Z        DEBUG   [install.composable]    Started controller for composable inputs
2025-01-30T18:15:40.060Z        DEBUG   [install.composable]    Computing new variable state for composable inputs
2025-01-30T18:15:40.060Z        DEBUG   [install.composable]    Stopping controller for composable inputs
2025-01-30T18:15:40.060Z        DEBUG   [install.composable]    Stopped controller for composable inputs
Error: enroll command failed for unknown reason: exit status 1
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/9.0/fleet-troubleshooting.html
@cmacknz cmacknz added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team labels Jan 30, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@cmacknz
Copy link
Member Author

cmacknz commented Jan 30, 2025

The Fleet Server bootstrap test is failing because of this

func TestInstallFleetServerBootstrap(t *testing.T) {

We should investigate why this wasn't caught in the PR that added the option.

@michalpristas
Copy link
Contributor

this is weird, fleets server bootstrap should not fail. it is installed with correct flag. see InstallServers: true,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
3 participants