Devops

40+ Devops Interview Questions and Answers

Updated 23 Sep 2024

Popular Companies

search-icon

Q1. How will you setup a microservice architecture application simple testing environment and deployment pipeline using kubernetes, containers, jenkins and available Cloud services.

Ans.

Setup microservice testing and deployment using Kubernetes, containers, Jenkins, and Cloud services.

  • Create a Kubernetes cluster on a Cloud provider

  • Build Docker containers for each microservice

  • Create a Jenkins pipeline for testing and deployment

  • Use Kubernetes to deploy and manage the containers

  • Use Cloud services for load balancing, monitoring, and scaling

Q2. How will you kill all java process in one command ?

Ans.

Use 'pkill' command with '-f' option to kill all java processes.

  • Open terminal or command prompt

  • Type 'pkill -f java' and press enter

  • All java processes will be terminated

Devops Interview Questions and Answers for Freshers

illustration image

Q3. How to run cmd commands using python on windows environment ?

Ans.

To run cmd commands using python on windows, use the subprocess module.

  • Import the subprocess module

  • Use the subprocess.run() method to execute the command

  • Pass the command as a list of strings to the run() method

  • Use the shell=True argument to run the command in a shell environment

  • Capture the output of the command using the stdout attribute of the returned CompletedProcess object

Q4. how do you delete last 30 days logs in tomcat by using shell script

Ans.

Deleting last 30 days logs in Tomcat using shell script

  • Use find command to locate files older than 30 days

  • Use xargs command to pass the file names to rm command

  • Use crontab to schedule the script to run periodically

Are these interview questions helpful?

Q5. What is difference between deep and shallow copy in python paradigm?

Ans.

Deep copy creates a new object with a new memory address while shallow copy creates a new object with the same memory address as the original object.

  • Deep copy creates a completely new object with a new memory address.

  • Shallow copy creates a new object with the same memory address as the original object.

  • In deep copy, changes made to the copied object do not affect the original object.

  • In shallow copy, changes made to the copied object affect the original object.

  • Deep copy is used...read more

Q6. Given a file with random content, could you find out all the phone numbers ?

Ans.

Yes, by using regular expressions to match phone number patterns.

  • Use regular expressions to match phone number patterns

  • Common phone number patterns include (XXX) XXX-XXXX and XXX-XXX-XXXX

  • Consider international phone number formats as well

  • Use a programming language with regex support, such as Python or JavaScript

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. what are the stages you regularly write in pipeline job in Jenkins

Ans.

Stages in pipeline job in Jenkins

  • Checkout code from version control system

  • Build the code

  • Run unit tests

  • Deploy to staging environment

  • Run integration tests

  • Deploy to production environment

  • Send notification email

Q8. When running DB instance as a Multi-AZ deployment, can I use the standby for read or write operation?

Ans.

Yes, the standby can be used for read operations but not for write operations.

  • In a Multi-AZ deployment, the primary DB instance handles write operations.

  • The standby DB instance can be used for read operations to offload the primary instance.

  • Read replicas can also be used for read operations in a Multi-AZ deployment.

Devops Jobs

Bamboo Devops Liquibase 4-6 years
Cognizant Technology Solutions India Ltd
3.8
Chennai
Devops sme 3-8 years
Reliance Jio Infocomm Ltd.
3.9
Mumbai
DevOps SRE 3-7 years
IBM India Pvt. Limited
4.1
Bangalore / Bengaluru

Q9. How will you monitor file change in linux ?

Ans.

Use inotifywait command to monitor file changes in Linux.

  • Install inotify-tools package

  • Use inotifywait command with options like -m for continuous monitoring and -e for specific events

  • Example: inotifywait -m /var/log/messages -e modify

  • Output will show the file path, event type and timestamp

Q10. Usecase for chef and why do you need it ?

Ans.

Chef is a configuration management tool used for automating infrastructure deployment and management.

  • Chef helps in automating the process of configuring and managing servers and applications.

  • It allows for consistent and repeatable infrastructure deployments.

  • Chef can be used to manage both on-premises and cloud-based infrastructure.

  • It provides a centralized platform for managing configurations and enforcing policies.

  • Chef can be integrated with other DevOps tools like Jenkins a...read more

Q11. How can you send email with attachment using powershell ?

Ans.

Send email with attachment using PowerShell

  • Use Send-MailMessage cmdlet

  • Specify recipient, subject, body and attachment parameters

  • Example: Send-MailMessage -To 'example@email.com' -Subject 'Test Email' -Body 'This is a test email' -Attachments 'C:\test.txt'

Q12. how you can identify which process cause your server got slow

Ans.

