# Error when installing fleet server

**URL:** <https://discuss.elastic.co/t/error-when-installing-fleet-server/274280>\
**Category:** Endpoint Security\
**Tags:** fleet\
**Created:** [May 28, 2021, 2:48am UTC](https://discuss.elastic.co/t/error-when-installing-fleet-server/274280 "2021-05-28T02:48:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathon\_Penn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonathon_penn/32/89381_2.png) [@Jonathon\_Penn](https://discuss.elastic.co/u/Jonathon_Penn)\
**Post date:** [May 28, 2021, 2:48am UTC](https://discuss.elastic.co/t/error-when-installing-fleet-server/274280/1 "2021-05-28T02:48:38Z")

</div>

When attempting to install a fleet server for a cluster running on an on-prem installation of Elastic Enterprise, I get the following error:

```auto
user@fleet01:/opt/elastic-agent$ sudo elastic-agent enroll -f --fleet-server-es=https://d48f *****.elastic.bentonvillek12.org:9243 --fleet-server-service-token=AAEAAWV*****
The Elastic Agent is currently in BETA and should not be used in production

2021-05-27T20:36:35.688-0500 INFO cmd/enroll_cmd.go:300 Generating self-signed certificate for Fleet Server
2021-05-27T20:36:38.486-0500 INFO cmd/enroll_cmd.go:643 Fleet Server - Starting
2021-05-27T20:36:39.488-0500 INFO cmd/enroll_cmd.go:643 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:36:45.502-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:36:51.520-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:36:57.529-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:37:03.539-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:37:09.553-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:37:15.561-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:37:21.576-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:37:27.587-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:37:33.612-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:37:39.626-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:37:45.637-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:37:51.654-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:37:57.667-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:38:03.677-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:38:09.689-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:38:15.700-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:38:21.722-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:38:27.733-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
2021-05-27T20:38:33.744-0500 INFO cmd/enroll_cmd.go:648 Fleet Server - Waiting on default policy with Fleet Server integration
Error: fleet-server never started by elastic-agent daemon: context canceled
user@fleet01:/opt/elastic-agent$

```

I'm running elastic search 7.13 and the 7.13 version of the agent.  
Agent logs are [here](https://pastebin.com/UTuUx01F)

Any ideas on where to go next?

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [May 28, 2021, 7:32am UTC](https://discuss.elastic.co/t/error-when-installing-fleet-server/274280/2 "2021-05-28T07:32:49Z")

</div>

Hi @Jonathon_Penn It seems the problem is that fleet-server cannot find an elastic agent policy with a fleet-server integration inside. Could you share a screenshot of the policies you have listed in Fleet under policies? You have one specific for fleet-server with the fleet-server integration configure? Is this a fresh cluster or upgraded from previous versions?

---

<div class="post-metadata">

**Author:** ![Jonathon\_Penn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonathon_penn/32/89381_2.png) [@Jonathon\_Penn](https://discuss.elastic.co/u/Jonathon_Penn)\
**Post date:** [May 28, 2021, 12:46pm UTC](https://discuss.elastic.co/t/error-when-installing-fleet-server/274280/3 "2021-05-28T12:46:15Z")

</div>

This is a freshly created cluster. I have destroyed and re-created it several times in the course of troubleshooting.

 ![Screenshot_2021-05-28 Policies - Fleet - Elastic](https://us1.discourse-cdn.com/elastic/original/3X/f/0/f090fa2a2768e43dba9b979b26f1095a644a7642.png)  
 ![Screenshot_2021-05-28 Default policy - Policies - Fleet - Elastic](https://us1.discourse-cdn.com/elastic/original/3X/c/a/caf44f3bb6e101361fa42d485c407d049c27714e.png)  
 ![Screenshot_2021-05-28 Elastic Cloud agent policy - Policies - Fleet - Elastic](https://us1.discourse-cdn.com/elastic/original/3X/d/0/d0f5802d49a52a69c71400f69836d380179cb485.png)

Based on your description of the problem I also tried manually adding a policy with the fleet server integration, but this did not fix the issue. Does it need to be named something special to be detected?

 ![Screenshot_2021-05-28 Fleet Server - Policies - Fleet - Elastic](https://us1.discourse-cdn.com/elastic/original/3X/5/c/5c639331826f84e2af8c249c4c0862cfca6cb1f1.png)

---

<div class="post-metadata">

**Author:** ![Jonathon\_Penn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonathon_penn/32/89381_2.png) [@Jonathon\_Penn](https://discuss.elastic.co/u/Jonathon_Penn)\
**Post date:** [May 28, 2021, 1:21pm UTC](https://discuss.elastic.co/t/error-when-installing-fleet-server/274280/4 "2021-05-28T13:21:39Z")

</div>

After some more troubleshooting I discovered that the "Default Fleet Server policy" is only created on a cluster if that cluster that does **not** have an apm node. I was able to create a cluster without an apm node, then add an apm node after creation. This gave me the "Default Fleet Server policy" and allowed the agent to connect. Thanks for pointing me in the right direction.

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [May 31, 2021, 6:47am UTC](https://discuss.elastic.co/t/error-when-installing-fleet-server/274280/5 "2021-05-31T06:47:12Z")

</div>

Glad you found a solution. The Default Fleet Server policy should also have been created without the apm node as soon as a user with superuser permissions logs in for the first time. I'll investigate this further on our end.

---

<div class="post-metadata">

**Author:** ![Nico\_17](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nico_17/32/89855_2.png) [@Nico\_17](https://discuss.elastic.co/u/Nico_17)\
**Post date:** [June 5, 2021, 4:41am UTC](https://discuss.elastic.co/t/error-when-installing-fleet-server/274280/6 "2021-06-05T04:41:28Z")

</div>

I'm with the same problem. As I solve the APM, I have a new installation but I can't get the fleet server running, same error.

---

<div class="post-metadata">

**Author:** ![Robo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robo/32/38295_2.png) [@Robo](https://discuss.elastic.co/u/Robo)\
**Post date:** [June 7, 2021, 10:20am UTC](https://discuss.elastic.co/t/error-when-installing-fleet-server/274280/7 "2021-06-07T10:20:28Z")

</div>

I can confirm similar behavior using 7.13.  
So I checked the policies tab and added following parameter to the fleet enroll:  
`--fleet-server-policy=policy-elastic-agent-on-cloud`

Once this was done, I was able to proceed with fleet server setup.

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [June 8, 2021, 2:12pm UTC](https://discuss.elastic.co/t/error-when-installing-fleet-server/274280/8 "2021-06-08T14:12:58Z")

</div>

@Jonathon_Penn I missed a very important detail on my end which is that you are running on ECE. First, the release which can run fleet-server in ECE is not out yet. So the only way is to run your own fleet-server.

When running your own fleet-server, I strongly recommend NOT to use the fleet-server policy that is automatically setup with the `policy-elastic-agent-on-cloud`. Instead, create a new policy and add fleet-server to it. This makes sure you get full control over it.

---

<div class="post-metadata">

**Author:** ![Robo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robo/32/38295_2.png) [@Robo](https://discuss.elastic.co/u/Robo)\
**Post date:** [June 10, 2021, 11:38am UTC](https://discuss.elastic.co/t/error-when-installing-fleet-server/274280/9 "2021-06-10T11:38:05Z")

</div>

Thanks for pointing that out. It's exactly the place where I got stuck using fleet in ECE. Once a new policy with fleet-server integration was created the fleet server started correctly.

---

<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:** [July 8, 2021, 11:38am UTC](https://discuss.elastic.co/t/error-when-installing-fleet-server/274280/10 "2021-07-08T11:38:38Z")

</div>

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