Knife-vsphere plugin does not bootstrap node

I’m trying to use the knife-vsphere plugin to clone and bootstrap a node.

I’m running the following command:
knife vsphere --config ~/.chef/knife.rb vm clone NEWVM --template TEMPLATEVM --bootstrap --bootstrap-ipv4 --run-list 'recipe[base]' --cips dhcp --cvlan "VM Network" --ssh-user root --ssh-password mypassword

Which give me the following;
Cloning template TEMPLATEVM to new VM NEWVM
Finished creating virtual machine NEWVM
Powered on virtual machine NEWVM
Waiting for network interfaces to become available…
Waiting for a valid IPv4 address…

Waiting for sshd access to become available on
WARN: Failed to read the private key /etc/chef/client.pem: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/chef/client.pem>
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

After that I can connect to and bootstrap the node just fine - but it should do this in the first command.

Any thoughts as to why it’s not working?


We use knife-vsphere heavily to clone, but not to bootstrap, so my experience here is limited.

Typically when you get a ‘Your private key could not be loaded from /etc/chef/client.pem’ that means knife or the chef-client is falling back on convention trying to find the client key to sign a request to the Chef Server API. /etc/chef/client.pem is the default config location convention for linux. It’s also worth noting the errors like this need to be pinpointed in terms of where are they happening? i.e. on the node that’s been bootstrapped or on the workstation doing the bootstrapping? The bootstrapping process will involve both contexts. The workstation needs connectivity to create the client and node records. The node once bootstrapped, will need connectivity. In my experience, the former is much more likely to be dorked up than the latter. I would confirm you have connectivity to the Chef Server API from your working directory by doing something like ‘knife node list’. I suspect you’ll get the same error.