Apponix Technologies
Master Programs
Career Career Career Career
DevOps Interview Question & Answers

Tops DevOps Interview Questions And Answer

DevOps Interview Questions and Answer Here are the top 50 interview questions and the tips in facing the interview.

1. Explain About The DevOps And Key Components Of DevOps?

DevOps is the combination of people, practices, and tools that increase an organization’s ability to deliver services and applications at high velocity. DevOps is the technology that covers the gap between the development and operations teams of an undertaking.

The most important components of DevOps are as follows:  An Agile framework  Automated Testing  Configuration Management  Regular Integration  Infrastructure as code

2. Explain The Different Phases In DevOps?

Phases of a DevOps Pipeline are:
Continuous Development:
The first and important phase of Phases of a DevOps Pipeline is to plan Application. First, finalize the objectives of the application and carry out the project development. This phase includes generating the required code and then putting it to the next phase.

Continuous Integration The Continuous Integration phase is a process that occurs after the development. The integration process includes the various activities like planning the different tests that are going to be carried out in the upcoming phases and it also includes the understanding of whether the developed code can produce the expected operation as required in the initial project development plan.

Continuous Testing Beta testers or consumers can produce results while still ensuring that the application can have its intended use in a live and production environment. The testing provides further information about different aspects of the application, which in turn, can again be sent to the first phase (development process) to improve the working and quality of the application.

Continuous Monitoring The actual Continuous Monitoring phase is the Operational phase in DevOps. In this phase key information about the use of the application will be recorded and processed to identify problem areas and to find out the trends.

Continuous Feedback The application development is consistently improved by analyzing the results from the operations and working of the Application. This is carried out by placing the important phase of continuous feedback between the development and the operation of the next version of the current software application.

3. What Is The Difference Between Continuous Deployment And Continuous Delivery?

Continuous Deployment: Continuous deployment means that every change that we make to the application, goes through the pipeline, and if it passes all the required tests, it gets deployed into production

Continuous Delivery: Continuous Delivery is a software development practice where you build the application in such a way that the application can be released to the production at any time and any supported platform.

4. What Is Source Code Management? Explain The Advantages Of Source Code Management.

Source Code Management is a process through which we can store and manage any code and is also used to track modifications to a source code repository. SCM is synonymous with Version control.

Advantages:  SCM helps in achieve every change and teamwork.  SCM helps in reducing a team’s communication overhead and an increase in release velocity  SCM acts like a bridge between offshore and onshore teams  SCM allows to work on different features of the same project simultaneously  SCM helps in tracking minute level changes as well

5. Name the source code management tools available in the market?

The most preferred and most popular open-source source code management tools available in the market are:  CVS  SVN or Subversion  GIT  Mercurial  Clear case.

6. Explain The Difference Between Distributed And Centralized Version Control System (VCS)

Centralized Version control systems keep the history of changes on a central server from which everyone requests the latest version of the work and pushes the latest changes to Examples of Centralized VCS are: CVS, SVN, Perforce

In a Distributed Version Control System, everyone in the team has a local copy of the work history. This means that is not necessary to be online to add changes to the work or change revisions Examples of Distributed VCS are: GIT, Mercurial

7. Explain What Is ‘Snapshot’ In Git

A snapshot in Git is a backup copy of each version Git stores in a repository and it’s an incremental backup copy. And are synonymous with “commits”. The git commit command captures a snapshot of the currently staged changes in the project.

8. Differentiate Between Git Clone And Git Pull

Both Commands are used to get the changes from the central repository. If the user wish to have a whole central repository in a local server, a user should go with Git Clone – this commands lets you have an entire repository on a local server. After that user might need only changes in the repository instead of the whole repository, then the user should go with Git pull – this command gets only new changes from the central repository

9.How Do You Download Any Repository From GitHub To Your Local Machine?

When a user creates a repository on GitHub, it exists and called a remote repository. User can clone the repository to create a local copy on local machine and sync between the two locations  Cloning a repository using the command line(Linux)  Github, navigate to the main page of the repository  Below the repository name, click Clone or download  To clone the repository there are two options  To clone using HTTPS, Click on Clone with HTTPs  To Clone the repository using an SSH key, Click on Use SSH  Open a terminal in the local server and change the current working directory to the location where the user wants to clone the repository  Use Git Clone command with the URL, copied from the previous step.  Git Clone  It creates the local clone.  git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY  Cloning into `Apponix-RR`...  remote: Counting objects: 10, done.  : Compressing objects: 100% (8/8), done.  remove: Total 10 (), reused 10 ()  Unpacking objects: 100% (10/10), done.

