Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Chef Interview Questions, Explained: Resources, Run-Lists, Bootstrapping, and Test Kitchen

Chef interviews and day-to-day operations often revolve around the same fundamentals: resources, recipes, cookbooks, run-lists, node bootstrapping, and local testing. This guide is for DevOps engineers who want clear, interview-ready answers plus production-oriented examples.

Originally published on 2015-09-02; fully revised and updated.

Source material: learn.chef.io (original Q&A format), reorganized here into a structured reference.

Core Chef concepts interviewers ask most often

ConceptWhat it means in practiceInterview-ready answer
ResourceA unit of desired state (package, service, file, template, user, etc.).A resource describes what state must exist, not just a command to run.
RecipeAn ordered collection of resources.A recipe defines configuration policy for part of a system.
CookbookA package of recipes plus templates, files, attributes, and metadata.A cookbook is the reusable delivery unit; a recipe is one part inside it.
Run-listOrdered list of recipes/roles a node applies.Run-list controls what runs and in which order.
NodeAny managed machine (VM, bare metal, or instance).A node is the compute target that runs chef-client and converges policy.
Starter KitWorkstation files and credentials for secure Chef Server access.It contains keys/config needed for authenticated communication.

Why resource order and action order matter

Chef applies resources in the order they are declared during convergence. That means ordering can decide whether a run succeeds or fails.

package 'httpd'

service 'httpd' do
  action [:enable, :start]
endCode language: JavaScript (javascript)

The example above typically works because the package is installed before the service is managed.

service 'httpd' do
  action [:enable, :start]
end

package 'httpd'Code language: JavaScript (javascript)

This order can fail if the service provider cannot manage httpd before the package exists.

CaseEquivalent?Why
package then serviceNo (vs service then package)Resource declaration order changes convergence behavior.
action [:enable, :start] vs [:start, :enable]Not strictly identicalActions are executed in listed order; boot/runtime side effects may differ.
Different ordering of attributes inside one resourceUsually yesAttribute line order inside the same resource does not typically change outcome.
file '/etc/motd' do
  owner 'root'
  group 'root'
  mode '0755'
  action :create
end

file '/etc/motd' do
  action :create
  mode '0755'
  group 'root'
  owner 'root'
endCode language: JavaScript (javascript)

chef-apply vs chef-client

CommandBest forTypical scopeCommon use
chef-applyQuick local experimentsSingle recipe fileLearning, prototyping, one-off validation
chef-clientManaged node convergenceRun-list and cookbook contentProduction configuration runs via Chef Server or local mode

Chef Server options and bootstrap prerequisites

The original material describes two common server patterns: self-hosted Chef Server and hosted Chef offerings.

OptionControlOperational overhead
Self-hosted Chef ServerHighYou manage installation, upgrades, backup, and availability.
Hosted Chef serviceLowerProvider operates the control plane; you focus on policy and nodes.

For bootstrapping a node from your workstation, you generally need:

  • Node host name or reachable IP address
  • A login user with privilege to install software
  • Password authentication or (preferably) SSH key authentication
  • Workstation credentials (Starter Kit) to talk to Chef Server

Bootstrap workflow from workstation to managed node

flowchart TD
    A[Workstation with knife] --> B[Bootstrap target node]
    B --> C[Install chef-client]
    C --> D[Register node with Chef Server]
    D --> E[Assign run list]
    E --> F[Converge resources in order]
    F --> G[Node checkin completes]
    G --> H[Verify node in knife or console]
knife bootstrap <NODE_IP> -x <SSH_USER> -i <PATH_TO_PRIVATE_KEY> --sudo --node-name <NODE_NAME> --run-list 'recipe[apache::default]'

knife node list
knife node show <NODE_NAME>Code language: HTML, XML (xml)

Common knife commands from the original Q&A

CommandPurpose
knife node listList registered nodes
knife node show NODEView details for a specific node
knife cookbook upload COOKBOOKUpload cookbook content to Chef Server
knife ssh QUERY CMDRun remote commands across matching nodes
knife cookbook site show NAMEQuery cookbook metadata from the community site

Reusable community cookbooks are published on Chef Supermarket.

Template and versioning example

The original article shows rendering node facts into an HTML template. The ERB below mirrors that pattern.

<html>
<body>
  <h1>hello from <%= node['fqdn'] %></h1>
  <pre>
<%= node['hostname'] %>
<%= node['platform'] %> - <%= node['platform_version'] %>
<%= node['memory']['total'] %> RAM
<%= node['cpu']['total'] %> CPUs
  </pre>
</body>
</html>Code language: HTML, XML (xml)
# metadata.rb
version '1.0.0'Code language: PHP (php)

Using 1.0.0 for a production-ready first stable release matches Semantic Versioning practice.

Testing on multiple platforms with Test Kitchen

Test Kitchen helps run the same cookbook across a platform matrix. The source example uses CentOS 6.x; treat that as historical and map to currently supported images in your environment.

---
driver:
  name: vagrant

provisioner:
  name: chef_zero

platforms:
  - name: centos-6.6
  - name: centos-6.5

suites:
  - name: default
    run_list:
      - recipe[motd::default]Code language: CSS (css)
kitchen list
kitchen converge
kitchen login default-centos-66
kitchen login default-centos-65Code language: PHP (php)

Best practices for interviews and real Chef usage

  • Explain Chef in terms of desired state and idempotent resources, not shell scripts.
  • Call out ordering explicitly: recipe order matters; attribute line order inside a resource usually does not.
  • Use chef-apply for quick experiments, but describe chef-client for managed production convergence.
  • Show verification habits: check run-list, inspect node data, and test across multiple platforms with Test Kitchen.
  • Version cookbooks deliberately and promote through environments instead of ad-hoc edits on servers.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

TFS Interview Questions and Answers: Practical DevOps Guide

A structured, interview-focused guide to Team Foundation Server (TFS), including TFVC vs Git, build and reporting topics, and practical command examples. Use it to prepare concise, technically strong answers for common TFS interview scenarios.

Read More

Chef Interview Q&A (Part 2): Resources, Run-Lists, Bootstrap, and Test Kitchen

A practical rewrite of classic Chef interview questions, focused on how Chef resources converge, how run-lists drive node configuration, and how to test cookbooks safely. Includes command examples, workflow diagrams, and comparison tables.

Read More

SVN Interview Questions and Answers: Trunk, Branch, Tag, Update, Commit, Patch, Backup, and Authentication

A practical, interview-focused guide to Subversion (SVN) concepts and commands. Learn how to explain trunk/branch/tag, update vs commit, conflict handling, patching, backup/restore, and auth setup with confidence.

Read More

Jenkins Interview Questions, Answered: CI, APIs, Installation, Backups, and Essential Plugins

This revised guide turns common Jenkins interview prompts into practical answers you can explain with confidence. It covers CI fundamentals, API usage, setup on Ubuntu and RHEL-like systems, backup strategy, and key plugins.

Read More

Git, GitHub, and GitLab Interview Questions: Practical Answers and Command Guide

A practical interview-prep guide covering core Git concepts, essential commands, and common GitHub/GitLab questions. Includes workflow diagrams, comparisons, and troubleshooting checklists.

Read More

Build and Release Engineer Interview Guide: Questions, Answer Frameworks, and Tool Comparisons

A practical, updated interview guide for Build, Release, and Configuration Engineering roles. Use it to prepare better answers or run more consistent technical interviews.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x