Before you start working with chef, it’s important to understand the chef architecture so that you can have some idea about the workflow that we will be following during chef learning path.
At top level view, chef setup can be divided into three main components as shown in below image.
Chef workstation: Chef workstation is the location where you will interact with chef server. All you need is to install ChefDK package.It can even be your windows laptop. On your workstation, you will be writing all the code to manage the configuration of various nodes that you will be controlling. For This learning series, I would recommend you to make Ubuntu system as your workstation. As of now, you do not need to worry about setting up your workstation as later in the course we will be working on configuring the same.
Chef Server: Chef Server acts as the controlling engine of your chef environment and stored all the data related to your environment. When working on your workstation, once you are done writing code for configuration management(we call this as developing cookbooks, will explore later in details but now onward we will use the term cookbook) you upload the same on the chef server. We will configure the chef server later in this course.
Chef Client nodes: These are the machines that are managed by chef. We will install chef-client packages on all the nodes. This chef client running on the nodes, connects to the chef server at regular intervals and pulls the cookbook that you have uploaded to the server from your workstation. Once it pull, it runs the same on the node and configures the same.
Now at this point we have not discussed as how does a client running on the node determines as which cookbook it has to pull and run. We will discuss all that later in the course but for now let us try to understand the chef architecture.
Since you have some very basic understanding of chef environment, lets dig deep into each of the above defined components(workstation only, we will cover other subcomponents later in the course) and try to identify other subcomponents that they are made up of. Before I move further have a look at below diagram, it shows various chef components and subcomponents and how they are related with one another.
Chef Workstation and its components :
When we install ChefDK on the workstation, it installs everything required to start with chef.
Ohai: Ohai is the utility that collects all the workstation information. Typically ohai collects all sort of information related to your machine like hostname, processor info, disk info, ip addresses.
chef utility: Used to create your cookbooks and interact with the same.
Knife Utility: You will use the same to interact with the nodes or work with the chef server from your workstation
Test kitchen: You will use test kitchen to automatically test cookbooks on your workstation.
Chefspec: Frame work to write test cases for your cookbooks. You mainly perform unit testing for your cookbooks using the same.
Cookstyle: Utility to validate your cookbooks for any syntax error.
Foodcritic: Utility to validate your cookbooks and check code styles.
InSpec: Framework to write integration tests for your cookbooks.
Cookbooks, recipies, tests policyfiles are other components that you will be writing on the workstation and uploading to the chefserver. We will do hands on labs on all of these components and will try to learn them.
Give some time and understand various components used in chef.Once done, move on to next tutorial Installation and setup. If you want to know more about all of the components, Here is the chef official documentation