DMCA.com Protection Status Trending Topics About Devops: Scenario-based DevOps questions

Tuesday, 15 July 2025

Scenario-based DevOps questions

 

šŸš€ 1. CI/CD Pipeline Issue

Scenario:
You have a Jenkins pipeline that fails at the testing stage. The build step is successful, but during testing, it reports that a required environment variable is missing.

Question:
How would you troubleshoot and fix this issue?

Expected Answer:

  • Check the pipeline script (Jenkinsfile) to see if the environment variable is defined.

  • Verify that the variable is passed correctly from the Jenkins environment or injected via credentials.

  • If using Docker, ensure the variable is available inside the container.

  • Add a debug step (echo $VAR_NAME) to confirm it's being set.


šŸ› ️ 2. Infrastructure as Code (Terraform)

Scenario:
You used Terraform to deploy a VM in Azure. Later, someone manually deleted the VM from the portal.

Question:
What happens the next time you run terraform plan and how would you fix it?

Expected Answer:

  • Terraform will show that the VM needs to be recreated.

  • terraform plan will detect that the resource is missing and suggest creating it again.

  • Running terraform apply will recreate the deleted VM.

  • Best practice: Avoid manual changes outside Terraform to prevent state drift.


☁️ 3. Deployment Rollback

Scenario:
A deployment went live and caused issues in production. Users started facing errors immediately.

Question:
How would you handle the rollback?

Expected Answer:

  • First, stop further impact (pause traffic, scale down, etc.).

  • Use the last known good deployment version from the CI/CD tool (e.g., Git tag, Docker image).

  • Roll back using the deployment tool (Helm, Kubernetes, or Jenkins).

  • Communicate with the team and investigate logs for root cause.


šŸ” 4. SSH Key Access

Scenario:
You created a new VM and pushed your public SSH key during provisioning. But when you try to SSH, access is denied.

Question:
What could be the possible issues?

Expected Answer:

  • Wrong key used while connecting (ssh -i wrong_key.pem).

  • Permissions on the ~/.ssh/authorized_keys file or ~/.ssh directory are incorrect.

  • The SSH service might not be running or the firewall might be blocking access.

  • Wrong user (ubuntu vs root vs azureuser).


šŸ“¦ 5. Docker Image Issue

Scenario:
Your application works locally but fails with a "module not found" error when run inside a Docker container.

Question:
What would you check?

Expected Answer:

  • Ensure the dependency is listed in the requirements.txt or package.json.

  • Confirm the file is being copied properly in the Dockerfile.

  • Rebuild the Docker image to reflect the changes (docker build .).

  • Check the WORKDIR and execution context in the container.

No comments: