Hello,
I seem to stumble on the issue of enrolling my agent securely into fleet.
i’ve tried the FAQ where they suggest to install the agent first, and then enroll it into fleet (upgrading the agent to a fleet server with the fleet integration).
I get, depending on which configuration i attempt errors like:
But most of the time I get the puzzling:
"error.message":"dial tcp [::1]:9200: connect: connection refused","
Which is odd, because it attempts to connect to localhost ipv6 address. I’ve explicitly said the enroll/install to a ipv4 LAN ip address:
./elastic-agent enroll --url=https://LAN IP:8220 \
--fleet-server-es=https://LAN IP:9200 \
--fleet-server-service-token=<token> \
--fleet-server-policy=<my-policy-name> \
--fleet-server-es-ca-trusted-fingerprint=<fingerprint> \
--certificate-authorities=/root/cert-workies-fleet/fleet-ca.crt \
--fleet-server-cert=/root/cert-workies-fleet/vloot.crt \
--fleet-server-cert-key=/root/cert-workies-fleet/vloot.key \
--fleet-server-port=8220 \
Initially I attempted the full 2-way TLS config, but got the same errors
does anyone know how to fix this?
Thanks
EDIT:
detailed log extract:
{
"log.level": "warn",
"@timestamp": "2025-11-16T22:17:03.179Z",
"message": "Failed Elasticsearch output configuration **test**, using bootstrap values.",
"component": {
"binary": "fleet-server",
"dataset": "elastic_agent.fleet_server",
"id": "fleet-server-default",
"type": "fleet-server"
},
"log": {
"source": "fleet-server-default"
},
"ecs.version": "1.6.0",
"service.name": "fleet-server",
"service.type": "fleet-server",
"error.message": "dial tcp [::1]:9200: connect: connection refused",
"output": {
"Elasticsearch": {
"Headers": null,
"Hosts": [
"localhost:9200"
],
"MaxConnPerHost": 128,
"MaxContentLength": 104857600,
"MaxRetries": 3,
"Path": "",
"Protocol": "https",
"ProxyDisable": false,
"ProxyHeaders": {},
"ProxyURL": "",
"ServiceToken": "[redacted]",
"ServiceTokenPath": "",
"TLS": {
"CASha256": null,
"CATrustedFingerprint": "<fingerprint>",
"CAs": null,
"Certificate": {
"Certificate": "/root/cert-workies-fleet/elastiek.crt",
"Key": "[redacted]",
"Passphrase": "",
"PassphrasePath": ""
},
"CipherSuites": null,
"CurveTypes": null,
"Enabled": null,
"Renegotiation": "never",
"VerificationMode": "full",
"Versions": null
},
"Timeout": 90000000000
},
"Extra": null
},
"ecs.version": "1.6.0"
}
{
"log.level": "error",
"@timestamp": "2025-11-16T22:29:05.646Z",
"message": "failed to fetch elasticsearch version",
"component": {
"binary": "fleet-server",
"dataset": "elastic_agent.fleet_server",
"id": "fleet-server-default",
"type": "fleet-server"
},
"log": {
"source": "fleet-server-default"
},
"ecs.version": "1.6.0",
"service.name": "fleet-server",
"service.type": "fleet-server",
"error.message": "dial tcp [::1]:9200: connect: connection refused",
"ecs.version": "1.6.0"
}
{
"log.origin": {
"function": "github.com/elastic/elastic-agent/internal/pkg/agent/cmd.waitForFleetServer.func1",
"file.name": "cmd/enroll_cmd.go",
"file.line": 844
},
"message": "Fleet Server - Error - open : no such file or directory reading <nil>",
"ecs.version": "1.6.0"
}
