The tools & workstation setup
chef-client, knife, Workstation.
Chef has three environments to set up. The workstation is where you author cookbooks and run commands — you install Chef Workstation, which bundles the tools: chef for generating and running, knife for talking to the server, and Test Kitchen for testing. The Chef Infra Server is the hub. Nodes run chef-client (Chef Infra Client). For learning, chef-client can run locally in “zero” mode with no server at all.
# on the workstation$ chef --versionChef Workstation version: 24.x$ knife --versionChef Infra Client: 18.x# run a recipe locally with no server (chef-zero / local mode)$ chef-client --local-mode --runlist 'recipe[web]'
knife: the workstation-to-server tool
knife is the multi-tool for interacting with the Chef server: upload cookbooks, manage nodes and roles, edit data bags, bootstrap new machines. Bootstrapping is how a fresh server becomes a Chef node — knife installs chef-client on it, registers it with the server, and gives it an initial run-list. Authentication is via a private key tied to your user on the server, which is the credential you protect.
$ knife cookbook upload web # push a cookbook to the server$ knife node list # what the server knows about$ knife bootstrap 10.0.1.5 -N web1 \--run-list 'recipe[web]' --ssh-user deploy --sudo # register a new node