When enrolling an agent to fleet, you need to specify the CA that signed the fleet server certificate. This can be found in the documentation here a the bottom of the page.
sudo elastic-agent install -f --url=https://192.0.2.1:8220 \
--enrollment-token=<string> \
--certificate-authorities=/path/to/ca.crt