I have an on-prem install of Elasticsearch 7.16.3 on a Red Hat Enterprise Linux Server release 7.9 (Maipo).
I had no issues installing Elasticsearch, kibana or fleet server, but when I enroll an agent, it is successful and shows active on the fleet server for 3-5 minutes, then goes inactive. On the console of the server where agent is installed:
Elastic Agent has been successfully installed.
[root@spyglass elastic-agent-7.16.3-linux-x86_64]# 2022-02-25T16:34:27.053Z INFO cmd/enroll_cmd.go:472 Retrying enrollment to URL: http://192.168.1.53:8220/
Error: fail to enroll: fail to execute request to fleet-server: context canceled
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/7.16/fleet-troubleshooting.html
While this agent is on Redhat, I've seen this behavior on Windows and Mac as well. Firewall is completely disabled on the Elasticsearch/kibana/fleet server, so it's not that. There is no proxy. The agent was running the default profile, no integrations have been added. No logs were in the agent console.
The elastic server processes are running on: CentOS Linux release 8.4.2105
FWIW, I had this same issue with 7.15.x as well.