"Error: fleet-server failed: context canceled" error when trying to "Install Fleet Server to a centralized host"

I am trying to "Add a Fleet Server" but am getting an error when I try to install the Elastic Agent.

After running the following command as instructed:

curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-8.6.2-darwin-x86_64.tar.gz
tar xzvf elastic-agent-8.6.2-darwin-x86_64.tar.gz
cd elastic-agent-8.6.2-darwin-x86_64
sudo ./elastic-agent install \
  --fleet-server-es=http://localhost:9200 \
  --fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2NzcwMjczMDA3NTE6a2FaSWlfX2tSck83Yllwblc2QnNMUQ \
  --fleet-server-policy=fleet-server-policy

It seems to be working fine and I get the following prompt from the console:

Elastic Agent will be installed at /Library/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:Y

After replying with a Y, the following is logged to the console:

{"log.level":"info","@timestamp":"2023-02-21T20:46:33.214-0400","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":407},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-02-21T20:46:35.874-0400","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":803},"message":"Fleet Server - Starting: spawned pid '65719'","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-02-21T20:46:39.876-0400","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":803},"message":"Fleet Server - Error - EOF","ecs.version":"1.6.0"}
Error: fleet-server failed: context canceled
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.6/fleet-troubleshooting.html
Error: enroll command failed with exit code: 1
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.6/fleet-troubleshooting.html

I'm not sure why I'm getting the errors mentioned in the last four lines.

Hi @Matt_Johnston

the EOF could means that Fleet server is not able to communicate with Elasticsearch if your elasticsearch is not http://localhost:9200 I suggest you edit the default output to the Elasticsearch URL.

Thank you for the response.

I'm quite new to all of this. I'm not sure how to edit the default output to the Elasticsearch URL. Could you please provide more details on how to do this? Thanks!

This can be done from the Fleet plugin in the Settings tab here

1 Like

Okay, so I'm not actually sure what I should be using as the elasticsearch URL. I think it might be https://localhost:9200 instead of http://localhost:9200. When I try to install the Elastic Agent with https, I get the following output and error:

{"log.level":"info","@timestamp":"2023-02-22T17:24:53.774-0400","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":407},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-02-22T17:24:56.819-0400","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":803},"message":"Fleet Server - Starting: spawned pid '9975'","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-02-22T17:25:00.820-0400","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":803},"message":"Fleet Server - Error - x509: β€œes01” certificate is not standards compliant","ecs.version":"1.6.0"}
Error: fleet-server failed: context canceled
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.6/fleet-troubleshooting.html
Error: enroll command failed with exit code: 1
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.6/fleet-troubleshooting.html

It's saying that "es01" certificate is not standards compliant. I'm not sure what this means or what I have to do to fix it.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.