36 practice questions with answers for DevOps interviews in Lucknow.
DevOps jobs in Lucknow
Lucknow's tech job market is smaller but growing, led by IT-services delivery centres, government-tech projects and start-ups. Many Lucknow candidates target Noida and Gurgaon roles or remote jobs, so interviews follow the NCR pattern.
Below are 36 questions that match the mix of service, product and domain employers hiring junior devops engineers in Lucknow.
Solved for LucknowStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
✓ 3 questions free • Unlock the rest in seconds
01
Write an EC2 user data script that installs and starts a web server on boot.
#!/bin/bash
set -e
dnf update -y
dnf install -y nginx
systemctl enable --now nginx
TOKEN=$(curl -s -X PUT http://169.254.169.254/latest/api/token \
-H 'X-aws-ec2-metadata-token-ttl-seconds: 60')
ID=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" \
http://169.254.169.254/latest/meta-data/instance-id)
echo "<h1>Served by $ID</h1>" > /usr/share/nginx/html/index.html
User data runs once as root on first boot; logs are in /var/log/cloud-init-output.log. This uses IMDSv2.
02
A pod is stuck in Pending state. What could be the reasons?
Pending means it has not been scheduled or its volumes are not ready. kubectl describe pod shows the scheduler's reason. Common causes are insufficient CPU or memory on nodes for the requests, node selectors, affinity or taints that no node satisfies, a PersistentVolumeClaim that cannot bind, or a resource quota being exceeded. Fix the spec or add nodes with the cluster autoscaler.
03
What is remote state and state locking in Terraform?
Remote state stores the state file in a shared backend such as an S3 bucket, Azure Storage or Terraform Cloud, so the whole team and CI use the same state. Locking prevents two runs from changing state at the same time, avoiding corruption; on S3 it uses a lock file or a DynamoDB table. Enable versioning and encryption on the backend for recovery and security.
04
An Ansible playbook run against 100 servers failed on 7 of them. What do you do?
Check the output and the retry file or failed host list to see the error on those hosts, for example unreachable SSH, a missing package repo or full disk. Fix the cause, then rerun only those hosts with --limit. Because tasks are idempotent, rerunning on successful hosts is also safe. For rolling changes, use serial and max_fail_percentage to stop early on failures.
05
How do you create a Secret and use it as an environment variable in a pod?
I keep each pull request focused on one change and small enough to review in about fifteen minutes. Commits have clear messages saying what and why. The description explains the problem, the approach, how I tested it and any risk or rollback step. I run linters and tests locally first, and I reply to every review comment, even if just to say done.
07
What is the difference between a hard link and a soft link?
A hard link is another directory entry pointing to the same inode, so the data survives until every hard link is deleted; it cannot cross file systems or point to directories. A soft (symbolic) link is a small file that stores a path to the target; it can cross file systems and point to directories, but it breaks if the target is moved or deleted.
08
What are the four golden signals, and the RED and USE methods?
The four golden signals are latency, traffic, errors and saturation. RED, for request-driven services, tracks rate, errors and duration. USE, for resources such as CPU, disks and network, tracks utilisation, saturation and errors. RED tells you whether users are hurting; USE helps find which resource is the bottleneck. Together they give a solid starting set of dashboards and alerts.
09
Someone made an S3 bucket with customer files public. What do you do?
Immediately block public access on the bucket and remove the public policy or ACLs. Check S3 server access logs or CloudTrail data events to see whether objects were downloaded, and involve security if customer data was exposed. Then enable Block Public Access at the account level, use AWS Config rules to detect public buckets, and require bucket changes through reviewed IaC.
#!/bin/bash
THRESHOLD=80
df -hP | awk 'NR>1 {gsub("%","",$5); print $5, $6}' | while read -r used mount; do
if [ "$used" -ge "$THRESHOLD" ]; then
echo "WARNING: $mount is ${used}% full on $(hostname)"
fi
done
df -P keeps each entry on one line, awk strips the percent sign, and the loop compares each value with the threshold.
12
An application on EC2 needs to read files from S3. How do you give it access securely?
Create an IAM role with a policy allowing only the needed actions, such as s3:GetObject on that bucket, attach it to the instance through an instance profile, and let the AWS SDK pick up temporary credentials automatically. Never put access keys in code or config files. Optionally add a bucket policy and a VPC endpoint so traffic stays inside AWS.
Lambda runs functions without servers, billed per request and duration, ideal for event-driven tasks with short runtimes up to 15 minutes. ECS is AWS's simpler container orchestrator, good when you want containers without Kubernetes complexity, often with Fargate. EKS is managed Kubernetes, chosen for portability, a rich ecosystem and existing Kubernetes skills, but it needs more operational knowledge.
14
Write a bash script that checks whether a service is running and restarts it if not.
#!/bin/bash
set -u
SERVICE="nginx"
if ! systemctl is-active --quiet "$SERVICE"; then
echo "$(date) $SERVICE down, restarting" >> /var/log/svc-check.log
systemctl restart "$SERVICE"
if ! systemctl is-active --quiet "$SERVICE"; then
echo "$SERVICE failed to start" | mail -s "ALERT" ops@example.com
fi
fi
Run it from cron every few minutes; a real setup would rely on systemd Restart= plus monitoring.
15
Write Terraform code to create an AWS EC2 instance.
A module is a reusable folder of Terraform files with input variables and outputs, for example a vpc module or an eks-cluster module. The root module calls child modules with different values for each environment. Modules reduce duplication and enforce standards across teams. They can come from local paths, Git or the Terraform Registry and should be pinned to versions.
17
What is the difference between a container and a virtual machine?
A virtual machine runs a full guest operating system on a hypervisor, so it is heavier, takes minutes to boot and uses gigabytes. A container shares the host kernel and isolates only the application and its dependencies using namespaces and cgroups, so it starts in seconds and uses far less memory. VMs give stronger isolation; containers give density and portability.
18
The host disk is filling up because of Docker. How do you clean up and prevent it?
Check usage with docker system df. Remove stopped containers, dangling images and unused networks with docker system prune, and old build cache with docker builder prune; be careful with the volumes flag. Container logs are a common culprit, so configure log rotation with max-size and max-file in daemon.json. In CI agents, schedule regular pruning jobs.
19
Write an IAM policy that gives read-only access to one S3 bucket.
I prepare before my shift by reading recent incidents and making sure runbooks and access work. During an incident I follow the runbook, stay calm and escalate early instead of struggling alone, because quick recovery matters more than solving it myself. Afterwards I note what was confusing and improve the docs or alerts, so each rotation gets easier for everyone.
21
What is the difference between a security group and a network ACL?
A security group acts as a firewall for instances or network interfaces. It is stateful, so return traffic is allowed automatically, and it supports only allow rules. A network ACL works at the subnet level, is stateless, so inbound and outbound rules must both allow traffic, supports allow and deny rules, and evaluates rules in number order. Security groups are the main control.
22
How do you use stored credentials inside a Jenkins pipeline?
pipeline {
agent any
environment {
SONAR_TOKEN = credentials('sonar-token')
}
stages {
stage('Push') {
steps {
withCredentials([usernamePassword(credentialsId: 'docker-hub',
usernameVariable: 'USER', passwordVariable: 'PASS')]) {
sh 'echo $PASS | docker login -u $USER --password-stdin'
}
}
}
}
}
Jenkins masks these values in console output. Use single quotes in sh so Groovy does not interpolate the secret.
23
Write a multi-stage Dockerfile for a Java Spring Boot application.
FROM maven:3.9-eclipse-temurin-21 AS build
WORKDIR /src
COPY pom.xml .
RUN mvn -B dependency:go-offline
COPY src ./src
RUN mvn -B package -DskipTests
FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
COPY --from=build /src/target/*.jar app.jar
RUN adduser -D appuser
USER appuser
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]
The final image has only the JRE and the JAR, not Maven or source.
24
Builds fail randomly because of flaky tests. How do you handle it?
First identify flaky tests by tracking which tests fail and pass on the same commit. Quarantine them into a separate non-blocking job so the main pipeline stays trustworthy, and raise tickets with owners. Common causes are timing assumptions, shared test data, order dependence and external services. Blind automatic retries hide real bugs, so use them only briefly while fixing the root cause.
25
A developer accidentally pushed an AWS access key to a public repository. What do you do?
Treat the key as compromised immediately: deactivate and rotate it in IAM, then check CloudTrail for misuse. Removing it from history comes second, using git filter-repo or BFG and a force push, and asking everyone to re-clone. Then prevent repeats with secret scanning in CI, pre-commit hooks like gitleaks and storing secrets in a vault or secrets manager instead of code.
26
You pushed a broken commit to the shared main branch and the build is failing. What do you do?
First restore a green main quickly: run git revert <hash> and push, which adds an undo commit without rewriting history that others have pulled. Tell the team in the channel. Then fix the issue on a branch with a proper pull request and tests. Avoid git reset with force push on main; branch protection rules should block it anyway.
A liveness probe checks whether the container is healthy; if it fails, the kubelet restarts it. A readiness probe checks whether it can serve traffic; if it fails, the pod is removed from service endpoints but not restarted. A startup probe gives slow-starting apps time to boot and holds off the other probes until it succeeds. Wrong liveness probes can cause restart loops.
28
You suddenly cannot SSH into a Linux server. What do you check?
Check reachability with ping and whether port 22 is open with nc -zv host 22. Then look at security groups, firewall rules and whether the sshd service is running, using the cloud console or serial access. Run ssh -vvv to see whether it fails at key exchange or authentication. Common causes are wrong key permissions, a full disk, a changed IP, or fail2ban blocking you.
29
Users complain the app is slow, but your dashboards look normal. What do you do?
Averages can hide pain, so check p95 and p99 latency, not mean. Find out which users, regions or features are affected; it may be one endpoint, a third-party API or client-side slowness. Use traces to follow a slow request and check DNS, CDN and front-end metrics through real user monitoring. Then add the missing signal to dashboards so it is visible next time.
30
Two features are in main but only one must go to production this week. How do you manage this?
The cleanest approach is feature flags: both features merge to main, but the unfinished one stays switched off in production, so deployment is separated from release. Without flags, you cut a release branch and revert or exclude the second feature, which is error prone. For the future, keep branches short-lived and agree with product on flag-based releases.
31
Explain stdin, stdout, stderr and what 2>&1 means.
Every process gets three file descriptors: 0 is stdin, 1 is stdout and 2 is stderr. > redirects stdout to a file, 2> redirects errors, and 2>&1 sends stderr to wherever stdout currently points. So command > out.log 2>&1 captures both normal output and errors in one file. Order matters: 2>&1 placed before > out.log would still print errors to the terminal.
32
How do you configure an S3 remote backend with locking?
terraform {
backend "s3" {
bucket = "acme-terraform-state"
key = "prod/network/terraform.tfstate"
region = "ap-south-1"
encrypt = true
use_lockfile = true
}
}
Then run terraform init (add -migrate-state if moving local state). Enable versioning on the bucket. Older setups use dynamodb_table = "tf-locks" instead of use_lockfile for locking.
33
When do you use a StatefulSet instead of a Deployment?
Use a StatefulSet for stateful workloads such as databases, Kafka or Elasticsearch that need stable identity. Pods get fixed names like db-0 and db-1, start and stop in order, and each gets its own PersistentVolumeClaim that follows it after rescheduling. A headless service gives each pod a stable DNS name. Deployments treat pods as interchangeable, which suits stateless apps.
34
How do you squash your last three commits into one?
git rebase -i HEAD~3
# in the editor, keep the first line as pick
# and change the other two to squash (or s)
pick a1b2c3 Add login API
squash d4e5f6 Fix typo
squash 789abc Add tests
# alternative without the editor
git reset --soft HEAD~3
git commit -m "Add login API with tests"
If the branch was already pushed, update it with git push --force-with-lease.
35
Tell me about a time you disagreed with a code review comment.
Situation: a reviewer asked me to replace a simple retry loop in our deploy script with a heavy external library. Task: I felt it added risk. Action: I explained my reasoning, shared a small benchmark and failure tests, and asked what concern they had; it was about backoff. Result: I added exponential backoff to my version, they approved, and we documented the pattern.
36
Tell me about a mistake you made in infrastructure work and what you learned.
Situation: I applied a Terraform change that renamed a security group, which forced replacement and briefly cut access to a staging database. Task: fix it and prevent repeats. Action: I restored access quickly, explained it openly to my lead, and then added plan review in pull requests plus lifecycle create_before_destroy rules. Result: no similar outage since, and I now read every destroy line in a plan.
Which companies hire DevOps professionals in Lucknow?
Companies with large offices in Lucknow include HCLTech. Use their company pages below to practise employer-specific sets.
Are DevOps interviews in Lucknow different from other cities?
The questions depend more on the company than the city. Lucknow's mix of employers decides the style: Many Lucknow candidates target Noida and Gurgaon roles or remote jobs, so interviews follow the NCR pattern
How do I find DevOps jobs in Lucknow?
Shortlist companies with Lucknow offices, keep your CV focused on DevOps projects, apply on company career pages and job portals with the Lucknow filter, and practise the questions on this page before each interview.