Thursday, December 23, 2021

Error: Could not request certificate: getaddrinfo - puppet agent

 Issue:


[root@puppet-client ~]# /opt/puppetlabs/bin/puppet agent --test

Error: Could not request certificate: getaddrinfo: Name or service not known

Exiting; failed to retrieve certificate and waitforcert is disabled


Solution: Make sure you check following


  • Is the master running?
  • Does the hostname 'puppet' or 'puppet.abc.com' resolve from the agent?
  • Is TCP port 8140 on the master reachable from the agent (try: telnet puppet 8140)?
  • What does syslog on the agent say?
  • Try puppet agent --test on the agent, which will attempt to connect to the master and stay in foreground to show the output.

Tried all of those still did not work. Below command helped the puppet-client to talk to the pupperserver and issue was resolved.

[root@puppet-client ~]# puppet agent --server=idm-puppetmaster.interview.local

[root@idm-puppetmaster ~]# /opt/puppetlabs/bin/puppet cert list --all
  "puppet-client.interview.local"    (SHA256) F0:8C:52:53:DC:CD:1A:

- Make sure that you sign the client cert.

[root@idm-puppetmaster ~]# /opt/puppetlabs/bin/puppet cert sign puppet-client.interview.local
Signing Certificate Request for:
  "puppet-client.interview.local" (SHA256) F0:8C:52:53:DC:CD:1A:A4:9

output is truncated.............