# Enrolling fleet using FQDN certificates

**URL:** <https://discuss.elastic.co/t/enrolling-fleet-using-fqdn-certificates/316328>\
**Category:** Elastic Agent\
**Tags:** fleet\
**Created:** [October 11, 2022, 12:33pm UTC](https://discuss.elastic.co/t/enrolling-fleet-using-fqdn-certificates/316328 "2022-10-11T12:33:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![krzychohoho](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@krzychohoho](https://discuss.elastic.co/u/krzychohoho)\
**Post date:** [October 11, 2022, 12:33pm UTC](https://discuss.elastic.co/t/enrolling-fleet-using-fqdn-certificates/316328/1 "2022-10-11T12:33:31Z")

</div>

Hi, I came across some issues during installation of fleet server.  
First of all i need the server to run on FQDn rather than on IP adress. So I started with generating certificates using dns instead of IP. The command I used is:

```auto

sudo /usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca-cert "ca.cert path" --ca-key "ca key path" --pem --dns "node1.elastic.local" --out "instance folder".

```

After this I installed Elasticsearch, Kibana, filebeat, MetricBeat, Auditbeat and changed /etc/hosts file so that it point my local IP to node1.elastic.local. It is all on one debian machine. \*.yml files are all using "node1.elastic.local" name instead of IP adress. Everything worked great unitll I wanted to enroll Fleet server.

I changed settings in fleet settings seection so that they corespond to my FQDN:

 ![obraz](https://us1.discourse-cdn.com/elastic/original/3X/a/e/aec61deb348a8dd0ec127d183752796c0d2da4d1.png)

Then I used this command to enroll my Fleet server

```auto
./elastic-agent install --url=https://node1.elastic.local:8220 --fleet-server-es=https://node1.elastic.local:9200 --fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2NjU0ODk0Mzk5MDg6NTNPZDFYSWlROFdFcEZmXzR0Rm9FZw --fleet-server-policy=fleet-server-policy --fleet-server-es-ca=/etc/elasticsearch/ca/ca.crt --certificate-authorities=/etc/elasticsearch/ca/ca.crt --fleet-server-cert=/etc/elasticsearch/instance/instance.crt --fleet-server-cert-key=/etc/elasticsearch/instance/instance.key           

```

I tried using RPM and deb packages but every single time i get this error:

```auto
Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]: {"log.level":"info","@timestamp":"2022-10-11T14:02:33.631+0200","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":792},"message":"Fleet Server - Starting","ecs.version":"1.6.0"} {"log.level":"info","@timestamp":"2022-10-11T14:02:35.634+0200","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":773},"message":"Fleet Server - Running on policy with Fleet Server integration: fleet-server-policy","ecs.version":"1.6.0"} {"log.level":"info","@timestamp":"2022-10-11T14:02:35.985+0200","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":471},"message":"Starting enrollment to URL: https://node1.elastic.local:8220/","ecs.version":"1.6.0"} Error: fail to enroll: fail to execute request to fleet-server: 1 error occurred: * missing enrollment api key  

```

I tried various commands. With certificates, without them. With url and without. Still Getting the same error for about a week. PLEASE help. Thank you in advance

---

<div class="post-metadata">

**Author:** ![Shaoranlaos](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@Shaoranlaos](https://discuss.elastic.co/u/Shaoranlaos)\
**Post date:** [October 12, 2022, 7:20am UTC](https://discuss.elastic.co/t/enrolling-fleet-using-fqdn-certificates/316328/2 "2022-10-12T07:20:07Z")

</div>

I compared your elastic agent command with the one i used and i think you need to replace install with enroll and remove the url param

```auto
./elastic-agent enroll --fleet-server-es=https://node1.elastic.local:9200
   --fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2NjU0ODk0Mzk5MDg6NTNPZDFYSWlROFdFcEZmXzR0Rm9FZw
   --fleet-server-policy=fleet-server-policy
   --fleet-server-es-ca=/etc/elasticsearch/ca/ca.crt
   --certificate-authorities=/etc/elasticsearch/ca/ca.crt
   --fleet-server-cert=/etc/elasticsearch/instance/instance.crt
   --fleet-server-cert-key=/etc/elasticsearch/instance/instance.key

```

that worked for me

---

<div class="post-metadata">

**Author:** ![krzychohoho](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@krzychohoho](https://discuss.elastic.co/u/krzychohoho)\
**Post date:** [October 12, 2022, 7:35am UTC](https://discuss.elastic.co/t/enrolling-fleet-using-fqdn-certificates/316328/3 "2022-10-12T07:35:15Z")

</div>

I used it with enroll, but the url parametr is required when I provide certificates.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 9, 2022, 7:35am UTC](https://discuss.elastic.co/t/enrolling-fleet-using-fqdn-certificates/316328/4 "2022-11-09T07:35:17Z")

</div>

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