To identify the process causing server slowness, use monitoring tools and analyze system logs.

  • Use monitoring tools like Nagios, Zabbix, or Prometheus to track system performance metrics.

  • Analyze system logs to identify any errors or warnings related to specific processes.

  • Check CPU and memory usage of running processes using tools like top or htop.

  • Use profiling tools like strace or perf to identify resource-intensive processes.

  • Consider network traffic and disk I/O as potential ...read more

Q13. How would you optimise a given sql query ?

Ans.

Optimise SQL query by identifying bottlenecks and improving indexing and query structure.

  • Identify slow performing queries using profiling tools

  • Improve indexing by adding or removing indexes

  • Rewrite query structure to reduce complexity and improve performance

  • Use query optimisation techniques like subqueries and joins

  • Consider caching frequently accessed data

Q14. how do you configure ssl certification with tomcat

Ans.

SSL certification can be configured with Tomcat by generating a keystore file and configuring the server.xml file.

  • Generate a keystore file using keytool command

  • Configure the server.xml file to include the keystore file and password

  • Update the connector element in server.xml to include the SSL protocol and port number

  • Restart Tomcat to apply the changes

Q15. Ruby program to find out if a directory exists and you write permissions to it ?

Ans.

Ruby program to check directory existence and write permissions.

  • Use File.exist? method to check if directory exists.

  • Use File.writable? method to check if directory has write permissions.

  • Combine both methods to get the desired result.

Q16. What is a container and why is the use?

Ans.

A container is a lightweight, standalone executable package that contains everything needed to run an application.

  • Containers provide a consistent and reproducible environment for applications to run in.

  • They are isolated from the host system and other containers, providing security and portability.

  • Containers can be easily deployed and scaled, making them ideal for modern application development and deployment.

  • Examples of container technologies include Docker, Kubernetes, and O...read more

Q17. Write a docker file to setup Nginx and expose it with port 8080

Ans.

Dockerfile to setup Nginx and expose it with port 8080

  • Use the official Nginx image as the base image

  • Copy the custom Nginx configuration file to the container

  • Expose port 8080 in the Dockerfile

  • Start Nginx in the foreground using the CMD instruction

Q18. What is Kubernettes ?

Ans.

Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications.

  • Kubernetes is used to manage and automate the deployment of containerized applications.

  • It provides features like automatic scaling, load balancing, and self-healing.

  • Kubernetes allows for easy management of containers across multiple hosts and clusters.

  • It provides declarative configuration and efficient resource utilization.

  • Kubernet...read more

Q19. How to install IIS using powershell ?

Ans.

To install IIS using PowerShell, use the Install-WindowsFeature cmdlet.

  • Open PowerShell as an administrator

  • Run the command: Install-WindowsFeature -name Web-Server -IncludeManagementTools

  • Press 'Y' to confirm installation

  • Wait for the installation to complete

Q20. What is namespace in Docker ?

Ans.

Namespace in Docker is a way to isolate resources and avoid naming conflicts.

  • Namespaces provide a layer of isolation for containers

  • Each namespace has its own set of resources

  • Namespaces can be used for network, process, and mount isolation

  • Example: docker run --name mycontainer --net=container:othercontainer myimage

Q21. how to integrate Maven with jenkins

Ans.

Integrating Maven with Jenkins

  • Install Maven plugin in Jenkins

  • Configure Maven installation in Jenkins global tool configuration

  • Create a new Jenkins job and select Maven project

  • Specify the path to the pom.xml file in the project configuration

  • Configure build triggers and other settings as required

Q22. How does a linux boot ?

Ans.

Linux boot process involves several stages including BIOS, bootloader, kernel initialization, and user space initialization.

  • BIOS performs a power-on self-test and loads the bootloader from the boot device.

  • Bootloader loads the kernel into memory and initializes it.

  • Kernel initializes hardware, mounts the root file system, and starts the init process.

  • Init process starts user space processes and services.

  • Linux boot process can be customized by modifying bootloader configuration a...read more

Q23. What is a process in linux ?

Ans.

A process in Linux is a running instance of a program or command.

  • A process is identified by a unique process ID (PID)

  • Processes can be started, stopped, and managed using commands like ps, kill, and top

  • Processes can run in the foreground or background

  • Processes can communicate with each other through inter-process communication (IPC)

  • Examples of processes include web servers, database servers, and user applications

Q24. What is the difference between azure and AWS?

Ans.

Azure and AWS are cloud computing platforms with similar services, but differ in pricing, scalability, and integration.

  • Azure is more tightly integrated with Microsoft products, while AWS has a wider range of third-party integrations.

  • AWS has a larger market share and more mature services, while Azure is catching up quickly.

  • Azure offers more flexible pricing options, while AWS has a more complex pricing structure.

  • Azure has better support for hybrid cloud environments, while AWS...read more

Q25. What is Docker and its advantages . Which is the most secure docker image

Ans.

