If you are having issues with your Elasticsearch Agents not getting the correct Fleet server enrollment token then this fix is for you. Elasticsearch support docs recommend adding the token as clear text in the Elastic agent daemonset manifest but here I show how to add it in the daemonset but as a kubernetes secret!
I. Create secret
kubectl create secret generic fleet-enrollment-token --from-literal=token=####AAAA#######AAAA#######AAA##=
II. Update daemonset with kubernetes secret
Source: https://www.elastic.co/guide/en/fleet/7.17/running-on-kubernetes-managed-by-fleet.html