# Elastic stack with Fleet Server - certificate issue

**URL:** <https://discuss.elastic.co/t/elastic-stack-with-fleet-server-certificate-issue/322842>\
**Category:** Kibana\
**Tags:** docker, fleet\
**Created:** [January 10, 2023, 3:23pm UTC](https://discuss.elastic.co/t/elastic-stack-with-fleet-server-certificate-issue/322842 "2023-01-10T15:23:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MBender](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@MBender](https://discuss.elastic.co/u/MBender)\
**Post date:** [January 10, 2023, 3:23pm UTC](https://discuss.elastic.co/t/elastic-stack-with-fleet-server-certificate-issue/322842/1 "2023-01-10T15:23:28Z")

</div>

I'm trying to set up an all-in-one docker compose configuration for the Elastic Stack consisting of Elastic Search, Kibana, APM (I know it's being deprecated as a stand-alone service; for the time being this is for backwards compatibility) and Elastic Agent as Fleet Server.

To that end I'm setting up the following ENV variables for the `elastic-agent` image:

```auto
      environment:
        - KIBANA_HOST=https://kibana:5601
        - KIBANA_CA=/certs/ca/ca.crt
        - KIBANA_USERNAME=elastic
        - KIBANA_PASSWORD=${ELASTIC_PASSWORD}
        - ELASTICSEARCH_HOST=https://elastic-search:9200
        - ELASTICSEARCH_USERNAME=elastic
        - ELASTICSEARCH_PASSWORD=${ELASTIC_PASSWORD}
        - ELASTICSEARCH_CA=/certs/ca/ca.crt
        - KIBANA_FLEET_SETUP=true
        - KIBANA_FLEET_CA=/certs/ca/ca.crt
        - FLEET_SERVER_ENABLE=true
        - FLEET_SERVER_HOST=0.0.0.0
        - FLEET_SERVER_PORT=8220
# - FLEET_SERVER_CERT=/certs/fleet-server/fleet-server.crt
# - FLEET_SERVER_CERT_KEY=/certs/fleet-server/fleet-server.key

```

The last 2 variables have been deliberately commented. When the agent is started using the variables as they are currently (i.e. WITHOUT specifying the custom certificate files), then it fires up nicely and registers as a Fleet Server. However a self-signed certificate seems to be used (sort of to be expected, given that no certificate is provided in the configuration).

Alas if I uncomment the additional 2 lines to specify the certificate then the agent fails to start with the error:

```auto
Error: url is required when a certificate is provided

```

However, if I add `FLEET_URL` variable (which seems to be what the error suggests) then the fleet will **also** fail as it then seem to attempt to register WITH that fleet-server URL (i.e. with itself, which at this point is incorrect).

I can't shake the feeling there's either a bug (unlikely) or I'm missing some fundamental understanding of what a Fleet Server is supposed to be... Can someone point me at the right track, please?

---

<div class="post-metadata">

**Author:** ![AndersonQ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andersonq/32/112214_2.png) [@AndersonQ](https://discuss.elastic.co/u/AndersonQ)\
**Post date:** [January 17, 2023, 2:16pm UTC](https://discuss.elastic.co/t/elastic-stack-with-fleet-server-certificate-issue/322842/2 "2023-01-17T14:16:06Z")

</div>

Hello,

I believe the problem is the `FLEET_SERVER_HOST`, by the error you get, I believe `FLEET_SERVER_HOST` should be a URL, not an IP address. I don't remember by heart, but I believe you can use `FLEET_SERVER_HOST=https://fleet:FLEET_PORT`

---

<div class="post-metadata">

**Author:** ![MBender](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@MBender](https://discuss.elastic.co/u/MBender)\
**Post date:** [January 17, 2023, 4:10pm UTC](https://discuss.elastic.co/t/elastic-stack-with-fleet-server-certificate-issue/322842/3 "2023-01-17T16:10:40Z")

</div>

I tried it like that (i.e. `FLEET_SERVER_HOST=https://fleet-server:8220`) but got the same results (i.e. "url is required" error).

---

<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:** [February 14, 2023, 4:11pm UTC](https://discuss.elastic.co/t/elastic-stack-with-fleet-server-certificate-issue/322842/4 "2023-02-14T16:11:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![FrankieAtElastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frankieatelastic/32/132572_2.png) [@FrankieAtElastic](https://discuss.elastic.co/u/FrankieAtElastic)\
**Post date:** [May 14, 2024, 2:13pm UTC](https://discuss.elastic.co/t/elastic-stack-with-fleet-server-certificate-issue/322842/5 "2024-05-14T14:13:33Z")

</div>

Hello,

It's been awhile so I'm sure you've moved on, but in case others get the issue, I also experienced the same issue on docker and that the solution for me was to include:

```auto
FLEET_SERVER_PORT=8220
FLEET_URL=https://<endpoint>:8220
FLEET_CA=<fleet-server-ca-cert>

```