Docker is a containerization platform that allows developers to package and deploy applications in a portable manner.

  • Advantages include: faster deployment, improved scalability, reduced infrastructure costs, and increased consistency across environments.

  • The most secure Docker image is one that is regularly updated with security patches and has minimal dependencies.

  • Examples of secure Docker images include those from official repositories like Ubuntu, Alpine, and CentOS.

  • Additio...read more

Q26. What is the default monitoring time in aws cloud watch

Ans.

The default monitoring time in AWS CloudWatch is 5 minutes.

  • Default monitoring time in AWS CloudWatch is 5 minutes

  • Can be changed to 1 minute for detailed monitoring

  • Monitoring intervals can be adjusted based on requirements

Q27. How would you lead a DevOps team ?

Ans.

To lead a DevOps team, I would focus on communication, collaboration, and continuous improvement.

  • Establish clear goals and expectations for the team

  • Encourage open communication and collaboration between team members

  • Implement agile methodologies and continuous improvement processes

  • Provide opportunities for professional development and training

  • Ensure that the team has the necessary tools and resources to succeed

  • Lead by example and foster a culture of innovation and experimentat...read more

Q28. how DevOps helps in day to day activities of developers

Ans.

DevOps helps developers by streamlining processes, improving collaboration, and automating tasks.

  • DevOps promotes collaboration between development and operations teams, leading to faster feedback and problem resolution.

  • Automation tools in DevOps help developers streamline repetitive tasks like testing, deployment, and monitoring.

  • Continuous integration and continuous delivery (CI/CD) practices in DevOps help developers deliver code more frequently and reliably.

  • DevOps practices...read more

Q29. how will you create a jenkins pipeline for k8s application

Ans.

To create a Jenkins pipeline for a Kubernetes application, you need to define stages for building, testing, and deploying the application.

  • Define stages in the Jenkinsfile for building the Docker image, running tests, and deploying to Kubernetes.

  • Use Jenkins plugins like Kubernetes Continuous Deploy Plugin to interact with the Kubernetes cluster.

  • Set up credentials in Jenkins for accessing the Kubernetes cluster.

  • Use declarative syntax in the Jenkinsfile to define the pipeline st...read more

Q30. What is the uses of aws and azure?

Ans.

AWS and Azure are cloud computing platforms used for hosting, managing and deploying applications and services.

  • AWS provides a wide range of services including compute, storage, database, analytics, machine learning, and more.

  • Azure offers similar services as AWS but also has a strong focus on integration with Microsoft technologies.

  • Both platforms offer scalability, flexibility, and cost-effectiveness for businesses of all sizes.

  • Examples of companies using AWS include Netflix, ...read more

Q31. what are the git commands

Ans.

Git commands are used to manage version control of code repositories.

  • git init - initialize a new repository

  • git add - add changes to the staging area

  • git commit - commit changes to the repository

  • git push - push changes to a remote repository

  • git pull - pull changes from a remote repository

  • git clone - clone a remote repository

  • git branch - create, list, or delete branches

  • git merge - merge changes from one branch to another

  • git checkout - switch between branches or restore files

  • git ...read more

Q32. How to use deployment strategies in Kubernetes?

Ans.

Deployment strategies in Kubernetes help manage the rollout of new versions of applications.

  • Use Rolling Update strategy to gradually replace old Pods with new ones

  • Use Blue-Green Deployment strategy to switch traffic between two identical environments

  • Use Canary Deployment strategy to release new versions to a subset of users for testing

  • Use A/B Testing strategy to release multiple versions simultaneously and compare performance

Q33. explain dynamic inventory in ansible

Ans.

Dynamic inventory is a feature in Ansible that allows for automatic inventory updates based on external data sources.

  • Dynamic inventory can be configured to pull inventory information from sources such as cloud providers, configuration management databases, or custom scripts.

  • This allows for more flexible and scalable inventory management, as hosts can be added or removed automatically based on changes in the external data source.

  • Dynamic inventory can be configured using plugin...read more

Q34. difference between git merge and git rebase

Ans.

Git merge combines changes from different branches, while git rebase rewrites commit history by moving the current branch to the tip of another branch.

  • Git merge creates a new commit with the combined changes of the branches being merged.

  • Git rebase moves the current branch to the tip of another branch, replaying the commits on top of it.

  • Merge preserves the commit history of both branches, while rebase creates a linear history.

  • Rebase is useful for keeping a clean and linear com...read more

Q35. Right lambda function for RDS launch

Ans.

Lambda function to launch RDS

  • Use AWS Lambda to launch RDS instances

  • Create a Lambda function with appropriate permissions

  • Use AWS SDK to interact with RDS APIs

  • Configure the Lambda function to trigger on specific events

Q36. what is ci cd in jenking?

Ans.

