# Error during checkin with fleet-server

**URL:** https://discuss.elastic.co/t/error-during-checkin-with-fleet-server/375776
**Category:** Elastic Agent
**Created:** [March 12, 2025, 11:14am UTC](https://discuss.elastic.co/t/error-during-checkin-with-fleet-server/375776 "2025-03-12T11:14:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![geo5](https://avatars.discourse-cdn.com/v4/letter/g/a88e4f/32.png) [@geo5](https://discuss.elastic.co/u/geo5)
#### Post date: [March 12, 2025, 11:14am UTC](https://discuss.elastic.co/t/error-during-checkin-with-fleet-server/375776/1 "2025-03-12T11:14:47Z")

</div>

I am trying to enroll an Elastic Agent with Elasticsearch, but my agent is in a Kubernetes cluster. I am using the same YAML that Kibana generated for me, but my container shows this error:  
`{"log.level":"warn","@timestamp":"2025-03-12T11:04:13.961Z","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/application/gateway/fleet.(*FleetGateway).doExecute","file.name":"fleet/fleet_gateway.go","file.line":183},"message":"Possible transient error during checkin with fleet-server, retrying","log":{"source":"elastic-agent"},"error":{"message":"fail to checkin to fleet-server: all hosts failed: requester 0/1 to host https://172.19.198.21:8220/ errored: Post \"https://172.19.198.21:8220/api/fleet/agents/18102197-709f-4cfe-9fe4-7e9729967535/checkin?\": invalid api key to authenticate with fleet"},"request_duration_ns":6583002,"failed_checkins":1,"retry_after_ns":116975884833,"ecs.version":"1.6.0"}`  
When I try to enroll on a server that is not in the Kubernetes cluster, it works fine—the token used is valid and functioning. However, when trying from within the cluster, this error appears. I modified the YAML and set it up as a deployment with one replica instead of a DaemonSet.
