Search code examples
ubuntuchef-infrainstallationknife

Private key could not be loaded when I run "knife client list"


Configuration file written to /home/ubuntu/sudo /home/ubuntu/chef-repo/.chef/knife.rb

ubuntu@mychefclient:~$ knife client list
WARNING: No knife configuration file found
ERROR: Your private key could not be loaded from /etc/chef/client.pem
Check your configuration file and ensure that your private key is readable

Solution

  • Please check once that the knife.rb file is there in .chef/knife.rb.

    If not run the following command:

    knife configure initial
    

    so it will create knife.rb, then check the path of client key in knife.rb and cross check whether the client.pem is present on that location.

    If this doesn't work.

    just go to the client node and delete client.pem from /etc/chef, then run chef-client so it will create client.pem again. Now copy that client.pem on to the server and add that location into the knife.rb

    It will work definitely :)