10. What Is The Git Command To Push A File From Your Local Machine To The GitHub Repository Using Git

The Git push command is used to transfer the commit or the changes, which is made on a local branch in your local machine to a remote repository like GitHub. The command used for pushing to GitHub is as follows. Git push 'remote_name' 'branch_name'

11. Explain The Difference Between Git Rebase And Git Merge

Rebasing and Merging are two options to apply changes from one branch into another one and they both will produce the same result at the end.

Git Rebase: Git rebase gets all unique commits from both branch1 and branch2 and applies them one by one and Git Rebase rewrites commit history but they don’t create an extra commit for merging

Git Merge: Git Merge command applies all unique commits from branch 1 into branch 2 in one commit with final results and Git merge doesn’t rewrite commit history, they just add one new commit.

12. Explain Git Hook/ Webhooks

Webhooks allow you to set up or build integrations, such as GitHub Apps or OAuth Apps, which subscribe to certain events on GitHub.com. Hooks are scripts to put some restrictions.

There are mainly two different types of hooks. Pre-commit hooks Post Commit hooks

Pre-Commit Hooks: Sometimes it is required to follow certain patterns while giving commit messages by every team member then only it will allow the team members to commit. These types of restrictions are called pre-commit hooks.

Post-Commit Hooks: Being a manager, sometimes it is required to get an email notification regarding every commit that occurs in a central repository. These kinds of notions are called post-commit hooks.

13. What Are The Advantages Of The Configuration Management Tool?

Configuration management is the method of automating most of the administration tasks. Every detail of a system is called configuration details. System administrators used to manage the configuration of machines using manual methods but now DevOps engineers automated the process of managing the configuration using some tools. Those tools are called Configuration Management tools.

Examples of Configuration management tools are Ansible, Terraform, Puppet, chef, Salt stalk, AWS Opswork, Etc.,

Advantages of Configuration management tools are:  Easy and Quick Provisioning of New Servers  Version Control for the Server Environment  Replicated Environments  Disaster Recovery  Uptime and Site Reliability

14. Which Is The CLI Commands Can Be Used To Rename Files In GIT Open Terminal (Linux)

Change the current working directory to the local repository on your system.

Rename the file, specifying the new name and the old name you'd like to give the file. This will create the stage of your change for commit.

$ git mv old_file_namenew_file_name Use the following git status command to check the old and new file names.

$ git status > # On branch your-branch > # Changes to be committed: > # ( "git reset HEAD ...")use this to unstage > # renamed: old_file_name ->new_file_name > # Commit the file that you've staged in the local repository of your system.

$ git commit -m "Renaming a file" Push the changes in the local repository of your system to GitHub. $ git push origin your-branch

15. What Are The Differences Between Git Pull And Git Fetch

Git Pull and Git Fetch are two most used and important commands in Git.

Git fetch Git fetch is the command to bring the changes from a central repository to a local repository. But those changes will not be integrated to the local repository which is there in the local server. Use Git fetch command at any time to update the remote-tracking branches.

Git Pull Git pull command gets the changes from the central repository. Internally two commands will get executed with this command (Git fetch and Git merge). So, Git Pull is the combination of Git Merge and Git pull

16. How Can We Resolve The Merge Conflict In Git? Explain.

An Essential feature of Git is the ability for multiple developers to work on the same project, at the same time, without interfering with each other. When the user wants to bring the changes in a branch into another’s current branch, you use a git merge command. The merge takes all the changes in the other branch and applies them to the current branch. Sometimes two developers will change the same line of code in two different ways; in such a case a developer will see the error during a Git merge

Below are the methods to resolve the merge conflict. Method 1:Using the WEB UI on GitHub Method 2:Using the Command Line Method 3:Using the GitHub Desktop App

17. About The Master-Slave Architecture Of Jenkins

Jenkins is a continuous integration tool that can be used to build and test your application continuously making it easier for developers to integrate changes to the project making users obtain a fresh build.

Jenkins works on the master-slave architecture that is many slaves work for a master.

main Jenkins server will be the master machine. Below are the tasks performed by the master:

Jenkins Master  Scheduling build jobs.  Monitor the slaves.  Dispatching builds to the different slaves for the execution.  It can also execute build jobs directly.  Recording and presenting the build results.

Jenkins Slave A Jenkins slave is a Java executable that runs on a remote machine. The features of the slave are :  It will get requests from the Jenkins master instance.  Slaves can run on a variety of operating systems like Linux windows etc.,  The job of a Slave is to do as they are told by a master, which involves executing build jobs dispatched by the Master server  We can configure a project to simply let Jenkins pick the next available Slave or to always run on a particular Slave machine or a particular type of Slave machine