CI/CD in Jenkins refers to continuous integration and continuous delivery/continuous deployment processes implemented using Jenkins automation server.

  • CI/CD stands for Continuous Integration/Continuous Delivery or Continuous Deployment.

  • In Jenkins, CI/CD involves automating the build, test, and deployment processes to deliver software more frequently and reliably.

  • Continuous Integration involves automatically building and testing code changes as they are committed to the reposit...read more

Q37. What do you know about viasat

Ans.

Viasat is a global communications company that provides satellite internet services and secure networking solutions.

  • Provides satellite internet services

  • Offers secure networking solutions

  • Operates globally

Q38. explain Jenkis pipeline job

Ans.

Jenkins pipeline job is a way to define a series of steps to be executed in a specific order.

  • Pipeline job is defined using a Jenkinsfile or a script in the Jenkins UI.

  • It consists of stages, which are a collection of steps.

  • Each step can be a shell command, a script, or a plugin.

  • Pipeline job can be triggered manually or automatically based on events.

  • It provides visibility into the entire build process and enables continuous delivery.

  • Example: Build -> Test -> Deploy -> Notify

Q39. how to solve merge conflicts

Ans.

Merge conflicts can be solved by resolving the conflicting changes, committing the resolved changes, and then pushing the changes to the repository.

  • Pull the latest changes from the remote repository

  • Locate the conflicting files and resolve the conflicts manually

  • Add the resolved files to the staging area

  • Commit the changes with a message explaining how the conflicts were resolved

  • Push the changes to the remote repository

Q40. Best practices for Docker file

Ans.

Best practices for Dockerfile include keeping it simple, using official images, and minimizing layers.

  • Use official images as base

  • Minimize layers to reduce image size

  • Avoid installing unnecessary packages

  • Use .dockerignore to exclude unnecessary files

  • Specify version numbers for packages

  • Use multi-stage builds for complex builds

  • Run only one process per container

  • Use environment variables for configuration

  • Keep the Dockerfile simple and readable

Q41. what is tf state files

Ans.

Tf state files are files generated by Terraform to store the state of your infrastructure.

  • Tf state files store information about the resources managed by Terraform

  • They help Terraform track the current state of your infrastructure

  • Tf state files should be stored securely to prevent unauthorized access

Q42. explain the architecture of kubernetes

Ans.

Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications.

  • Kubernetes follows a master-slave architecture with a master node and multiple worker nodes.

  • The master node controls the cluster and schedules workloads, while the worker nodes run the actual containers.

  • Each worker node has a kubelet agent that communicates with the master node.

  • Kubernetes uses etcd as a distributed key-value store ...read more

Q43. What is kubernetes?

Ans.

Kubernetes is an open-source container orchestration platform for automating deployment, scaling, and management of containerized applications.

  • Kubernetes allows for automated deployment, scaling, and management of containerized applications.

  • It provides features like service discovery, load balancing, storage orchestration, and automated rollouts and rollbacks.

  • Kubernetes helps in ensuring high availability, fault tolerance, and efficient resource utilization.

  • It supports variou...read more

Q44. what is devops?

Ans.

DevOps is a software development methodology that combines software development (Dev) with IT operations (Ops) to improve collaboration and efficiency.

  • DevOps focuses on automating and streamlining the software development process.

  • It emphasizes communication and collaboration between development and operations teams.

  • DevOps aims to shorten the development lifecycle and provide continuous delivery of high-quality software.

  • Tools commonly used in DevOps include Jenkins, Docker, An...read more

Q45. what is terraform

Ans.

Terraform is an open-source infrastructure as code software tool created by HashiCorp.

  • Terraform allows users to define and provision infrastructure using a declarative configuration language.

  • It supports multiple cloud providers such as AWS, Azure, and Google Cloud Platform.

  • Terraform manages infrastructure resources as code, enabling automation and version control.

  • It helps in creating, updating, and deleting infrastructure resources efficiently.

  • Terraform uses a state file to k...read more

Q46. Difference between s3 and ebs

Ans.

S3 is object storage while EBS is block storage in AWS.

  • S3 is suitable for storing large amounts of unstructured data like images, videos, and backups.

  • EBS is used for storing data that requires frequent updates and access, like databases.

  • S3 is scalable and durable, while EBS is persistent and can be attached to a single EC2 instance.

  • S3 is accessed over HTTP/HTTPS, while EBS is accessed as a block device within an EC2 instance.

Q47. Hobbies as per interest

Ans.

My hobbies include hiking, cooking, and playing guitar.

  • Hiking in the mountains

  • Trying out new recipes

  • Learning new songs on guitar

Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10k Interviews
3.9
 • 7.8k Interviews
3.7
 • 7.3k Interviews
3.8
 • 5.4k Interviews
3.7
 • 5.2k Interviews
3.8
 • 4.6k Interviews
4.0
 • 750 Interviews
3.8
 • 100 Interviews
3.9
 • 86 Interviews
3.8
 • 68 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Devops Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter