Setup Knife to Use Local Chef Zero

From Bonus Bits
Jump to: navigation, search

Purpose

This article gives the steps to configure Knife to use local Chef Zero instance.


Prerequisites

  • ChefDK or Chef Client Installed


Generate PEM

Create an RSA Client PEM. Doesn't really matter because nothing is signed with the Chef Zero.

  1. Create Chef configuration directory
    mkdir ~/.chef
    
  2. Create Client PEM
    openssl genrsa -out ~/.chef/$USER.pem 2048
    


Configure Knife

Assuming we don't have a knife configure already in place.

  1. knife configure initial
    

Example

WARNING: No knife configuration file found
Where should I put the config file? [/Users/username/.chef/knife.rb]
Please enter the chef server URL: [https://localhost.local/organizations/myorg] http://127.0.0.1:8889
Please enter an existing username or clientname for the API: [username]
Please enter the validation clientname: [chef-validator]
Please enter the location of the validation key: [/etc/chef-server/chef-validator.pem]
Please enter the path to a chef repository (or leave blank):
*****

You must place your client key in:
  /Users/username/.chef/username.pem
Before running commands with Knife

*****

You must place your validation key in:
  /etc/chef-server/chef-validator.pem
Before generating instance data with Knife

*****
Configuration file written to /Users/username/.chef/knife.rb


Start Chef Zero

Run as Daemon

chef-zero -d

Run in Background (Option 2)

chef-zero  > /dev/null  2>&1 &


Related Articles


Sources