Pages

Wednesday, September 5, 2018

Chef Components

Chef uses 3 tier arch model where there will be chef-server,chef-nodes and workstation.
                               

Chef-Server – This is the central unit of chef where all configuration files, cookbooks , information about nodes that are registered with the chef server.  

Chef-Nodes – These are the nodes or machines that need to be managed by the chef server. Each node will have a chef-client installed and by using this the state of the machine is changed or managed

Chef-WorkStation – This is the machine where users interact with chef. This is the workstation where users write , test cookbooks. They write cookbook to automate certain actions and then upload them to the chef server. One or more nodes will be configured as chef-workstation where we write, test our cookbooks.

Chef Components
Though chef-server, chef-nodes and chef-workstation are primary components in chef, they are many internal components that we need to understand before starting.

Cookbook – A Cookbook Is the fundamental component in chef. It describes the desired state of the nodes and allow chef to push the changes in order to achieve the state. Let’s say if we want to install a Httpd package, we write a cookbook defining how to install this package. This is then uploaded to the Chef server which will then take care of pushing these changes to the chef-nodes and run them to achieve the desired state. Chef uses Ruby as it reference language for creating cookbooks.

Chef-repo – a Repository structure where all our cookbooks are written, tested and maintained. This is a location created on the chef-workstation and all our cookbooks are written in this location and then uploaded to the chef-server. This can be different based on your requirement, some keep all their cookbooks in one location and some chef-repo for each cookbook.

Chef-development kit – This is a package which containers tools that help in starting with chef. The tools are

Chef-client – A chef-client is installed on every chef-nodes that need to be managed by the chef server. The job of the chef-client is to perform all of the configuration tasks , work on behalf of the chef to achieve the desired state. Some of the works of chef-client include,

Taking the appropriate and required actions to configure the node
Sync with the chef-server for any cookbooks
Registering and authenticating the node with the chef-server
Syncing node details to the chef-server

public/Private keys are configured with chef-server and chef-nodes for all the communications. The chef-client accesses the chef-server from the node on which it is running to get configuration data, cookbooks data. It also gets the historical run time data of that node. Once the configuration is pulled, the chef-client starts running. Once it successfully completes the run, it then uploaded run data to the chef-server for future references

Knife – this is command line utility to interact with nodes or work with objects on the chef server.

Ohai – This is a tool that is used to collect system data. This is a part of the chef-client. Chef-client run the ohai at the beginning of every chef run to determine the system state. This includes many built-in plugins to detect common configuration details of the system like OS , Network ,  Memory , Disk, CPU ,  Kernel ,Host names and many more.

No comments :

Post a Comment