Why is --fleet-server-es required if I already specified --url when installing elastic agent?

I already have a fleet server and elastic instance set up in the cloud somewhere at https://fleet.example.net:8220 and https://elastic.example.net:9200.

Next, I want to install an elastic agent on my laptop. I downloaded the elastic agent on to my laptop. Then I successfully ran this command on my laptop to enroll my elastic agent into the fleet server in the cloud:

./elastic-agent install --url=https://fleet.example.net:8220 `
  --fleet-server-es=https://elastic.example.net:9200 `
  --fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2ODI1Mzg2MzE4NDQ6VjR6a0JpbDlSR5l3R2JmVXB4TFQ0Zc `
  --fleet-server-policy=fleet-server-policy

>Elastic Agent has been successfully installed

Now I see entries appearing in my logs-* in Kibana>Discover. That's great and all, but I wanted to understand this command further.

According to the --help, it says:

  1. --fleet-server-es will Start and run a Fleet Server along side this Elastic Agent connecting to the provided elasticsearch
  2. --url will URL to enroll Agent into Fleet

Things fail when I omit the --fleet-server-es flag, during the ./elastic-agent.exe install statement on my laptop. My question is Why? I already have a fleet server running at https://fleet.example.net:8220. Why does my laptop need to create another fleet server or why does it need to reference my elastic server at https://elastic.example.net:9200?

Hi @learningelastic

Exactly what documentation are you following? What flow are you following, I think you are following the incorrect flow for a Fleet Managed Agent.

You should follow this flow...

And if you do ... you will note that the install commands look like this from your kibana

curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-8.7.0-darwin-x86_64.tar.gz
tar xzvf elastic-agent-8.7.0-darwin-x86_64.tar.gz
cd elastic-agent-8.7.0-darwin-x86_64
sudo ./elastic-agent install --url=https://05ssafkjashdflkasjdhf.fleet.us-west1.gcp.cloud.es.io:443 --enrollment-token=LKJHlkjhLKJHlkjhLKJHlkjhGR0M6U0lDdml6OUZUWWlYZHpRaFRiOEZ1dw==

This is different than what you are trying to do above which is an agent that is a fleet server

1 Like