Unable to install fleet server

Hi @scottdfedorov,

Since this is a production environment, I tried installing fleet by providing my own certificates and this is the error I see:

sudo ./elastic-agent install --url=https://abc:8220 \ -f \ --fleet-server-es=https://xyz:9200 \ --fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2Mjk5MjYzMzAxMDA6UmR0cEtYVHRRX0c0bVBTZUJQdGRNZw \ --fleet-server-policy=bcd74e90-0193-11ec-bbdc-613ccb01fbf0 \ --certificate-authorities=/root/fleet-certs/ca.crt \ --fleet-server-es-ca=/etc/elasticsearch/cert.crt \ --fleet-server-cert=/root/fleet-certs/fleet-server.crt \ --fleet-server-cert-key=/root/fleet-certs/fleet-server.key --enrollment-token=SVF0QWZIc0IyN3VtR0hiLWFqdmg6VGhqMVdFYktRc0d2azh6ckhyTEloQQ==
Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:y
2021-08-25T17:19:38.869-0400    INFO    cmd/enroll_cmd.go:414   Starting enrollment to URL: https://abc:8220/
2021-08-25T17:19:38.971-0400    WARN    cmd/enroll_cmd.go:425   Remote server is not ready to accept connections, will retry in a moment.

I don't get how is it trying to connect to port 8220 when the command above is intended to install fleet server in the first place. Isn't this command supposed to open the port 8220?
Also a quick note, I am trying to install fleet server on one of my elastic data nodes. Would that be a problem in anyway?

The command installs fleet server and an elastic agent in one action. The agent gets the fleet server policy defined in your elastic cluster.

Can I ask if you've read through all the docs on fleet server?

You need to have an elasticsearch cluster up and running, with the fleet server policy in place. Did you define the elasticsearch host(s) and the fleet server host(s) in the Kibana UI for Fleet server?

You should confirm the settings are there. I believe if the fleet server gets a policy from Elastic that doesn't have the fleet server host defined, it will fail to start like this.

Also, can you confirm the cluster is up and running? Are you able to make a curl request to the cluster? Do you have HTTP or HTTPS_PROXY set? Sometimes a proxy gets in the way.

I have the fleet server running on one of my elasticsearch nodes, so no issue there, though I think it's recommended that you keep the elasticsearch nodes to ONLY run elasticsearch for performance. We're still in development for this upgrade so its fine for me, but if you're indeed in production, I'd recommend putting it on another host (for example, the same host you're running Kibana or Logstash on).

@scottdfedorov Thank you for your message. Yes I have cross checked the UI settings and they are set as:

Fleet hosts: https://abc:8220
Elastic hosts: https://abc:9200, https://xyz:9200, https://def:9200

We have configured basic security for the Elastic Stack plus secured HTTPS traffic according to this document: Set up basic security for the Elastic Stack plus secured HTTPS traffic | Elasticsearch Guide [master] | Elastic

Not sure where we are going wrong. The same error still persists

It'd be easier if you could please just post a single topic on your issue, as it makes it hard to help across multiple topics on the same issue - Unable to install fleet server

Sure @warkolm Thank you for pointing it out. I'll remove the duplicate posts

Can you uninstall and remove whatever artifacts may be left over and then try the install again, this time include the full output from the console?

Are you able to reach the cluster via HTTP request?
From the server, whats the output you get from the status api? Ex:
curl --user elastic:changeme -X GET "https://xyz:9200/api/status"
If that doesn't work, try adding the --insecure flag to the curl request.