18. Explain The Jenkins File

Jenkinsfile is a text file that contains the definition of a Jenkins Pipeline.Jenkinsfiles are written on domain-specific language based on the Groovy programming language. These are files that model delivery pipelines “as code”, containing the complete set of steps (steps, nodes, and stages) necessary to define the application life-cycle.

19. What Are The Two Types Of Pipeline In Jenkins, Along With Their Syntax?

A Jenkins pipeline can be written using 2 types: Declarative
Scripted
Declarative
pipeline { agent any stages { stage(‘Build’) { steps { //… } }
stage (‘Test’) { steps { //… } } } }
Scripted
node { stage (‘Build’ { //... } stage (‘Test’) { //... } }

20. What Are The Ways To Migrate Jenkins From One Server To Another?

Migration of the Jenkins server can be done using below way:

Option 1: Copy jobs directory
copy a job from one installation of Jenkins to another by copying the corresponding job directory.
create a copy of an existing job by making a clone of a job directory by a different job name.
Rename an existing job by renaming a directory. Note that if you change a job name you will need to change any other job that tries to call the renamed job.

Option 2: Try the plugins Job Importer plugin

Option 3: Use Jenkins CLI

21. What Are The Different Components Of Selenium?

Selenium is not a single tool but a suite of tools and its an automation testing tool used to test web-based applications. The different components of selenium are:
i. Selenium IDE (Integrated Development Environment).
ii. Selenium RC(Remote Control)
iii. Selenium WebDriver
iv. Selenium Grid

22. Explain The Different Exception In Selenium Web Driver

The exception is a standard word used by programmers and exceptions are due to which java program ends abruptly without producing the expected result.

Below are the 10 common exceptions in selenium web driver

 i. ElementNotSelectableException
ii. ElementNotVisibleException
iii. NoSuchFrameException
iv. NoSuchElementException
v. NoSuchWindowException
vi. SessionNotFoundException
vii. TimeoutException
viii.ConnectionClosedException
ix. WebDriverException
x. ElementNotInteractableException

23. Explain The Different Test Types That Selenium Supports

For web-based application, selenium testing can be used The test types that selenium supports are i. Functional ii. Regression

24. Explain The Working Of Chef With Architecture

Chef works based on a three-tier client-server model. Here working units are known as cookbooks and that are developed on the chef workstation. By using command-line utilities like a knife they are uploaded to the Chef server and all the other nodes which are showing in the architecture are registered with the Chef server.

25. Explain The Chef Cookbooks

Cookbooks are working units of Chef, which includes all the details related to working units. Cookbooks can perform multiple tasks and it also contains values about the desired state of a node

Key components of a Cookbook are:  

  •  Recipes
  •  Metadata
  •  Attributes
  •  Resources
  •  Templates
  •  Libraries

26.How Do You Deploy A Web Server By Using Chef

Below are the ways to make the server as the webserver, user need to follow the below steps:  

  •  Install web package (httpd).
  •  Create an empty file and put some web content.
  •  Start httpd service
  •  create the recipe inside the cookbook and write a ruby script which includes above 3 things then run the recipe.
  •  Once you run the recipe successfully the server became a web server.

Implementation Steps Are As Follows:  

  •  Connect To Linux Instance “Workstation” Through Putty.
  •  Switch To The Root User.
  •  Create A New Cookbook And Name It As “Ktexperts-Apache-Cookbook”.
  •  Create A New Recipe And Name It As “Ktexperts-Apache-Recipe”.
  •  To The Cookbooks Directory.
  •  Open The Recipe “Ktexperts-Apache-Recipe.Rb” And Write An Apache Webserver Script In It.
  •  Execute The Recipe Or Call Chef-Client.
  •  Copy Public IP From The Console And Check It In The Browser.
  •  Modify Recipe “Ktexperts-Apache-Recipe”
  •  Execute The Recipe Or Call Chef-Client.
  •  Refresh IPV4 Public IP In The Browser.

27. What Is Docker File How Do You Write A DockerFile

A Dockerfile is a text file that has a list of instructions on how to build a docker image. It consists of a simple set of commands that you need to use in your Dockerfile. There are several commands like FROM, CMD, ENTRYPOINT, VOLUME, ENV, and more.

Open any text editor and create the first DockerFile as shown as below:
FROM Ubuntu: latest
MAINTAINER Apponix (apponix@domain.com)

28. Explain Docker And What Are The Benefits Of Docker

Docker is the methodology or tool create, deploy, and run applications by using containers, and containers allow a user to package up their application with all the requirements, such as libraries and other dependencies and ship it all out as one single package.

29. Write The Sample Docker File And Explain

  • FROM tomcat:8.0-alpine
  • LABEL maintainer="apponix@apponix.com"
  • ADD apponix.war /usr/local/tomcat/webapps/
  • EXPOSE 8080
  • CMD ["catalina.sh", "run"]  The FROM instruction initializes a new build stage and sets the Base Image for the next instructions.
  •  The LABEL instruction sets the Author's name of the generated images. It can be any key-value pair in labels.
  •  The ADD instruction copies directories, files, or remote file URLs from and adds them to the filesystem of the image at the path.
  •  The EXPOSE instruction tells Docker that the container should listen on the specified network ports at runtime.
  •  The CMD instruction informs what to run when the container is run.

30. Explain The Port Mapping In Docker.

If any user wants to make any container as a web server by installing a web package on it. To access the website which is running inside the container, the user has to provide the public IP. But Docker containers will not have an IP address. To resolve this issue, Docker came with a solution called Docker Port Mapping. The user has to map the host port to the public IP of the host machine. Then the user’s request will be routed from the host port to the container’s port.

31. What Is Kubectl?

Kubectl controls the Kubernetes cluster manager.
Kubectl is a command-line tool for controlling clusters created by Kubernetes
Below is the syntax to run Kubectl commands from the terminal:
kubectl [command] [TYPE] [NAME] [flags]

 Specifies the operation that we want to perform on one or more resources, for example, get, describe, create, delete
 TYPE: Specifies the resource type.example: pod, nodes
 NAME: Specifies the name of the resource you want to use and these names are case sensitive
 FLAGS: Specifies flags that are optional. We can use –server or –s flags. These flags are to specify the address and port of the Kubernetes API server.

32. Explain Namespace In Kubernetes

Namespaces are Kubernetes objects which partition a single Kubernetes into many virtual clusters By default, there are three namespaces created in a cluster  Default

  •  Kube-system,
  •  Kube-public.

33. Explain Containers

A container is a standard unit of software that packages up code and all its dependencies so the application runs reliably and quickly from one computing environment to another.Containers can include a base operating system, libraries, files and folders, environment variables, volume mount-points, and application binaries.

34. Differentiate Between Docker Swarm And Kubernetes

  • Kubernetes and Docker swarm both are open-source orchestration platforms provide much of the similar functionalities
  • Kubernetes: An application can be deployed in Kubernetes utilizing a combination of pods services (or microservices), and deployments
  • Docker Swarm: An application can be deployed as services or micro-services in a swarm cluster in Docker Swarm. YAML files can be utilized to identify multi-container. Moreover, Docker compose can install the application.
  • Installation & Cluster Configuration
  • Kubernetes: Installation is complicated; but once set up, the cluster is very strong Docker swarm: Installation is very simple, but the cluster is not very strong
  • Graphical User Interface
  • Kubernetes: Kubernetes dashboard is available Docker swarm: GUI is not available Scalability
  • Kubernetes: scales fast and Highly scalable Docker swarm: scales 5x faster than Kubernetes and highly scalable Auto-Scaling
  • Kubernetes:Autoscaling can be done in Kubernetes Docker swarm: Docker Swarm cannot do auto-scaling

35. Explain The Advantages Of Docker

Below are the advantages of Docker are:  Containerization (No need of Guest OS)

  •  Cost
  •  No pre-allocation of RAM
  •  Can easily run on Cloud/Virtual/physical servers
  •  Less time is required to create containers
  •  Replication is Easy

36. What Is The Registry Server In Docker? Explain

Registry servers are own docker hub created to store private docker images instead of having it in public docker hub. Registry servers can be created from the registry image provided by Docker. Users can store n no of private docker images in the registry servers.

37.Explain The Benefits Of Ansible

The benefits of Ansible are: 

  •  Free – Ansible is an open-source tool
  •  Setting up ansible is very simple. no exceptional skills in coding are required to work on Ansible
  •  Efficient: No additional software is required for installation
  •  Agentless: Without the use of any additional software, the clients can easily automate their system using Ansible
  •  Extensible – Depending on the automation and networking needs of the users, Ansible can easily offer extensions

38. What Are Ad-Hoc Commands In Ansible?

Ad-hoc commands are one-liner ansible commands that perform the task on target nodes. Ad-hoc commands will have only two parameters A group of a host that we want to perform the tasks An ansible module to run

39. Why Do You Use Dry Run In Ansible?

A dry run is to test the working of the playbook. Before executing the playbook on production nodes, the user can test the working of the playbook. Dry run won't execute and make changes but is shows the executed outputs in the terminal. These Dry runs help in understanding how the playbook is going to behave without running the tasks.

40. Explain Ansible Vault

Ansible Vault is useful to store the confidential data and also use it to encrypt variable files. Vault can encrypt any YAML files but most used common files to encrypt are: Files in the group_vars directory
i. A role's defaults/main.yml file
ii. A role's vars/main.yml file
iii. Any other file which is used to store variables.

41. Write A Sample Playbook To Install Any Package And Explain Here Is The Playbook To Install Nginx.

Name: Install nginx
hosts: host.name.ip
become: true
tasks:


Name: Add epel-release repo
yum:
name: epel-release
state: present


Name: Install nginx
yum:
name: nginx
state: present


Name: Insert Index Page
template:
src: index.html
dest: /usr/share/nginx/html/index.html


Name: Start NGiNX
service:


Name: Nginx
state: started
Playbook starts with --- (YAML) and followed by Name, Host, become statements and tasks.


Name: This is to identify the playbook’s purpose
Host: Host is like controller and identifies the target for Ansible to run
Become statements: (It is optional) To make sure it is having enough permission to run the playbook

42. What Is Nagios And Why Do We Have To Use It?.

Nagios is a free, open-source Network Monitoring Tool which can be installed either in a Linux system and configure plugins and database or in FAN (Fully Automated Nagios), a preconfigured ISO and install it as a virtual or physical server. Uses Monitoring of networks, servers, and applications. To configure alerts and generate reports of the servers and services

43. What Is The Command To Stop And Restart The Docker Container?

  • Command: docker container restart
  • Description: To restart one or more containers
  • Command: docker container stop
  • Description: To stop one or more running containers
  • Command to stop a container:
  • docker stop [OPTIONS] CONTAINER [CONTAINER...]
  • Command to restart a container:
  • docker container restart [OPTIONS] CONTAINER [CONTAINER...]

44. Explain The Difference Between Cookbook And Recipe In Chef Chef Recipes Are Ruby Scripts Which Could Be Executed By Chef-Client Whereas Certain Directory Structure Is Followed By Chef Cookbook.

Chef cookbooks could contain various chef recipes. We cannot run the chef cookbook but we can run the chef recipe. To run any chef recipe, we need to call cookbook_name::recipe_name

45) How DevOps Is Different From Agile / SDLC?

 

DevOps Agile
DevOps helps in managing end to end engineering processes Agile helps in managing complex projects
DevOps addresses gaps in developer and IT operations communications Agile addresses gaps in customer and developer communications
Team size is relatively large. Agile usually consists of a smaller team
Internal teams provide feedback Customer provides feedback
Development, testing and implementation are equally important Development of software is inherent

 

46. What Are The Different Types Of HTTP Requests?

  • GET
  • HEAD
  • POST
  • PUT
  • DELETE
  • TRACE
  • CONNECT

47. What Is The Purpose Of Running The Terraform Init Command?

The terraform init command is used for initializing a working directory which consists of Terraform configuration files. This should be the first command to run after writing a new Terraform configuration or after cloning an existing one from version control. This command can be run multiple times.

48. Explain The Benefits Of Automation Testing.

  • 70% faster when compared to manual testing.
  • Powerful test reports which help in analyzing hundreds of test cases easily.
  • Testing can be performed parallelly on multiple platforms
  • Reduction in costs and increase in manpower utilization
  • Maximum return on investment (ROI)
  • Testing can be scaled up easily
  • Better accuracy and increase inefficiency.
  • Consistent and reliable results.

49. Explain The Roles And Responsibilities Of DevOps Engineer

DevOps Evangelist: The principal leader who is responsible for implementing DevOps. Release Manager: Responsible for new feature release and stability of product post-release. Automation Expert: The one responsible for the orchestration of tools and achieving automation. Software developer/tester: Engineer who develops and tests the code Quality Assurance: The guy responsible for ensuring that product quality conforms with customer requirements. Security Engineer: One responsible for keeping the product’s security and health in check.

50. What Is The Purpose Of Running The Terraform Init Command?

terraform init - This command is used to initialize a working directory which contains Terraform configuration files. This is the first command that should be run after cloning an existing one from version control or writing a new Terraform configuration It is okay and safe to run this command multiple times

Few other interview questions:

  1. What are your future goals?
  2. What do are your interests outside of work?
  3. What could you offer to this job differently?
  4. How do you deal with pressure?
  5. Will you be ready if the job requires frequent travelling?
  6. What type of work environment do you prefer?

The key to acing any job interview is to make sure that all your answers are tailored to be in line with the company values, its goals and the specifics pertaining to the job you are applying for.

AWS Training in Bangalore

Most Popular Courses

Devops Certification Training || Google Coud Certification