DevOps Interview Questions
What command should you run to see all running container in Docker?
$ docker ps
What is the command to run the image as a container?
$ sudo docker run -i -t alpine /bin/bash
Write the command to stop the docker container
$ sudo docker stop container name
What are the steps for the Docker container life cycle?
- Build - Pull - Run
What are the features of Kubernetes?
-Automated Scheduling -Self-Healing Capabilities -Automated rollouts & rollback -Horizontal Scaling & Load Balancing -Offers environment consistency for development, testing, and production -Infrastructure is loosely coupled to each component can act as a separate unit -Provides a higher density of resource utilization -Offers enterprise-ready features -Application-centric management -Auto-scalable infrastructure -You can create predictable infrastructure
What is the difference between Git fetch and Git pull?
Git pull is common that pulls any new commits from a branch of the central repository to update the target branch. Git fetch pulls any new commits from only the desired branch and then stores them into a new brand of the local repository.
What is a merge conflict in Git, and how can it be resolved?
Merge conflicts occur when changes are made to a single file by multiple people at the same time. Due to this, Git won't be able to tell which of the multiple versions is the correct version. To resolve the conflicts, we should create a new Git repo, add a file, create a branch, make the edits and commit the changes. The next step is to merge the new branch into the master. Once this is done, Git clearly shows the differences in the different versions of the file and where the edits need to be made to remove the conflicts.
What is Minikube?
Minikube is a tool that makes it easy to run Kubernetes locally. This runs a single-node Kubernetes cluster inside a virtual machine.
Can you lose data when the container exits?
No, any data that your application writes to disk get stored in container. The file system for the contain persists even after the container halts.
What do you know about clusters in Kubernetes?
The Cluster IP is a Kubernetes service that offers a service inside the cluster that other apps inside cluster can access.
Explain the process of scaling your Docker containers
The Docker containers can be scaled to any level starting from a few hundred to even thousands or millions of containers. The only condition for this is that the containers need the memory and the OS at all times, and there should not be a constraint when the Docker is getting scaled.
What are the common instruction in Dockerfile?
The common instruction in Dockerfile are: FROM, LABEL, RUN, and CMD.
Can we move or copy Jenkins from one server to another?
Yes, we can move or copy the Jenkins from one server to other. For instance, by copying the Jenkins jobs directory can be moved from the older server to the new server. This way, installation can be moved from one installation to another by copying in the corresponding job directory.
What is Heapster?
discovers all nodes in the cluster and queries usage information from the Kubernetes nodes in the cluster, via on-machine Kubernetes agent.
What do you understand by a node in Kubernetes?
A node the smallest unit of hardware. It defines a single machine in a cluster that can be a virtual machine from a cloud provider or physical machine in the data center. Every machine available in the Kubernetes cluster can substitute other machines.
Explain Docker Architecture?
Docker Architecture consists of a Docker Engine which is a client-server application with three major components: - A server which is a type of long-running program called a daemon process (the docker command). - A REST API which specifies interfaces that programs can use to talk to the daemon and instruct it what to do. - A command line interface (CLI) client (the docker command). The CLI uses the Docker REST API to control or interact with the Docker daemon through scripting or direct CLI commands. Many other Docker applications use the underlying API and CLI.
What is Docker Swarm?
Docker Swarm is native clustering for Docker. It turns a pool of Docker hosts into a single, virtual Docker host. Docker Swarm serves the standard Docker API, any tool that already communicates with a Docker daemon can use Swarm to transparently scale to multiple hosts.
What is a Docker Container?
Docker containers are basically runtime instances of Docker images.
What is ETCD?
Etcd stores the configuration data of the Kubernetes cluster, representing the state of the cluster at any given point in time.
What is Google Container Engine?
Google Container Engine (GKE) is an open-source management platform for Docker containers and clusters. This Kubernetes based engine supports only those clusters which run within Google's public cloud services.
What is the difference between deploying applications on hosts and containers?
On hosts, you can have n number of applications and all the applications will share the libraries present in that operating system whereas while deploying applications in containers the architecture is a little different. In containers, the applications have the necessary libraries and binaries isolated from the rest of the system, and cannot be encroached by any other application.
Can you brief on the working of the master node in Kubernetes?
The master node is the first and most vital component which is responsible for the management of Kubernetes cluster. It is the entry point for all kinds of administrative tasks. There may be more than one master node in the cluster to check for fault tolerance.
What are the priorities in DevOps?
The priorities in DevOps include resource management, teamwork, and communication.
list various services available in Kubernetes
Various services available in Kubernetes are 1) Cluster IP service, 2) Load Balancer service, 3) Node Port service, 4) External Name Creation service.
What is virtualization?
Virtualization is a method of logically dividing mainframes to allow multiple applications to run simultaneously.
Explain Implementation method of Continuous Integration(CI) and Continues Development (CD) in Docker?
You need to do the following things: Runs Jenkins on docker You can run integration tests in Jenkins using docker-compose
What is a Headless Service?
enables you to directly reach the pods without the need of accessing it through a proxy.
Can you state and explain various key elements of continuous testing?
- Advanced analysis: Used for forecasting and predicting unknown future events - Policy analysis: Meant for improving the testing process - Requirement traceability: Refers to the ability to describe as well as follow the life of a requirement, from its origin to deployment - Risk assessment: The method or process of identifying hazards and risk factors that can cause potential damage - Service virtualization: Allows using virtual services instead of production services. Emulates software components for simple testing - Test optimization: Improve the overall testing process
What are the advantages of using Docker container?
- Offers an efficient and easy initial set up - Allows you to describe your application lifecycle in detail - Simple configuration and interacts with Docker Compose. - Documentation provides every bit of information.
What is a Dockerfile?
A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image. Using docker build, users can create an automated build that executes several command-line instructions in succession
What is the purpose of AWS in DevOps?
AWS services support the automation of manual tasks and processes that help developers build applications faster and more efficiently. These processes can be deployment, development, test workflows, configuration management and container management.
Which methodology is DevOps related to?
DevOps is related to Agile methodology.
How is Kubernetes related to Docker?
Docker builds the containers and these containers communicate with each other via Kubernetes. So, containers running on multiple hosts can be manually linked and orchestrated using Kubernetes.
What are federated clusters?
Federated clusters multiple clusters that are managed as a single cluster.
What is Git rebase?
Git rebase is a command which is designed to integrate the changes from one branch to another brand.
What is the difference between continuous testing and automation testing?
In continuous testing, the process of executing the automated test is part of the software delivery process. In contrast, automation testing is a process wherein the manual process of testing is applied wherein the separate testing tool helps the developers in creating test scripts that can be executed again and again without any kind of manual intervention.
What are the benefits of DevOps?
The varied benefits of DevOps include innovation, stability, functionality, and speed.
Tell us something about Docker Compose.
a YAML file which contains details about the services, networks, and volumes for setting up the Docker application. use Docker Compose to create separate containers, host them and get them to communicate with each other. Each container will expose a port for communicating with other containers.
What is the role of kube-apiserver and kube-scheduler?
- API Server: The API server acts as an entry point for all the REST commands used for controlling the cluster. - Scheduler: The scheduler schedules the tasks to the slave node. It stores the resource usage information for every slave node. It is responsible for distributing the workload.
Please explain the core operations of DevOps in terms of development and infrastructure.
- Application development: Developing a product that is able to meet all customer requirements and offers a remarkable level of quality - Code coverage: a measurement of the total number of blocks or lines or arcs of the code executed while the automated tests are running - Code developing: Prepare the codebase required for the product development - Configuration: Allowing the product to be used in an optimum way - Deployment : Installing the software to be used by the end-user - Orchestration: Arrangement of several automated tasks - Packaging: Activities involved when the release is ready for deployment - Provisioning: Ensuring that the infrastructure changes arrive just-in-time with the code that requires it - Unit testing: Meant for testing individual units or components
Why do we need DevOps?
- Increase deployment frequency - Lessen lead time between fixes - The lower failure rate of new releases - In case of new release crashing, have a faster mean time to recovery
What are the different advantages of Git?
- It helps in data redundancy and replication. - It is highly available. - It supports collaboration. - It can be used for a variety of projects. - It uses only one Git directory per repository. - It supports disk utilization. - It offers higher network performance.
In your opinion, what are the major benefits of implementing DevOps automation?
- Removal of the possibility of human error from the CD equation (Core benefit). - As tasks become more predictable and repeatable, it is easy to identify and correct when something goes wrong. Hence, it results in producing more reliable and robust systems. - Removes bottlenecks from the CI pipeline. It results in increased deployment frequency and decreased number of failed deployments. Both of them are important DevOps KPIs.
What are the ways to provide API-Security on Kubernetes?
- Using correct auth mode with API server authentication mode= Node. - Make kubeless that protects its API via authorization-mode=Webhook. - Ensure the kube-dashboard uses a restrictive RBAC (Role-Based Access Control) policy
What do you understand by a Version Control System (VCS)? Define its uses.
A Version Control System or VCS is a system that is capable of recording changes made to a file or a group of files over time. Git and Mercurial are two of the most popular version control systems. Important uses of a VCS are: - Check what was the last modification that caused a problem - Compare the changes made over time - Identifying who introduced a new issue and at what time - Revert a file or files to some earlier state - Revert the complete project to a previous state
Can you tell us the fundamental differences between DevOps & Agile?
Agile Approach - The agile approach is only meant for development in Agile while the agile approach is meant for both development and operations in DevOps. Practices and Processes - While agile involves practices such as Agile Scrum and Agile Kanban, DevOps involves processes such as CD (Continuous Delivery), CI (Continuous Integration), and CT (Continuous Testing). Priority - Agile prioritizes timeliness whereas, DevOps gives equal priority to timeliness and quality. Release Cycles - DevOps offers smaller release cycles with immediate feedback while Agile offers only smaller release cycles without immediate feedback. Feedback Source - Agile relies on feedback from customers while feedback from self (monitoring tools) is involved in DevOps. Scope of Work - For Agile, the scope of work is agility only but for DevOps, it is agility and the need for automation.
Can you name some of the most-used DevOps tools?
Ansible - A configuration management and application deployment tool Chef - A configuration management and application deployment tool Docker - A containerization tool Git - A version control system (VCS) tool Jenkins - A continuous integration (CI) tool Jira - An agile team collaboration tool Nagios - A continuous monitoring tool Puppet - A configuration management and application deployment tool Selenium - A continuous testing (CT) tool
What is the difference between a replica set and replication controller?
Both of them ensure that a specified number of pod replicas are running at any given time. The difference comes with the usage of selectors to replicate pods. Replica Set use Set-Based selectors while replication controllers use Equity-Based selectors. - Equity-Based Selectors: This type of selector allows filtering by label key and values. So, in layman terms, the equity-based selector will only look for the pods which will have the exact same phrase as that of the label.Example: Suppose your label key says app=nginx, then, with this selector, you can only look for those pods with label app equal to nginx. - Selector-Based Selectors: This type of selector allows filtering keys according to a set of values. So, in other words, the selector based selector will look for pods whose label has been mentioned in the set.Example: Say your label key says app in (nginx, NPS, Apache). Then, with this selector, if your app is equal to any of nginx, NPS, or Apache, then the selector will take it as a true result.
What are the important business and technical benefits of using DevOps?
Business benefits - Enhanced operating environment stability - Faster delivery of features - More time for adding value to the product Technical benefits - Continuous software delivery - Faster problem resolution - Lesser complex problems
How can you run multiple containers using a single service?
By using docker-compose, you can run multiple containers using a single service. All docker-compose files uses yaml language.
DevOps has something called CI. What is it and what is its purpose?
CI in DevOps stands for Continuous Integration. CI is a development practice in which developers integrate code into a shared repository multiple times in a single day. Continuous Integration of development and testing enhances the quality of the software as well as reducing the total time required for delivery.
How do I run multiple copies of Compose file on the same host?
Compose uses the project name which allows you to create unique identifiers for all of a project's containers and other resources. To run multiple copies of a project, set a custom project name using the -a command-line option or using COMPOSE_PROJECT_NAME environment variable.
What is the purpose of configuration management in DevOps?
Configuration management helps in automating tasks that are otherwise time-consuming and tedious and enhances an organization's agility. It brings consistency and improves the process of a product/service by streamlining design, documentation, control, and implementation of changes during various phases of the project.
What do you understand by containers?
Containers are a form of lightweight virtualization that help in providing isolation among processes.
Difference between virtualization and containerization
Containers provide an isolated environment for running the application. The entire user space is explicitly dedicated to the application. Any changes made inside the container is never reflected on the host or even other containers running on the same host. Containers are an abstraction of the application layer. Each container is a different application. Whereas in Virtualization, hypervisors provide an entire virtual machine to the guest(including Kernal). Virtual machines are an abstraction of the hardware layer. Each VM is a physical machine.
What is continuous integration?
Continuous integration, also known as a continuous delivery pipeline, includes functions of build, deploy, test, and release. It is a time-saving feature and builds jobs that are integrated and chain into a particular sequence.
What is the basic premise of DevOps?
DevOps is a cultural shift wherein a collaboration and operation teams work together throughout the product or service life cycle.
What is DevOps?
DevOps is the value-added practice wherein the development, as well as operation engineers, work together from the initial point of designing a product to deployment in the markets.
What is Docker Hub?
Docker hub is a cloud-based registry that which helps you to link to code repositories. It allows you to build, test, store your image in Docker cloud. You can also deploy the image to your host with the help of Docker hub.
What are Docker Images?
Docker images are used to create containers. When a user runs a Docker image, an instance of a container is created. These docker images can be deployed to any Docker environment.
What is Docker?
Docker is a containerization platform which packages your application and all its dependencies together in the form of containers so as to ensure that your application works seamlessly in any environment, be it development, test or production. This guarantees that the software will always run the same, regardless of its environment.
How is Git rebase different from Git merge?
Git rebase is different from Git merge because, in the case of Git rebase, the feature branch is transferred to the master branch's ending point. However, in the case of Git merge, the merging adds to a new commit in the history wherein history does not change, but the master branch is changed.
What is git stash?
Git stash command is used to save the changes temporarily in the working directory. This gives developers a clean directory to work on. They can later merge the changes in the git workflow. If this command is used, the changes in the tracked files are merged in the working directory. Git stash command can be used many times in the git directory. It is used as git stash
What is Jenkins Pipeline?
Jenkins pipeline is a suite of plugins that supports the implementation and integration of Jenkins's continuous delivery pipeline.
What do you understand by Kube-proxy?
Kube-proxy is an implementation of both a network proxy and a load balancer. It is used to support service abstraction used with other networking operations. It is responsible for directing traffic to the container depend on IP and the port number.
What is Kubectl?
Kubectl is the platform using which you can pass commands to the cluster. So, it basically provides the CLI to run commands against the Kubernetes cluster with various ways to create and manage the Kubernetes component.
What is Kubernetes?
Kubernetes is an open-source container management tool that holds the responsibilities of container deployment, scaling & descaling of containers & load balancing. Being Google's brainchild,
How does Kubernetes simplify containerized Deployment?
Kubernetes is cloud-agnostic and can run on any public/private providers it must be your choice simplify containerized deployment by load balance, scale & monitor the containers.
What is a Docker Namespace?
Namespace adds a layer of isolation in containers. Docker provides various namespaces in order to stay portable and not affect the underlying host system. Few namespace types supported by Docker - PID, Mount, IPC, User, Network
What are the different phases in DevOps?
Planning Planning and software development is the first phase of the DevOps lifecycle. This phase involves understanding the project properly for the ultimate work goal of its participants. This also feeds the various phases of development and operations. It's also important that organizations are trained on tools and metrics to have enough clarity of the project's management. 2. Development In this phase, the project gets built by designing infrastructure, writing codes, defining tests, or by automation process. Evidence is important in this phase. In managing applications, operations with data, developers store codes in code manager, which allows viewing, versioning, and much more. 3. Continuous Integration This phase automates the mechanism of validation, testing. This has a unique feature that ensures the development environment is properly and then published in a service that integrates it with the remaining applications. 4. Automated Deployment DevOps stimulates the automation of deployments by tools and scripts with the ultimate goal of solving the whole process with the activation of a feature. The most important aspect of this phase is the arrival of the cloud, as a code that forces a change from finite infrastructure management to permanent cost optimization management. 5. Operations Usually, all operations related to DevOps happen continuously throughout the life of software, as there is a dynamic change in the infrastructure. This platform provides opportunities for transformation, availability, and scalability. 6. Monitoring This phase is a permanent phase of the DevOps process. DevOps monitors and analyzes information that displays the current status of the application.
What is Selenium used for?
Selenium is used for continuous testing in DevOps. The tool specializes in functional and regression forms of testing.
What is Ingress network, and how does it work?
So, Ingress is an API object that manages external access to the services in a cluster, usually by HTTP and is the most powerful way of exposing service.
What do you understand by load balancer in Kubernetes?
The Internal Load Balancer automatically balances load and allocates the pods with the required configuration whereas the External Load Balancer directs the traffic from the external load to the backend pods.
What are the different components of Kubernetes Architecture?
The Kubernetes Architecture has mainly 2 components - the master node and the worker node. the master and the worker nodes have many inbuilt components within them. The master node has the kube-controller-manager, kube-apiserver, kube-scheduler, etcd. Whereas the worker node has kubelet and kube-proxy running on each node.
Define Kubernetes controller manager
The controller manager is a daemon used for garbage collection, core control loops, and namespace creation. It enables the running of more than one process on the master node.
What is Hypervisor?
The hypervisor allows you to create a virtual environment in which the guest virtual machines operate. It controls the guest systems and checks if the resources are allocated to the guests as necessary.
Microservices are a core part of DevOps. Can you name any two popular Java development frameworks for creating microservices?
There are several Java frameworks that allow creating microservices. However, Eclipse MicroProfile and Spring Boot stand out from the herd as the two leading Java development frameworks used in DevOps for creating microservices.
Git is a popular DevOps tool. Tell us how you will revert a commit that has already been pushed and made public.
There are two ways of doing so: - By creating a new commit to undo all changes made by the commit that has already been pushed and made public. Following command is used for doing so:git revert - By fixing or removing the bad file in a new commit and then pushing it to the remote repository. After making necessary changes to the file, commit it to the remote repository using the command:git commit -m "commit message"
What is Kubelet?
This is an agent service which runs on each node and enables the slave to communicate with the master. So, Kubelet works on the description of containers provided to it in the PodSpec and makes sure that the containers described in the PodSpec are healthy and running.
What are the benefits of using the Version Control System (VCS)?
With the Version Control System (VCS), all the workers are allowed to access the file freely at any time. It also allows merging all the changes that are made in a common version. It is designed to help multiple people by collaboratively edit text files, which makes sharing comparatively easy between multiple computers. It is important for documents that require a lot of redrafting and revision as they provide an audit trail for redrafting and updating final versions. It permits all the team members to have access to the complete history of the project so that in case of any breakdown in the central server, we can use any teammate's storehouse. All the previous versions and variants are smartly packed up inside the VCS. Any version is requested at any time to get information about the previous complete projects.
Can we handle merge conflict in Git?
Yes, we can handle merge conflict in the following three steps: Step 1: Developing a clear understanding by checking everything using Git status. Step 2: Mark and clean up the conflict by applying the merge tool. Step 3: Performing commit and merging with the current branch along with the master branch.
Can we make a new copy of an existing Jenkins job?
Yes, we can make a new copy of an existing Jenkins job by creating a clone of the directory in a different name.
Can we secure Jenkins?
Yes, we can secure Jenkins in the following ways: 1. Ensuring that global security is on 2. Checking if Jenkins is integrated 3. Making sure that the project matrix is enabled 4. Automating the process of setting up rights and privileges 5. Limiting physical access to Jenkins data 6. Applying security audits regularly
List out some important advanced docker commands
docker info: Information Command docker pull: Download an image docker stats: Container information Docker images: List of images downloaded
What is the command you need to give to push the new image to Docker registry?
docker push myorg/img
What is the method for creating a Docker container?
docker run -t -i command name also starts it
How to use JSON instead of YAML compose file?
docker-compose -f docker-compose.json up
What is Container Orchestration?
means all the services in individual containers working together to fulfill the needs of a single server.