This presentation is about "DevOps interview questions" will take you through some of the most popular questions that you face in a DevOps interview. This video covers interview questions related to source code management, continuous integration, continuous testing, configuration management, containerization and continuous monitoring. "The DevOps Hiring Boom” claims that as many as 80 percent of Fortune 1000 organizations are expected to adopt DevOps by 2019. If you’ve started cross-training to prepare for development and operations roles in the IT industry, you know it’s a challenging field that will take some real preparation to break into. Here are some of the most common DevOps interview questions and answers that can help you while you prepare for DevOps roles in the industry. Learn and get a deeper understanding of these questions to set you apart from the crowd in this booming industry.
This "DevOps interview questions" presentation will answer the questions related to the topics mentioned below:
1. Configuration management - Chef, Puppet and Ansible
2. Containerization - Docker
3. Continuous monitoring - Nagios
Why learn DevOps?
Simplilearn’s DevOps training course is designed to help you become a DevOps practitioner and apply the latest in DevOps methodology to automate your software development lifecycle right out of the class. You will master configuration management; continuous integration deployment, delivery, and monitoring using DevOps tools such as Git, Docker, Jenkins, Puppet, and Nagios in a practical, hands-on and interactive approach. The DevOps training course focuses heavily on the use of Docker containers, a technology that is revolutionizing the way apps are deployed in the cloud today and is a critical skillset to master in the cloud age.
After completing the DevOps training course you will achieve hands-on expertise in various aspects of the DevOps delivery model. The practical learning outcomes of this Devops training course are:
An understanding of DevOps and the modern DevOps toolsets
The ability to automate all aspects of a modern code delivery and deployment pipeline using:
1. Source code management tools
2. Build tools
3. Test automation tools
4. Containerization through Docker
5. Configuration management tools
6. Monitoring tools
Who should take this course?
DevOps career opportunities are thriving worldwide. DevOps was featured as one of the 11 best jobs in America for 2017, according to CBS News, and data from Payscale.com shows that DevOps Managers earn as much as $122,234 per year, with DevOps engineers making as much as $151,461. DevOps jobs are the third-highest tech role ranked by employer demand on Indeed.com but have the second-highest talent deficit.
Learn more at https://www.simplilearn.com/cloud-computing/devops-practitioner-certification-training
4. Why are SSL certificates used in Chef?
• SSL certificates are used between the Chef server and client to
ensure that each node has access to the right data
• Every node has a private and public key pair. The public key is
stored at the Chef server
• When an SSL certificate is sent to the server, it will contain the
private key of the node
• The server compares this against the public key in order to
identify the node and gives the node access to the required data
stored on the server
1
5. Command PromptC:>_
# systemctl disable httpd.service
# system disable httpd.service
# system disable httpd
# systemctl disable httpd.service
Which of the following commands would you use to stop or disable the
‘httpd’ service when the system boots?2
6. Command PromptC:>_
# systemctl disable httpd.service
# system disable httpd.service
# system disable httpd
# systemctl disable httpd.service
2 Which of the following commands would you use to stop or disable the
‘httpd’ service when the system boots?
7. Test Kitchen is a command line tool in Chef that spins up an instance and tests
the cookbook on it before deploying it on the actual nodes
What is Test Kitchen in Chef?
Command PromptC:>_
$ kitchen create
$ kitchen converge
$ kitchen verify
$ kitchen destroy
$ kitchen setup
//create instances
//combines multiple instances
//verify instances
//destroy instances
//setup instances
Here are the most commonly used kitchen commands:
3
8. How does chef-apply differ from chef–client?
chef-apply is run on the client system
chef-apply applies the recipe mentioned in
the command on the client system
chef–client is also run on the client system
chef–client applies all the cookbooks in your
server’s run list to the client system
Command PromptC:>_
$ chef-apply recipe_name.rb
Command PromptC:>_
$ knife chef-client
4
9. Command PromptC:>_
# puppetca –sign hostname-of-agent
# puppetca sign hostname-of-agent
What is the command to sign the requested certificates?
This is for
Puppet
version 2.7
Example:
# puppetca –sign ChefAgent
Example:
# puppetca sign ChefAgent
5
10. Command PromptC:>_
# puppetca –sign hostname-of-agent
# puppetca sign hostname-of-agent
This is for
Puppet
version 3
Example:
# puppetca sign ChefAgent
Example:
# puppetca –sign ChefAgent
5 What is the command to sign the requested certificates?
11. Changes in configuration are
tracked using Jira and
further maintenance is done
through internal procedures
Version control takes
the support of Git and
Puppet’s code
manager app
The changes are also
passed through
Jenkin’s continuous
integration pipeline
Which open source or community tools do you use to make Puppet more powerful?
6
12. Resources are the basic units of any
configuration management tool
These are the features of a node, like their software
packages or services
A resource declaration, written in a catalog,
describes the action to be performed on or with the
resource
When the catalog is executed, it sets the node to
the desired state
1
2
3
4
What are resources in Puppet?
7
13. The classes are added to a node’s catalog and are executed only
when specifically invoked.
Classes are named blocks in your manifest that configure
various functionalities of the node, such as
services files packages
What is Class in Puppet?
Class apache (String $version = ‘latest’) {
package{
‘httpd’: ensure => $version,
before => File[‘/etc/httpd.conf’],}
8
14. Role is an independent block of task, variables, files and templates embedded inside a playbook
---
- hosts: node1
roles
- {role: install-tomcat}
This playbook installs tomcat on
node1
What is Ansible role?
9
15. • Always use {{}} for variables unless you have a conditional statement such as “when: …”. This is
because conditional statements are run through Jinja which resolves the expressions
For example:
echo “This prints the value of {{foo}}”
when : foo is defined
• Using brackets makes it simpler to distinguish between strings and undefined variables
foo: “{{ varname }}”
This also ensures that Ansible doesn’t recognise the
line as a dictionary declaration
When should I use ‘{{ }}’?
10
16. There are 3 ways to make content reusable or redistributable in Ansible
Roles are used to manage tasks in a
playbook. They can be easily shared via
Ansible Galaxy
“import” is an improvement of “include” which
ensures that a file is added only once. This is
helpful when a line is run recursively
“include” is used to add a submodule or another file to
a playbook. This means a code written once can be
added to multiple playbooks
roles
include
import
What is the best way to make content reusable/ redistributable?
11
17. • Agent based installation
• Based on Ruby
• Configuration files written in
DSL
• Support for all popular OS’s
• Easy agentless installation
• Based on Python
• Configuration files written in
YAML
• No support for Windows
Ansible Puppet
How is Ansible different from Puppet?
12
18. Ansible Puppet
Architecture: Architecture:
How is Ansible different from Puppet?
12
Note for the instructor: Please explain the
architecture of Ansible and Puppet from the above
diagrams
20. Explain the architecture of Docker
• Docker uses a client-server architecture
Docker Daemon
Container
Docker Client
Build
Pull
Run
Registry
Docker Host
Images
Docker Server
Container
REST API
13
21. • Docker uses a client-server architecture
• Docker Client is a service which runs a
command. The command is translated using
REST API and is sent to the Docker Daemon
(server)
Docker Daemon
Container
Docker Client
Build
Pull
Run
Registry
Docker Host
Images
Docker Server
Container
REST API
Explain the architecture of Docker
13
22. • Docker uses a client-server architecture
• Docker Client is a service which runs a
command. The command is translated using
REST API and is sent to the Docker Daemon
(server)
• Docker Daemon accepts the request and
interacts with the operating system in order to
build Docker Images and run Docker
containers
Docker Daemon
Container
Docker Client
Build
Pull
Run
Registry
Docker Host
Images
Docker Server
Container
REST API
Explain the architecture of Docker
13
23. • Docker uses a client-server architecture
• Docker Client is a service which runs a
command. The command is translated using
REST API and is sent to the Docker Daemon
(server)
• Docker Daemon accepts the request and
interacts with the operating system in order to
build Docker Images and run Docker
containers
• A Docker Image is a template of instruction
which is used to create containers
Docker Daemon
Container
Docker Client
Build
Pull
Run
Registry
Docker Host
Images
Docker Server
Container
REST API
Explain the architecture of Docker
13
24. • Docker container is an executable package of
application and its dependencies together
Docker Daemon
Container
Docker Client
Build
Pull
Run
Registry
Docker Host
Images
Docker Server
Container
REST API
Explain the architecture of Docker
13
25. • Docker container is an executable package of
application and its dependencies together
• Docker registry is a service to host and
distribute Docker Images among usersDocker Daemon
Container
Docker Client
Build
Pull
Run
Registry
Docker Host
Images
Docker Server
Container
REST API
Explain the architecture of Docker
13
26. Criteria
What are the advantages of Docker over Virtual machine
Virtual Machine Docker
Occupies a lot of memory space
Long boot-up time
Running multiple virtual machines leads to
unstable performance
Difficult to scale up
Low efficiency
Memory space
Boot-up time
Performance
Scaling
Efficiency
Docker Containers occupy less space
Short boot-up time
Containers have a better performance as they
are hosted in a single Docker engine
Easy to scale up
High efficiency
14
Portability
Space allocation
Compatibility issues while porting across
different platforms
Data volumes cannot be shared
Easily portable across different platforms
Data volumes can be shared
and reused among multiple containers
27. How do we share Docker containers with different nodes?
• It is possible to share Docker containers on
different nodes by using Docker swarm
Manager node
Worker node1 Worker node2 Worker node3
Docker
Container
Docker Swarm
15
28. • It is possible to share Docker containers on
different nodes by using Docker swarm
• Docker swarm is a tool which allows IT
administrators and developers to create and
manage a cluster of swarm nodes within the
Docker platform
Manager node
Worker node1 Worker node2 Worker node3
Docker Swarm
Docker Platform
How do we share Docker containers with different nodes?
15
29. • It is possible to share Docker containers on
different nodes by using Docker swarm
• Docker swarm is a tool which allows IT
administrators and developers to create and
manage a cluster of swarm nodes within the
Docker platform
• A swarm consists of two types of nodes:
manager node and worker node
Manager node Worker node
How do we share Docker containers with different nodes?
15
30. What are the commands to create a Docker swarm?
• Create a swarm where you want to run your manager node
Docker swarm init --advertise-addr <MANAGER-IP>
16
31. • Create a swarm where you want to run your manager node
Docker swarm init --advertise-addr <MANAGER-IP>
• Once you’ve created a swarm on your manager node, you can add worker nodes to your swarm
What are the commands to create a Docker swarm?
16
32. • Create a swarm where you want to run your manager node
Docker swarm init --advertise-addr <MANAGER-IP>
• Once you’ve created a swarm on your manager node, you can add worker nodes to your swarm
• When a node is initialized as a manager node, it immediately creates a token. In order to create a worker
node, the following command (token) should be executed on the host machine of a worker node
Docker swarm join --token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-
8vxv8rssmk743ojnwacrr2e7c 192.168.99.100:2377
What are the commands to create a Docker swarm?
16
33. How to run multiple containers using a single service?
• It is possible to run multiple containers as a single service by using Docker compose
• Here, each container runs in isolation but can interact with each other
• All Docker Compose files are YAML files
{Containers Docker
Compose
17
34. • In Docker, Docker File is used for creating Docker Images using the build command
What is the use of a Dockerfile?
Note: Docker Image contains all the project’s code
Docker File
18
35. • In Docker, Docker File is used for creating Docker Images using the build command
• With Docker Image, any user can run the code in order to create Docker Containers
Docker File
Docker Container
Docker Image
What is the use of a Dockerfile?
18
36. • In Docker, Docker File is used for creating Docker Images using the build command
• With Docker Image, any user can run the code in order to create Docker Containers
• Once a Docker Image is built, it’s uploaded in a Docker registry
Docker File
Docker Container
Docker Image
Docker Hub
What is the use of a Dockerfile?
18
37. • In Docker, Docker File is used for creating Docker Images using the build command
• With Docker Image, any user can run the code in order to create Docker Containers
• Once a Docker Image is built, it’s uploaded in a Docker registry
• From the Docker Registry, users can get the Docker Image and build new containers whenever they want
Docker File
Docker Container
Docker Image
Docker Hub
Container
Container
What is the use of a Dockerfile?
18
38. Differences between Docker Image and Docker Container
Docker ContainerDocker Images
• Docker Images are templates of
Docker Containers
• An image is built using a Dockerfile
• It is stored in a Docker repository or a
Docker hub
• The image layer is a read only
filesystem
• Containers are runtime instances of
a Docker Image
• Containers are created using Docker
Images
• They are stored in the Docker
daemon
• Every container layer is a read-write
filesystem
19
39. Instead of YAML what can be an alternate file to build Docker compose
To build a Docker compose, a user can use a JSON file instead of YAML
In case a user wants to use a JSON file, he/she should specify the filename as given:
Docker-compose -f Docker-compose.json up
Command
20
40. How to create a Docker container?
Task: Create a MySQL Docker container
21
41. • Command to create a Docker container: Docker run -t –i MySQL
• Command to list down the running containers: Docker ps
Task: Create a MySQL Docker container
• A user can either build a Docker Image or pull an existing Docker Image (like MySQL) from Docker hub
• Now, Docker creates a new container MySQL from the existing Docker Image. Simultaneously, container
layer of read-write filesystem is also created on top of the Image layer
How to create a Docker container?
21
42. What is the difference between a Registry and a Repository
RepositoryRegistry
• Docker Registry is an open source server-
side service used for hosting and distributing
Docker Images
• Repository is a collection of multiple versions
of Docker Images
22
43. What is the difference between a Registry and a Repository
RepositoryRegistry
• Docker Registry is an open source server-
side service used for hosting and distributing
Docker Images
• In a Registry, a user can distinguish between
Docker Images with their tag names
• Repository is a collection of multiple versions
of Docker Images
• It is stored in Docker Registry
Note: A tag is a alphanumeric identifier attached to a image
22
44. RepositoryRegistry
• Docker Registry is an open source server-
side service used for hosting and distributing
Docker Images
• In a Registry, a user can distinguish between
Docker Images with their tag names
• Docker also has its own default registry
called Docker Hub
• Repository is a collection of multiple versions
of Docker Images
• It is stored in Docker Registry
• It has two types - Public and private
repositories
What is the difference between a Registry and a Repository
22
45. What are the Cloud platforms that support Docker?
Below are the Cloud platforms that Docker runs on:
Amazon Web Services
Microsoft Azure
Google Cloud Platform
Rackspace
23
46. What is the purpose of expose and publish command in Docker?
PublishExpose
• Expose is an instruction used in Dockerfile
• Publish is used in Docker run command
24
47. What is the purpose of expose and publish command in Docker?
PublishExpose
• Expose is an instruction used in Dockerfile
• It is used to expose ports within a Docker
network
• Publish is used in Docker run command
• It can be used outside a Docker environment
24
48. What is the purpose of expose and publish command in Docker?
PublishExpose
• Expose is an instruction used in Dockerfile
• It is used to expose ports within a Docker
network
• It is a documenting instruction used at the time
of building an image and running a container
• Publish is used in Docker run command
• It can be used outside a Docker environment
• It is used to map a host port to a running
container port
24
49. What is the purpose of expose and publish command in Docker?
PublishExpose
• Expose is an instruction used in Dockerfile
• It is used to expose ports within a Docker
network
• It is a documenting instruction used at the time
of building an image and running a container
• Expose is the command used in Docker
• Publish is used in Docker run command
• It can be used outside a Docker environment
• It is used to map a host port to a running
container port
• --publish or –p is the command used in
Docker
24
50. What is the purpose of expose and publish command in Docker?
Note: In case you do not use Expose or --publish, no ports will be exposed
PublishExpose
• Expose is an instruction used in Dockerfile
• It is used to expose ports within a Docker
network
• It is a documenting instruction used at the time
of building an image and running a container
• Expose is the command used in Docker
• Publish is used in Docker run command
• It can be used outside a Docker environment
• It is used to map a host port to a running
container port
• --publish or –p is the command used in
Docker
24
51. What is the purpose of expose and publish command in Docker?
PublishExpose
• Expose is an instruction used in Dockerfile
• It is used to expose ports within a Docker
network
• It is a documenting instruction used at the time
of building an image and running a container
• Expose is the command used in Docker
• Example: Expose 8080
• Publish is used in Docker run command
• It can be used outside a Docker environment
• It is used to map a host port to a running
container port
• --publish or –p is the command used in
Docker
• Example: docker run –d –p 0.0.0.80:80
24
53. How does Nagios help in continuous monitoring of systems, applications and services?
Nagios allows you to monitor the servers and check if they are being
sufficiently utilized or if there are any task failures that need to be addressed
Verifies the status of the servers and services
Inspects the health of your infrastructure
Checks if applications are working properly and
webservers are reachable
25
54. How does Nagios help in continuous monitoring of systems, applications and services?
Nagios Web
Interface (GUI)
Remote Resource
or Service
Remote Host
Nagios Process/Scheduler
Plugin Plugin
Load resource or
service
Nagios
executes
plugin
Plugin checks
the status and
sends results
Plugin sends results
to Nagios to process
Nagios Server
Notifies the admin about
the status processed by
the scheduler
Plugin sends results
to
Nagios to
process
25
Note for the instructor: Please explain the entire
architecture of Nagios from this diagram
55. What do you mean by Nagios Remote Plugin Executor (NPRE) of Nagios?
Nagios Remote Plugin Executor (NPRE) allows you to
execute Nagios plugins on Linux/Unix machines. You can
monitor remote machine metrics (disk usage, CPU load,
etc.)
NPRE add-ons consists of 2 pieces:
• The check_npre plugin that resides on the local monitoring machine
• The NPRE daemon that runs on the remote Linux/Unix machine
26
56. What are the port numbers used by Nagios for monitoring purpose?
Usually, Nagios uses the following port numbers for monitoring:
5666
5667
5668
27
57. What is active and passive checks in Nagios?
Nagios is capable of monitoring hosts and services in two ways:
• Actively
• Passively
28
Active checks are run on a regular scheduled basis
Active checks are initiated by the Nagios
process
Passive checks are initiated and performed by
external applications/processes
Passive checks results are submitted to Nagios for
processing
58. What is active and passive checks in Nagios?
Check Logic
Nagios Process
Plugins
Hosts and Services
External
Applications
External
command file
Check Logic
Nagios Process
External Command Logic
28
• Active checks are initiated by the check logic in the Nagios daemon
• Nagios will execute a plugin and pass information about what needs to
be checked
• The plugin will then check the operational state of the host or service
and report results back to the Nagios daemon
• It will process the results of the host or service check and send
notifications
• In passive checks, an external application checks the status of a host or
service
• It writes the results of the check to the external command file
• Nagios reads the external command file and places the results of all
passive checks into a queue for later processing
• Nagios may send out notifications, log alerts, etc. depending on the check
result information
59. Explain main configuration file and its location in Nagios.
It consists of a number of directives that affect how Nagios
operates. This config file is read by both the Nagios process
and the CGIs
Main Configuration file
/usr/local/Nagios/etc/resource.cfg
A sample main configuration file will be placed
into your settings directory
29
Note for the instructor: Please mention what does the
main configuration file contains
60. What is Nagios Network Analyzer?
Allows system admins to gather
high-level information on the health
of the network
Provides an in-depth look at all
network traffic sources and security
threats
30
Provides a central view of your
network traffic and bandwidth data
Allow you to be proactive in resolving
outages, abnormal behavior and
threats before they affect critical
business process
61. What are the benefits of HTTP and SSL certificate monitoring with Nagios?
HTTP certificate monitoring SSL certificate monitoring
• Increased server, services and application
availability
• Fast detection of network outages and protocol
failures
• Allows web transaction and web server
performance monitoring
• Increased website availability
• Frequent application availability
• Provides increased security
31
62. Explain virtualization with Nagios.
Nagios can be run on different virtualization platforms like VMware, Microsoft Visual PC, Xen,
Amazon EC2, etc.
Provides the capabilities to monitor an assortment
of metrics on different platforms
Ensures quick detection of service and application failures
Has the ability to monitor the following metrics:
• CPU Usage
• Memory
• Networking
• VM status
Reduced administrative overhead
32
VMware
Microsoft
Visual PC
Xen
Amazon
EC2
63. Name the three variables that affect recursion and inheritance in Nagios.
name
use
register
Template name that can be referenced in other object
definitions so it can inherit the object’s
properties/variables
Here, you specify the name of the template object that you
want to inherit properties/variables from
This variable indicates whether or not the object definition
should be registered with Nagios
define someobjecttype{
object-specific variables ….
name template_name
use name_of_template
register [0/1]
}
33
64. Why is Nagios said to be Object Oriented?
Using Object Configuration format, you can create object
definitions that inherit properties from other object definitions.
Hence Nagios is called as
Object Oriented
supports
Object Configuration format
1 Services
4 Time Periods
3 Commands
2 Hosts
Types of Objects:
.
.
.
34
65. Explain what is state stalking in Nagios.
State stalking
• State stalking is used for logging purposes in Nagios
• When stalking is enabled for a particular host or service, Nagios will watch that host or service very
carefully
• It will log any changes it sees in the output of check results
• This helps in the analysis of log files
35