Fleet Server & ES Agent

Hello,

when I try to install the fleet server on the machine I receive this error:

sudo ./elastic-agent install \--fleet-server-es=http://10.211.55.7:9200 \--fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2Njc3MzM0ODk1OTI6czBsQm1xcVRSZHlsOXd3QnJ6T1dqZw \--fleet-server-policy=fleet-server-policy \--fleet-server-es-ca=/etc/kibana/ca/ca.crt
Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:Y
{"log.level":"info","@timestamp":"2022-11-06T13:10:50.748+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":403},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-11-06T13:10:53.344+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":759},"message":"Waiting for Elastic Agent to start Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-11-06T13:11:53.366+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":792},"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.5/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.5/fleet-troubleshooting.html

I have an Elasticsearch server and the Kibana server on the same VM Ubuntu machine.
Previously i produced a Certificate Authorities with the /usr/share/elasticsearch/bin/elasticsearch-certutil ca command and I passed this value in the fleet-server-es-ca option above to install elastic agent.

I tried also the above command with some variations:

$ sudo ./elastic-agent install \--fleet-server-es=http://10.211.55.7:9200 \--fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2Njc3MzM0ODk1OTI6czBsQm1xcVRSZHlsOXd3QnJ6T1dqZw \--fleet-server-policy=fleet-server-policy \--fleet-server-es-ca=/etc/kibana/ca/ca.crt \--fleet-server-es-insecure
Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:Y
{"log.level":"info","@timestamp":"2022-11-06T14:24:37.927+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":403},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-11-06T14:24:40.394+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":792},"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.5/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.5/fleet-troubleshooting.html

$ sudo ./elastic-agent install \--fleet-server-es=http://10.211.55.7:9200 \--fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2Njc3MzM0ODk1OTI6czBsQm1xcVRSZHlsOXd3QnJ6T1dqZw \--fleet-server-policy=fleet-server-policy \--fleet-server-es-insecure
Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:Y
{"log.level":"info","@timestamp":"2022-11-06T14:26:58.882+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":403},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-11-06T14:27:01.435+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":792},"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.5/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.5/fleet-troubleshooting.html

sudo ./elastic-agent install \--fleet-server-es=http://10.211.55.7:9200 \--fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2Njc3MzM0ODk1OTI6czBsQm1xcVRSZHlsOXd3QnJ6T1dqZw \--fleet-server-policy=fleet-server-policy \--insecure
Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:Y
{"log.level":"info","@timestamp":"2022-11-06T14:38:38.525+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":403},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-11-06T14:38:41.287+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":759},"message":"Waiting for Elastic Agent to start Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-11-06T14:39:41.311+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":792},"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.5/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.5/fleet-troubleshooting.html

Thank u for ur help!

Hi @EExisT,

Could you enable debug log levels, retry and provide them?

Hi @Cristina_Amico,

I think I have to set the agent.logging.level to debug, is it right?
Then what I have to do?

Usually I've seen this error happening because one of the parameters passed in the enrolment command is not correct.
I would check that:

  • fleet-server-policy exists
  • ES host is reachable. Have you checked that http://10.211.55.7:9200 is reachable?
  • The enrolment token is active. You can check this by going to the enrolment tokens tab in fleet or going to dev tools on the left column of kibana and running GET api/fleet/enrollment_api_keys.
    Just to be extra sure, how many enrolment tokens (active and inactive) do you have?

Hi Cristina, in the meantime I tried to install fleet by deb package and it goes well.
But naturally this is only a workaround...