Skip to content

Beginner Level

This section covers fundamental best practices in DevOps, including infrastructure as code, CI/CD, monitoring, and basic deployment strategies.

0 / 20 reviewed (0%)
  1. What are DevOps best practices?

    The core set interviewers expect:

    • Infrastructure as Code (IaC) — define infrastructure in versioned files
    • CI/CD — small, automated, frequent changes to production
    • Monitoring and observability — know the system's health before users tell you
    • Automated testing — quality gates in the pipeline, not at the end
    • Security baked in — "shift left" security scanning and least privilege
    • Culture: "you build it, you run it" — the team that writes a service also deploys and operates it

    The theme behind all of them is the same: make delivering software a repeatable, low-risk, incremental process instead of a big-bang event.

  2. What is the purpose of Infrastructure as Code (IaC)?

    IaC manages infrastructure — servers, networks, load balancers, databases — through declarative definition files instead of manual console clicks:

    hcl
    resource "aws_s3_bucket" "logs" {
      bucket = "app-prod-logs"
    }

    Tools: Terraform, CloudFormation, Pulumi, and configuration managers like Ansible. The purpose goes beyond automation: definitions live in Git (review, history, rollback), the same code provisions identical environments (no "snowflake" servers), and drift between reality and the declared state becomes visible and correctable.

  3. Why is version control important in DevOps?

    Version control (Git) is the backbone of every DevOps practice:

    • Everything is code — application code, infrastructure definitions, pipeline configs, even documentation — all reviewed through pull requests
    • Collaboration — multiple engineers work in parallel without overwriting each other
    • Rollback — any change can be reverted to a known-good state in seconds
    • Audit trail — who changed what, when, and why (mandatory in regulated environments)

    In interviews, connect it to GitOps: when Git is the source of truth, the repo's history is your infrastructure's history.

  4. What is Continuous Integration (CI)?

    CI is the practice of merging small changes into a shared mainline frequently (at least daily), with every merge automatically building the code and running tests:

    code
    commit → build → unit tests → lint/scan → fast feedback in minutes

    The value is catching integration problems when they're small and obvious, instead of during a painful "merge week". Key practices: keep the pipeline fast (minutes, not hours), fail the build on any red step, and never commit directly to the main branch — everything goes through a PR.

  5. What are the key components of a CI/CD pipeline?

    • Commit — developer pushes code; the pipeline triggers automatically
    • Build — compile code, build a container image; the image becomes the immutable artifact
    • Test — unit → integration → end-to-end, plus security scans (SCA, SAST)
    • Deploy — promote the same artifact through dev → staging → production
    • Monitor/Verify — health checks, metrics, and alerting validate the release

    Worth stating: the pipeline should build once, deploy the same artifact everywhere — rebuilding at each stage is a classic source of "works in staging, breaks in prod".

  6. What is the difference between Continuous Delivery and Continuous Deployment?

    • Continuous Delivery — every change is automatically built, tested, and staged ready for release, but a human approves the final push to production
    • Continuous Deployment — every change that passes the pipeline goes to production automatically, no human gate

    Delivery buys you a controlled decision point (useful in regulated industries or when releases are marketing-driven); deployment maximizes speed and forces the safety net (tests, monitoring, easy rollback) to be real. Both start identically — the only difference is the last step.

  7. Why is automated testing important in DevOps?

    Automated tests are the safety net that makes frequent deployment possible:

    • Catch bugs early — a failing unit test in CI costs minutes; the same bug found in production costs an incident
    • Enable speed with confidence — you can only deploy many times a day if something verifies each change
    • Document behavior — tests describe what the code is supposed to do

    Mention the test pyramid: many fast, cheap unit tests at the base; fewer integration tests in the middle; a small number of end-to-end tests on top. Inverting the pyramid (mostly UI tests) makes pipelines slow and flaky.

  8. What is the purpose of monitoring in DevOps?

    Monitoring answers two questions continuously: is it working right now? (health) and why is it misbehaving? (diagnosis). The three data types are:

    • Metrics — numeric time series (CPU, latency, error rate) — Prometheus + Grafana
    • Logs — discrete events with detail — ELK/OpenSearch, Loki
    • Traces — a request's journey across services — Jaeger, Tempo

    Alerting turns this into practice: alert on symptoms users feel (error rate, latency), not on every CPU spike. The four golden signals — latency, traffic, errors, saturation — are a good framework to name.

  9. What are blue-green deployments?

    Blue-green runs two identical production environments: blue (live) and green (idle). You deploy the new version to green, test it, then switch the load balancer from blue to green in one move:

    code
    users → LB → blue (v1.4)        switch → users → LB → green (v1.5)

    Strengths: near-instant rollback (switch back) and a full-environment test before real traffic. Trade-offs to mention: it needs double the infrastructure during the release, and long-lived stateful pieces (databases with schema migrations) don't switch back as cleanly as stateless apps.

  10. What is the role of logging in DevOps?

    Logging is the system's flight recorder — the primary tool for troubleshooting incidents and understanding behavior over time. Best practices:

    • Structured logging (JSON key-value pairs) instead of free text — parseable and searchable
    • Centralize logs from all services into one searchable store (ELK/OpenSearch, Loki, CloudWatch)
    • Correlation IDs — one request ID threaded through every service makes cross-service debugging possible
    • Log levels (ERROR/WARN/INFO/DEBUG) and never log secrets or personal data

    Monitoring tells you that something is wrong; logs usually tell you why.

  11. What is shift-left testing in DevOps?

    Shift-left means moving quality and security checks earlier in the lifecycle — as close to the code change as possible:

    code
    traditional:  design → build → test → secure → release
    shift-left:   design → [test + secure] → build → [test + secure] → release

    Practically: unit tests run on every commit, linters and secret scanners run pre-commit, dependency and image scans run in CI. The economic argument is the one interviewers like: a defect caught at commit time costs minutes of developer time; the same defect in production costs an incident, an on-call night, and customers' trust.

  12. What is feature flagging?

    Feature flags (toggles) decouple deploying code from releasing a feature — the code ships to production dark, and the flag turns it on for chosen users:

    json
    { "checkout-v2": { "enabled": true, "rollout": 10 } }   // 10% of users

    Uses: gradual rollout by percentage, canary exposure, instant "kill switch" if the feature misbehaves, A/B testing, and testing in production with internal users first. Mention the caveat that shows seniority: flags are technical debt — every active flag adds a code path to test, so dead flags must be cleaned up deliberately.

  13. What is immutable infrastructure?

    Immutable infrastructure means servers/containers are never modified after deployment — to change anything, you build a new image and replace the instance, discarding the old one:

    code
    change → build new image → deploy new instances → terminate old ones

    Why it matters: no configuration drift, no "snowflake" servers that nobody dares touch, and rollback is simply redeploying the previous image version. Tools: container platforms (Kubernetes, ECS), golden AMIs (Packer), and Terraform replacing resources. The contrast phrase that lands well: "pets vs cattle" — servers are replaced, not nursed back to health.

  14. What are rolling deployments?

    A rolling update replaces old instances in small batches while the service keeps running — Kubernetes does this natively:

    yaml
    strategy:
      rollingUpdate:
        maxSurge: 1          # allow 1 extra pod during the update
        maxUnavailable: 0    # never drop below full capacity

    Old pods drain as new pods pass readiness checks, so capacity never dips. Compare it in interviews: rolling = gradual, capacity-efficient, but old and new versions run side by side (so they must be compatible); blue-green = instant switch and rollback, but costs double the capacity.

  15. What is a canary deployment?

    A canary releases the new version to a small slice of real traffic first (e.g., 5%), watching metrics before widening:

    code
    v1.4: 95% of traffic   |   v1.5: 5% of traffic → check error rate/latency → 25% → 100%

    The defining feature is the metric-based promotion decision — if the canary's error rate or latency regresses, the release is rolled back automatically and only 5% of users ever noticed. This differs from blue-green (all-at-once switch) and rolling (fixed batches without explicit metric gates). Service meshes (Istio, App Mesh) and progressive-delivery tools (Argo Rollouts, Flagger) automate the analysis.

  16. What are microservices, and how do they impact DevOps?

    Microservices split an application into small, independently deployable services, each owning its data and communicating over APIs:

    • Upside — independent deploys (one service ships without redeploying the monolith), team autonomy, per-service scaling, blast-radius isolation
    • The honest trade-off — operational complexity multiplies: distributed debugging, network failures between services, data consistency, versioned APIs

    The DevOps impact: microservices are only workable with CI/CD per service, centralized observability, containers/orchestration, and strong automation — which is why the architecture and DevOps practices grew up together.

  17. How do you manage secrets in DevOps?

    Secrets (passwords, API keys, certificates) must never live in code or plain config files:

    • Dedicated stores — HashiCorp Vault, AWS Secrets Manager/Parameter Store, Azure Key Vault
    • Kubernetes Secrets — encrypted at rest (etcd encryption) + RBAC, not just base64 in YAML
    • Short-lived credentials — dynamic database creds or OIDC federation instead of long-lived keys
    • In pipelines — inject at runtime from the CI's secret store; never echo them into logs

    The non-negotiable rule to state: a secret committed to Git is compromised — rotate it, don't just delete the file (history keeps it).

  18. What is GitOps?

    GitOps extends IaC with a control loop: Git holds the declared desired state, and an in-cluster controller (Argo CD, Flux) continuously pulls that state and reconciles the live environment against it:

    code
    Git (desired state) ← Argo CD reconciles → cluster (actual state)

    What makes it "Ops": the operator runs inside the cluster (pull, not push), drift is detected and auto-corrected or alerted, every change is a reviewed commit, and rollback is git revert. Name the two levels: application manifests and infrastructure both live this way; the four principles (declarative, versioned, pulled automatically, continuously reconciled) are worth knowing.

  19. Why is containerization important in DevOps?

    Containers package an application with its dependencies into one immutable image that runs identically anywhere:

    code
    Dockerfile → image (v1.2.3) → same artifact in dev, staging, production

    The DevOps impact: the image is the deployable artifact (build once, promote everywhere), environments stop drifting, startup is seconds (unlike VMs), and density is high on shared hosts. Orchestration (Kubernetes) builds on this to add rolling updates, scaling, and self-healing — the foundation of modern deployment strategies.

  20. What is the 12-Factor App methodology?

    Twelve practices for building cloud-native applications that scale and stay portable (from Heroku engineers, 2011). The factors interviewers probe most:

    • Config (III) — configuration lives in environment variables, never in code
    • Backing services (IV) — databases/queues are attached resources, swappable via URL
    • Statelessness (VI) — no local session state; share nothing, scale horizontally
    • Logs (XI) — write to stdout; the platform aggregates
    • Disposability (IX) — fast startup and graceful shutdown enable elastic scaling

    The full twelve cover codebase, dependencies, build-release-run, processes, port binding, concurrency, dev/prod parity, and admin processes. Name a few correctly and you demonstrate you've actually worked with cloud-native apps.