To add to @shubham-singh answer, on some system the ssl directory may not be in /etc/puppetlabs/puppet/
.
You can run:
sudo find / -name puppet.conf
to find puppet.conf
file and look for the value of ssldir
property in puppet.conf
and then delete/rename the ssl directory and rerun:
puppet agent --test
The rerun may give you error and ask to run additional commands at server and agent to clear the certificate.
Follow the commands and then rerun:
puppet agent --test
and it should work now.
Edit:
If you are still having issue, it may be due to different versions of puppet on server and agent. Check the puppet version using below command on master and agent and make sure the versions are matching.
puppet --version