Devops Engineer
900+ Devops Engineer Interview Questions and Answers
Popular Companies
Q1. Reverse the String Problem Statement
You are given a string STR
which contains alphabets, numbers, and special characters. Your task is to reverse the string.
Example:
Input:
STR = "abcde"
Output:
"edcba"
Input...read more
Reverse a given string containing alphabets, numbers, and special characters.
Create a function that takes a string as input
Iterate through the string in reverse order and append each character to a new string
Return the reversed string
Q2. if you want to connect multiple vpc ,we have 2 or 3 vpc, you have to connect ec2 to each vpc? so how you can achieve that?
To connect multiple VPCs, we can use VPC peering or VPN connections.
Create a VPC peering connection between the VPCs
Configure route tables to allow traffic between the VPCs
Alternatively, create VPN connections between the VPCs
Attach EC2 instances to the appropriate VPCs
Devops Engineer Interview Questions and Answers for Freshers
Q3. How to run a docker command remotely. i.e. Docker is installed on both your laptop and a remote linux server. You need to run docker command on the linux server but without taking a separate ssh session to the...
read moreYou can use the Docker API to remotely run Docker commands on a Linux server without taking a separate SSH session.
Use the Docker API to interact with the Docker daemon on the remote Linux server.
Make sure Docker is installed and running on both your laptop and the remote server.
Authenticate with the remote server using appropriate credentials.
Establish a connection to the Docker daemon on the remote server using the Docker API.
Send the desired Docker command to the remote se...read more
Q4. Guess The Hidden Number Problem Statement
You are given an integer N
and there is a hidden number within the range [0, N] that you must guess. You have access to a function higherLower(k)
which helps in guessin...read more
The task is to guess a hidden number within a given range using a function that provides hints about the number's relation to a given input.
Use the higherLower(k) function to determine if the hidden number is smaller, equal to, or greater than the input k.
Implement a binary search algorithm to efficiently guess the hidden number within the given range.
Iteratively narrow down the range based on the hints provided by the higherLower(k) function.
Return the guessed hidden number ...read more
Q5. Docker command to transfer an image from one machine to another without using docker registry
Docker save and Docker load commands can be used to transfer an image from one machine to another without using a Docker registry.
Use the 'docker save' command to save the image as a tar file on the source machine
Transfer the tar file to the destination machine using any file transfer method (e.g., scp)
On the destination machine, use the 'docker load' command to load the image from the tar file
Q6. Which programming languages do you use regularly in your work?
I use multiple programming languages depending on the task at hand.
Python for automation and scripting
Java for building applications
Bash for shell scripting
SQL for database management
JavaScript for web development
Go for microservices
Perl for text processing
C/C++ for system-level programming
Share interview questions and help millions of jobseekers 🌟
The command used to delete a branch in Git is 'git branch -d <branch_name>'.
Use 'git branch -d <branch_name>' to delete a branch in Git.
Make sure to switch to a different branch before deleting the branch.
If the branch has not been merged, use 'git branch -D <branch_name>' to force delete.
Q8. How to copy a commit one branch to another branch?
To copy a commit from one branch to another, use the git cherry-pick command.
Checkout the branch where you want to copy the commit
Find the commit hash of the commit you want to copy
Run 'git cherry-pick
' to apply the commit to the current branch
Devops Engineer Jobs
Q9. How we can create EC2 instance by using terraform ? (write)
To create an EC2 instance using Terraform, define the necessary resources in a Terraform configuration file and run 'terraform apply'.
Write a Terraform configuration file with the necessary resources, such as 'aws_instance' for EC2 instance.
Specify the required parameters like 'ami', 'instance_type', 'subnet_id', etc.
Run 'terraform init' to initialize the working directory.
Run 'terraform plan' to see the execution plan.
Run 'terraform apply' to create the EC2 instance.
Verify t...read more
Q10. your container running service is up but you are facing any issue , how to troubleshoot them?
To troubleshoot issues with a running container service, follow these steps:
Check the logs of the container to identify any errors or warnings
Verify that the container is running on the correct port and IP address
Check the network connectivity between the container and other services
Verify that the container has access to the required resources and dependencies
Restart the container or redeploy the service if necessary
You can block specific IPs on an EC2 instance in AWS by using security groups or network access control lists (NACLs).
Use security groups to block specific IPs by creating a new inbound rule with the IP address you want to block and setting the action to 'deny'.
Alternatively, you can use network access control lists (NACLs) to block specific IPs by adding a rule to deny traffic from the IP address you want to block.
Remember to prioritize the rules in the security group or NAC...read more
Q12. who do you debug the error and which method do you choose
Debugging errors involves identifying the root cause and using appropriate methods to resolve it.
Start by reproducing the error and gathering relevant information
Use debugging tools like logs, stack traces, and breakpoints to identify the root cause
Once the root cause is identified, use appropriate methods like code changes or configuration updates to resolve the error
Test the solution thoroughly to ensure it does not cause any new errors
Q13. if you change the infrasrtuctur in aws management console will it change statefile
Yes, changing infrastructure in AWS management console will change statefile.
Any changes made in the AWS management console will be reflected in the statefile.
The statefile is a record of the current state of the infrastructure.
For example, if you add a new EC2 instance in the management console, it will be reflected in the statefile.
Q14. Execute a command to show whether httpd service is running or not
Command to check httpd service status
Use the command 'systemctl status httpd' to check the status of httpd service
If httpd service is running, the output will show 'active (running)'
If httpd service is not running, the output will show 'inactive (dead)'
Jenkins triggers scheduled jobs or pipelines based on configured cron expressions or triggers from external events.
Jenkins uses cron expressions to schedule jobs at specific times or intervals.
Jobs can also be triggered manually or by external events like code commits to a repository.
Pipeline jobs can be triggered by changes in a Git repository, webhook notifications, or other external triggers.
Q16. explain pipeline whatever you can write in code how will you deploy the code ? tell me just steps?
Pipeline is a set of automated processes that build, test, and deploy code changes.
Create a code repository
Write code and commit changes to the repository
Trigger a build process to compile and package the code
Run automated tests to ensure code quality
Deploy the code to a staging environment for further testing
If tests pass, deploy the code to production environment
Monitor the application for issues and repeat the process for new changes
CMD specifies the default command to run in the container, while ENTRYPOINT specifies the executable to run when the container starts.
CMD is often used to provide default arguments for the ENTRYPOINT command
ENTRYPOINT is used to specify the executable that will run when the container starts
CMD can be overridden at runtime by passing arguments to docker run command
ENTRYPOINT cannot be overridden at runtime, but can be combined with CMD to provide default arguments
Q18. How to check logs for pods and containers in kubernets ?
To check logs for pods and containers in Kubernetes, you can use the kubectl command-line tool.
Use the 'kubectl logs' command to view logs for a specific pod or container.
Specify the pod or container name along with the appropriate flags.
You can also use selectors to filter logs based on labels or namespaces.
To follow logs in real-time, use the '-f' flag.
To limit the number of lines displayed, use the '--tail' flag.
To view logs from multiple containers in a pod, use the '--co...read more
Docker images can be copied from one host to another using 'docker save' and 'docker load' commands.
Use 'docker save' command to save the image as a tar file on the source host
Transfer the tar file to the destination host using SCP or any other file transfer method
Use 'docker load' command on the destination host to load the image from the tar file
Q20. What is the usecase which would require setup of distributed jenkins nodes
Distributed Jenkins nodes are used to handle large-scale builds and improve performance.
Large-scale builds: When there are a large number of builds to be executed simultaneously, distributed Jenkins nodes can handle the load by distributing the builds across multiple nodes.
Improved performance: By distributing the workload, the overall build time can be reduced, resulting in improved performance.
Resource utilization: Distributed nodes allow for better utilization of resources...read more
Q21. from where you can download 3rd party libraries which you created during deployment?
Third-party libraries can be downloaded from package managers or repositories.
Package managers like npm, pip, and Maven can be used to download third-party libraries.
Repositories like GitHub, GitLab, and Bitbucket can also be used to download libraries.
Some cloud providers like AWS and Azure have their own repositories for third-party libraries.
Libraries can also be downloaded from the official website of the library or the developer.
To debug a slow website template, analyze performance metrics, check for inefficient code, optimize images and assets, and consider server-side improvements.
Analyze performance metrics using tools like Chrome DevTools or Lighthouse to identify bottlenecks.
Check for inefficient code such as unnecessary loops, redundant CSS rules, or large JavaScript files.
Optimize images and assets by compressing files, using lazy loading, or implementing a content delivery network (CDN).
Consi...read more
When an instance in AWS is deregistered, the load balancer stops sending traffic to that instance.
The load balancer detects the deregistration of the instance and stops routing traffic to it.
The load balancer redistributes the traffic to the remaining healthy instances.
The deregistered instance is no longer considered part of the load balancer's target group.
The load balancer health checks will mark the instance as unhealthy.
The load balancer will not send any new requests to...read more
Setting up distributed Jenkins nodes is necessary for scaling Jenkins infrastructure and improving performance.
When there is a need to run a large number of jobs simultaneously
When jobs require different environments or configurations
When jobs need to be executed on different platforms or operating systems
When there is a need for high availability and fault tolerance
When there is a need to reduce build queue times and improve overall performance
Q25. If you want to restrict the communication between the kubernetes pod, how would you restrict that one?
Restricting communication between Kubernetes pods can be achieved using network policies.
Use Network Policies in Kubernetes to define rules for pod-to-pod communication
Specify which pods are allowed to communicate with each other based on labels
Deny all traffic by default and only allow specific traffic as needed
Example: Define a network policy to allow communication only between pods with label 'app=frontend' and 'app=backend'
Q26. how to work DNS in Linux ? what is the record of DNS?
DNS in Linux is managed through configuration files and commands. DNS records contain information about domain names and IP addresses.
DNS in Linux is managed through the /etc/resolv.conf file which contains the IP addresses of DNS servers.
The 'nslookup' command can be used to query DNS records for a specific domain name.
DNS records include A records (IP address), MX records (mail server), CNAME records (alias), and more.
DNS caching can improve performance by storing frequentl...read more
The lifecycle of a Docker container involves creation, running, pausing, restarting, and stopping.
1. Creation: A Docker container is created from a Docker image using the 'docker run' command.
2. Running: The container is started and runs the specified application or service.
3. Pausing: The container can be paused using the 'docker pause' command, which temporarily stops its processes.
4. Restarting: The container can be restarted using the 'docker restart' command.
5. Stopping:...read more
Declarative pipelines focus on the desired state of the pipeline, while scripted pipelines allow for more flexibility and control.
Declarative pipelines use a more structured syntax and are recommended for simpler pipelines.
Scripted pipelines use Groovy script and allow for more complex logic and customization.
Declarative pipelines are easier to read and maintain, while scripted pipelines can be more powerful but harder to troubleshoot.
Declarative pipelines enforce best practi...read more
Q29. how communication happens between two pods in different namespaces?
Communication between pods in different namespaces is possible through services or network policies.
Use services to allow communication between pods in different namespaces
Create network policies to control traffic flow between pods in different namespaces
Ensure proper DNS resolution for pods in different namespaces
Inode number is a unique identifier for a file in a filesystem, while a file descriptor is a reference to an open file.
Inode number is a metadata associated with a file, stored in the filesystem's inode table.
File descriptor is a reference to an open file in a process, represented by an integer.
Inode number remains constant for a file even if it is moved or renamed, while file descriptor changes with each open/close operation.
Example: In a Unix-like system, 'ls -i' command di...read more
Q31. If pipeline breaks in production environment, how do you handle it?
I would follow the incident management process to identify the root cause and resolve the issue as quickly as possible.
Notify the relevant stakeholders and initiate the incident management process
Identify the root cause of the issue and take corrective actions
Rollback to the previous stable version if necessary
Communicate the status and progress of the incident to stakeholders
Conduct a post-incident review to identify areas of improvement
Q32. what is meaning of transite gateway? why we can use transite gateway?
Transit Gateway is a network transit hub that enables interconnectivity between virtual private clouds (VPCs) and on-premises networks.
Transit Gateway simplifies network architecture by allowing multiple VPCs and VPN connections to connect to a single gateway.
It provides a hub-and-spoke model for connecting VPCs and on-premises networks.
Transit Gateway also supports routing between VPCs and on-premises networks, and can be used to consolidate VPC peering connections.
It can al...read more
git revert undoes a specific commit by creating a new commit, while git reset moves the HEAD to a previous commit without creating a new commit.
git revert creates a new commit that undoes a specific commit, keeping the commit history intact
git reset moves the HEAD to a previous commit, potentially discarding changes made after that commit
git revert is safer for shared branches as it does not rewrite history, while git reset can be used for local branches to reset to a previou...read more
Q34. what is testing ? Ans: As a part of testing excruciation after complete the Release mode we can get in to the against to the daily integration test .system integration test .user accepting test .production as l...
read moreTesting is the process of evaluating a system or its component(s) with the intent to find whether it satisfies the specified requirements or not.
Testing is done to ensure that the software meets the requirements and works as expected.
It involves executing a system or its component(s) with the intent of finding errors or defects.
Testing can be done at various stages of the software development life cycle such as unit testing, integration testing, system testing, and acceptance...read more
You can kill all Java processes with a single command using pkill or killall commands.
Use pkill command followed by the process name 'java' to kill all Java processes: pkill java
Alternatively, you can use killall command with the process name 'java' to achieve the same result: killall java
Amazon ECS is a container management service while Amazon EKS is a managed Kubernetes service.
Amazon ECS is a fully managed container orchestration service, while Amazon EKS is a managed Kubernetes service.
Amazon ECS is more tightly integrated with other AWS services like CloudWatch, IAM, and VPC, while Amazon EKS is more flexible and can run on any cloud provider.
Amazon ECS uses its own proprietary orchestration engine, while Amazon EKS uses Kubernetes for container orchestr...read more
Monitoring a Kubernetes cluster involves using tools like Prometheus, Grafana, and Kubernetes Dashboard.
Use Prometheus for collecting metrics from Kubernetes components and applications running on the cluster.
Set up Grafana for visualizing the collected metrics and creating dashboards for monitoring.
Utilize Kubernetes Dashboard for a graphical interface to view and manage the cluster resources.
Implement alerts and notifications using tools like Prometheus Alertmanager to proa...read more
Q38. for tomcat security and harden, what precaution you can taken?
To secure and harden Tomcat, several precautions can be taken.
Disable unused connectors and ports
Use SSL/TLS encryption for secure communication
Implement access control and authentication mechanisms
Regularly update Tomcat and its dependencies
Configure logging and monitoring for security events
Ingress is a layer 7 HTTP routing mechanism while Load Balancer is a layer 4 TCP/UDP load balancer in Kubernetes.
Ingress is used to expose HTTP and HTTPS routes to services inside the cluster, while Load Balancer is used to distribute traffic across multiple nodes.
Ingress provides features like SSL termination, path-based routing, and name-based virtual hosting, while Load Balancer focuses on distributing traffic based on IP and port.
Ingress is a resource that manages externa...read more
Yes, I can write an Ansible playbook to install Apache.
Use the 'apt' module to install Apache on Debian/Ubuntu systems
Use the 'yum' module to install Apache on Red Hat/CentOS systems
Ensure to start and enable the Apache service after installation
To debug issues with Apache and Nginx, check error logs, configuration files, server status, and network connectivity.
Check error logs for any relevant error messages or warnings.
Review configuration files for any misconfigurations or typos.
Check server status to ensure services are running and responding correctly.
Verify network connectivity to ensure there are no network issues affecting communication.
Use tools like curl, telnet, or netcat to test connections and troublesho...read more
Running Docker inside Docker is useful for testing, CI/CD pipelines, and isolating environments.
Testing different Docker configurations
Running CI/CD pipelines within containers
Isolating development environments
Building and testing Docker images within containers
Q43. What are key elements which are there in continuous testing tools?
Key elements in continuous testing tools include automation, integration with CI/CD pipelines, reporting and analytics, scalability, and support for various testing types.
Automation of test cases to ensure quick feedback on code changes
Integration with CI/CD pipelines for seamless testing in the software delivery process
Reporting and analytics capabilities to track test results and identify issues
Scalability to handle testing across different environments and configurations
Su...read more
Q44. What are the various branching strategies used in the version control system?
Various branching strategies in version control systems help manage code changes effectively.
Mainline/Branch by Release: Each release has its own branch for bug fixes and maintenance.
Feature Branching: Each new feature is developed in a separate branch and merged back to main branch after completion.
Gitflow Workflow: Uses main, develop, feature, release, and hotfix branches for a structured workflow.
Trunk-Based Development: All developers work on a single branch, promoting co...read more
Jenkins is an open-source automation server that helps to automate the non-human part of the software development process.
Jenkins is a Java-based application that runs in a servlet container like Apache Tomcat.
It can be installed on a single server or distributed across multiple servers for scalability.
Jenkins uses plugins to extend its functionality, allowing integration with various tools and technologies.
It follows a master-slave architecture where the master node manages ...read more
Q46. how to troubleshoot when ec2 has not access to me?
To troubleshoot EC2 not having access to me, check security groups, network ACLs, and routing tables.
Check if the EC2 instance is in the correct security group
Verify that the security group allows inbound traffic from your IP address or CIDR block
Check if there are any network ACLs that may be blocking traffic
Verify that the routing table is correctly configured
Check if there are any firewall rules on your local machine that may be blocking traffic
Use tools like ping, tracero...read more
Q47. How would you debug a website which is progressively slowing down
To debug a progressively slowing down website, I would analyze the server logs, check for memory leaks, and optimize the code.
Analyze server logs to identify any errors or bottlenecks
Check for memory leaks in the code
Optimize the code by removing unnecessary scripts and optimizing images
Use tools like Chrome DevTools to identify performance issues
Consider implementing a content delivery network (CDN) to improve website speed
Chef is a configuration management tool used in DevOps to automate infrastructure deployment and management.
Automating server configuration and management
Ensuring consistency across environments
Enabling infrastructure as code practices
Automating application deployment processes
Managing complex infrastructure at scale
Q49. Did you write a Docker file from scratch? What is the syntax for Docker file?
Yes, I have written Docker files from scratch. The syntax for Docker file includes instructions and arguments.
Docker file is a script that contains instructions to build a Docker image
The syntax includes instructions like FROM, RUN, COPY, CMD, etc.
Arguments are used to specify details like the base image, working directory, etc.
Example: FROM ubuntu:latest RUN apt-get update && apt-get install -y python3
Example: COPY . /app WORKDIR /app CMD python3 app.py
Q50. what is DevOps? how the DevOps will helpful for the Organization?
DevOps is a culture that promotes collaboration between development and operations teams to deliver software faster and more reliably.
DevOps helps organizations to achieve faster time-to-market, improved quality, and increased efficiency.
It involves automating the software delivery process, continuous integration and deployment, and monitoring and feedback loops.
DevOps also emphasizes on communication, collaboration, and shared responsibility between teams.
Examples of DevOps ...read more
Interview Questions of Similar Designations
Top Interview Questions for Devops Engineer Related Skills
Interview experiences of popular companies
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
Reviews
Interviews
Salaries
Users/Month