|
A node is a host that runs the Chef client. The primary features of a node, from Chef's point of view, are its Attributes and its run list. Nodes are the thing that Recipes and Roles are applied to.
|
|
Lifecycle of a NodeWhen you start Chef Client or Chef Solo, the first thing we do is create a Node object. We then:
At runtime, the Node is available within Recipes, Definitions, and Resources as they are being evaluated. AuthenticationChef uses Signed Header Authentication for each request. Node data is separate from the identity used to authenticate requests to the Chef Server, which is managed by an API client. Each API client has a public/private key pair. The public half of the key is stored in the database on the server, and the private half is kept locally by the client. On a node running the Chef Client, the private key is generally stored in /etc/chef/client.pem. Each request to the Chef server includes a request signature in the HTTP headers. The request signature is computed from the hash of the request content and encrypted with the client's private key to verify the identity of the user or machine making the request and prevent attempts to tamper with the content. When a node runs chef-client for the first time, it generally does not yet have an API client identity, and so cannot make authenticated requests to the server. This is where the validation client—named "chef-validator" by default comes in. When the chef-client runs, it checks if it has a client key. If the client key does not exist, it then attempts to "borrow" the validation client's identity to register itself with the server. In order to do that, the validation client's private key needs to be copied to the host and placed in /etc/chef/validation.pem. Once the client machine has registered itself with the chef server, it no longer uses the validation client for anything. It is recommended that you delete the validation client's private key from the host after the host has registered. Authentication and Authorization provides additional detail on the Chef model for these actions. Managing NodesThe recipes list and attributes of nodes may be managed through multiple means. Managing Nodes via KnifeKnife is Chef's command line tool, and can be used to create, edit, view, list, tag and delete nodes. Refer to the Knife documentation for additional details on knife.
Managing Nodes via the Management ConsoleThe Management Console is Chef's web interface. Nodes can be managed in the Management Console.
Managing Nodes through JSON at the command lineBoth Chef Client and Chef Solo allow you to write JSON to a file and read it in through the command line. The file should contain a hash, the elements of which will be added as attributes on your Node. We have two special entries that can be used to set which cookbooks/recipes will be applied during run-time.
Managing Nodes via a Cookbooks Attribute or Recipe fileYou can also ensure that an attribute or is set via an Attribute or Recipe file. Use Case QuestionsHow do I run more than one node on a system or change a node name?You can use the -N option to chef-client or chef-solo to set the node name manually. Can you name a node anything you choose?The only restriction Chef places on node names is that they match this regular expression: |
|
|



2 Comments
comments.show.hideAug 11, 2009
Michael Marano
It's probably worth noting that the chef client has the following default in /etc/chef/client.rb:
Mar 03, 2010
Robert J. Berger
You can get the authoritative name of a node (the name that can be used as a handle for editing or deleting the node) with
It may or may not be the same as
or sometimes