BayLearnBayAreaLa8s

BayLearn Interview Sprints

Cloud DevOps Interview Sprint — Deploy It. Automate It. Operate It.

Prepare for modern DevOps, Platform and Cloud interviews with Docker, Kubernetes, Terraform, CI/CD, production troubleshooting and a realistic hands-on deployment challenge.

Refund terms are drafted and are not a current offer. Refund policy

4-Hour Live 1:1 Intensive
Docker + Kubernetes + Terraform
Production Deployment Lab
27 Configuration Challenges
240+ Interview Questions
Mock Interview + Feedback

Curriculum

Short lessons in interview order. The production lab runs on your machine with kind and Terraform — BayLearn does not execute candidate clusters.

·

You will

  • See the full lesson path before you book
  • Know this is a production DevOps interview sprint, not a command dump

Course overview5 min

Course overview

Cloud DevOps Interview Sprint

Four hours. Docker, Kubernetes on kind, Terraform 1.11+, CI/CD, and production operations. You package a backend, deploy it, write the supporting infrastructure as code, promote the same digest, break something realistic, fix it, and sit a scored mock.

This is not three certification courses squeezed into a weekend. Interviewers want you to walk Browser → DNS → load balancer → Ingress → Service → Pod → database. Listing kubectl flags is not enough. Treating DynamoDB as the Terraform locking story is also not enough.

Promise

You deploy a real workload, automate the path that built the digest, and operate the system when it lies. You leave with a readiness report and a 7-day plan. The score measures rehearsal against the BayLearn Cloud DevOps rubric. It does not predict hiring.

The certificate is a BayLearn Certificate of Completion: Cloud DevOps Interview Sprint — Docker + Kubernetes + Terraform. That means you finished this course. It is not CKA, CKAD, Terraform Associate, or any other industry certification.

Journey

text

ASSESS → CONTAINERIZE → ORCHESTRATE → PROVISION → AUTOMATE → OBSERVE → BREAK/FIX → MOCK → FEEDBACK
Deploy It. Automate It. Operate It. — the weekend loop Deploy It. Automate It. Operate It. — the weekend loop AssessContainerizeOrchestrateProvisionAutomateOperateTRACE · mock Spoken frame: Deploy It (image + YAML), Automate It (digest + lock), Operate It (TRACE).Module 0 scores the map. Module 5 proves it on kind. Module 6 scores the spoken interview.
Sprint journey from assess to feedback

What interviews actually test

Can you ship a digest, keep traffic on Ready pods, lock remote state, and narrate TRACE when the page goes off? A typical loop looks like this:

  1. Package the Order API so PID 1 is the server, the user is not root, and the image has no secrets.
  2. Deploy it on Kubernetes with probes, requests, and a ClusterIP — then explain why NodePort is not the default internet path.
  3. Show an S3 backend with use_lockfile = true (Terraform 1.11+) and refuse a new DynamoDB lock table as “modern.”
  4. Promote the same digest through CI, then TRACE a 502 without restarting the cluster.

If you cannot walk those four out loud, dumping commands will not help.

The four-hour agenda

ModuleTimeTopic
015 minDevOps Readiness Assessment
135 minDocker & Container Engineering
245 minKubernetes Interview Essentials
340 minTerraform & Infrastructure as Code
435 minCI/CD, Cloud & Production Operations
535 minHands-On Production Challenge
645–60 minDevOps Mock Interview
710 minFeedback & 7-Day Plan

Live 1:1 usually lands between 3h45m and 4h15m. If you are self-paced, budget four to five hours including the lab.

Who this is for

DevOps Engineer, Senior DevOps Engineer, Cloud Engineer, Platform Engineer, SRE, and Infrastructure Engineer. Tracks in the mock: DEVOPS_ENGINEER, SENIOR_DEVOPS_ENGINEER, PLATFORM_ENGINEER, SRE, LEAD_PLATFORM_ENGINEER.

What this sprint is not

  • Not a second AWS Solutions Architect course. Optional AWS names appear only as a mapping table (EKS, ALB, ECR) after you can explain the portable path.
  • Not Helm/Kustomize as a four-hour requirement.
  • Not minikube. Local clusters are kind only.
  • Not “Kubernetes Secrets are encrypted, so we are done.”

How to study

Say answers out loud. Ten questions spoken beat fifty skims. After each lesson, pick the Order API and teach the decision as if a staff engineer is sitting across from you.

Open the course overview next, then Module 0.

Instructor: BayAreaLa8s Team. Prices load from central configuration — do not expect amounts in this curriculum.

Start here

Start here

Course overview — how to use this sprint

In one sentence: Spend four hours practicing the interview loop — deploy a digest, automate promotion, operate the failure — not collecting flags from three vendor exams.

Before you start

You need a laptop that can run Docker Engine and kind (v0.30+, around v0.33). Terraform must be 1.11 or newer so S3 use_lockfile is the locking story you tell. The sample Order API is Python 3.12+; you are packaging it, not taking a FastAPI course.

You do not need an AWS account to finish the sprint. The production lab (LAB-CD-501) is local: Docker build, kind apply, Terraform validate/plan, a documented CI workflow. An optional EKS mapping table exists for interviews that name cloud products. It is not a second curriculum.

How the player is organized

SurfaceWhat it is
Module 025-question readiness (cd-readiness-v1). Nine skill bars. Bands 0–40 Foundation, 41–60 Developing, 61–75 Interview Capable, 76–90 Interview Ready, 91–100 Advanced.
Modules 1–4Lessons, diagrams, knowledge checks. Speak answers; do not highlight-and-forget.
Challenges27 configuration fixes (Docker, Kubernetes, Terraform, CI/CD). Solutions stay hidden until you attempt.
Module 5Production deployment lab + break/fix. You run commands locally. BayLearn does not execute your cluster.
Module 6One of five mock modes. Dimensions are 1–5; weights are in the scorecard.
Module 7Keep / change / 7-day plan. Repeat the disclaimer out loud.
Downloads23 cheatsheets. Use them after you can teach the table, not instead of teaching it.

Positioning you will hear all day

Deploy it. A pinned, non-root image. A Deployment that only receives traffic when Ready. Manifests you could re-apply on Monday.

Automate it. The same digest moves through CI. Terraform plan is reviewed; apply is locked. Git is the source of what production should be.

Operate it. TRACE first: Triage Impact, Review Recent Changes, Analyze Signals, Check Dependencies & Capacity, Execute Mitigation then Eliminate Root Cause. Ready on a dependency is not innocence.

Deploy It. Automate It. Operate It. — the weekend loop Deploy It. Automate It. Operate It. — the weekend loop AssessContainerizeOrchestrateProvisionAutomateOperateTRACE · mock Spoken frame: Deploy It (image + YAML), Automate It (digest + lock), Operate It (TRACE).Module 0 scores the map. Module 5 proves it on kind. Module 6 scores the spoken interview.
Deploy, automate, operate as one loop

Tool versions you should say in an interview

Checked 13 September 2026. Full table: docs/interview-sprints/cloud-devops/TOOL_VERSION_POLICY.md.

ToolWhat you say
Kubernetes1.31–1.37 supported; lab APIs are 1.31+
kindv0.30+ (around v0.33). Not minikube.
Terraform>= 1.11 required; current stable 1.15.x. S3 use_lockfile. DynamoDB locking is deprecated.
Providershashicorp/aws >= 5.80; hashicorp/kubernetes 2.38+ / 3.x
DockerCurrent Engine + Buildx. Multi-stage, no BuildKit-only magic required.
Sample appPython 3.12+ Order API for packaging

Certificate and scoring honesty

Completing the sprint can issue a BayLearn Certificate of Completion. That is proof you finished this course. It is not CKA, CKAD, CKS, Terraform Associate, or AWS Certified DevOps.

The mock score is weighted rehearsal. Perfect fives become 100 / Exceptional. It does not predict hiring. Say that when you share a report.

Suggested self-paced path (4–5 hours)

  1. Assessment (15 min). Write down the two weakest skill bars.
  2. Modules 1–2 (80 min). Containers then Kubernetes. Do C-01, C-06, C-08, C-09.
  3. Module 3 (40 min). State, modules, use_lockfile. Do C-18 and C-22.
  4. Module 4 (35 min). Promotion, Browser→DB path, RED/USE, SLI/SLO/SLA.
  5. Module 5 (35–50 min). LAB-CD-501 then one TRACE scenario (D-01 or D-09).
  6. Mock (45–60 min) and Module 7 (10 min).

What not to do

  • Do not treat this as an AWS Solutions Architect recap. Stay portable first.
  • Do not paste cluster-admin kubeconfigs or Terraform state into chat, git, or the player.
  • Do not skip TRACE and jump to kubectl delete pod --all.
  • Do not document DynamoDB lock tables as the current recommended pattern.

Instructor: BayAreaLa8s Team. Next: Module 0.

You will

  • Answer 25 scenario questions
  • Show weak categories to the instructor before the live session

How the assessment works5 min

How the assessment works

Module 0 — DevOps Readiness Assessment

Duration: 15 minutes

Twenty-five questions (cd-readiness-v1) before any teaching. This is not a grade. You want two skill bars you will work in the next three hours.

Why this module exists

Interviewers do not start with “tell me every kubectl verb.” They start with a failing checkout and watch whether you can tell cgroup OOM from host RAM, ClusterIP from NodePort, and a locked S3 backend from a laptop terraform.tfstate.

This assessment is the same idea, as multiple-choice and short troubleshooting stems. Speak the *why* even when you click a letter.

Deploy It. Automate It. Operate It. — the weekend loop Deploy It. Automate It. Operate It. — the weekend loop AssessContainerizeOrchestrateProvisionAutomateOperateTRACE · mock Spoken frame: Deploy It (image + YAML), Automate It (digest + lock), Operate It (TRACE).Module 0 scores the map. Module 5 proves it on kind. Module 6 scores the spoken interview.
The weekend loop the score is mapping

What is scored

Nine skills, rolled from the question categories:

Skill barYou will see this later as
ContainersModule 1, C-01–C-05
KubernetesModule 2, C-06–C-15
TerraformModule 3, C-16–C-22
CI/CDModule 4, C-23–C-27
Cloud FundamentalsOptional AWS mapping only — portable first
NetworkingBrowser→DB path, DNS, ndots
SecurityNon-root, Secrets are not magic, OIDC
ObservabilityRED/USE, SLI/SLO/SLA
TroubleshootingTRACE, D-01–D-22

Overall percent maps to: 0–40 Foundation, 41–60 Developing, 61–75 Interview Capable, 76–90 Interview Ready, 91–100 Advanced.

The mock later uses a different instrument (1–5 per dimension, weighted). Do not treat Module 0 as a hiring prediction.

How to take it

  1. 15 minutes, closed notes if you can stand it.
  2. After submit, write the two lowest bars on paper.
  3. Do not “restudy the whole catalog.” Open the matching module and one challenge.

COMMON MISTAKE: Retaking until you hit 90, then skipping Modules 1–4. The assessment is a map, not the course.

SENIOR-LEVEL EXPECTATION: After the score, say which production failure each weak bar would cause on the Order API — not “I need to review Kubernetes.”

INTERVIEW TIP: If you miss the cgroup memory question, that is Module 1 and D-04. If you pick DynamoDB as the current lock, that is Module 3 — use_lockfile on Terraform 1.11+.

Lessons

  1. How the assessment works
  2. Readiness — what to do with the score

Next: Module 1, unless your Kubernetes bar is already the problem — then skim Module 1 security and go deep on Module 2.

Readiness Assessment15 min

Readiness Assessment

Readiness — what to do with the score

In one sentence: Treat the nine bars as a 7-day backlog, not as a personality test.

Read the report the way an interviewer would

A high Containers bar and a low Kubernetes bar means you can build an image and still ship a Service that selects nothing. A high Terraform bar and a low Troubleshooting bar means you can recite plan and still destroy in a war room. Pair bars. Do not average them into “I am a 72.”

Deploy It. Automate It. Operate It. — the weekend loop Deploy It. Automate It. Operate It. — the weekend loop AssessContainerizeOrchestrateProvisionAutomateOperateTRACE · mock Spoken frame: Deploy It (image + YAML), Automate It (digest + lock), Operate It (TRACE).Module 0 scores the map. Module 5 proves it on kind. Module 6 scores the spoken interview.
Journey after the assessment
TRACE — operate before you exec TRACE — operate before you exec Triagewho · how muchReviewlast changeAnalyzeEvents · logsCheckdeps · capacityExecutemitigate · cause Impact first. Restarting kind is not step one. Empty Endpoints are a proof, not a feeling.Mitigation restores traffic. Root cause is the sentence you write for Monday.
TRACE is the operate spine after you know your weak bars

Map bars to work

If this bar is lowestDo this next, in order
Containerscontainers.md → images.md → C-01, C-02
Kubernetesk8s-architecture.md → workloads.md → C-08, C-09, C-06
Terraformterraform-fundamentals.md → modules-state.md → C-18, C-22
CI/CDcicd.md → C-24, C-27
Networkingcloud-networking.md + Browser→DB diagram
Cloud FundamentalsSame networking lesson; optional AWS mapping table only
Securitycontainer-security.md + observe-secure.md + C-12
Observabilityobserve-secure.md + RED/USE + SLI/SLO/SLA
TroubleshootingTRACE → D-01, D-09, D-11

Spoken 60-second template after Module 0

“My readiness is [band] at [percent]. Strongest bars are [x] and [y]. I will work [weak1] by walking [specific failure] on the Order API, and [weak2] by [challenge id]. The score is rehearsal. It does not predict hiring.”

If you cannot fill that template, you used the assessment as a quiz, not as a plan.

What “Interview Ready” on Module 0 does *not* mean

You still have not deployed to kind, locked state, or sat a 45-minute mock. Module 0 Interview Ready means the multiple-choice map is in good shape. Module 6 Interview Ready means weighted 1–5 ratings landed 75–84 after a human (or the player) scored the spoken interview.

COMMON MISTAKE: Screenshotting 91 Advanced and skipping the lab. Later interviews break on TRACE order, not on trivia.

SENIOR-LEVEL EXPECTATION: Convert each weak bar into a production symptom (“Services with empty Endpoints,” “two applies, one state key, no lock”).

Weak vs strong answer

Weak: Screenshot 91 Advanced and skip the lab.

Strong: “Kubernetes is my low bar. I will TRACE empty Endpoints on C-08 before I sit Module 6.”

Whiteboard in 60 seconds

  1. Nine bars → two items on a work list.
  2. Deploy, automate, and operate along the journey.
  3. Say the disclaimer: rehearsal, not a hiring prediction.

Follow-up ladder

  1. High Docker, low Kubernetes? → you can build an image and still ship an empty Service.
  2. High Terraform, low TRACE? → you can recite plan and still destroy in a war room.
  3. Module 0 Interview Ready vs Module 6? → multiple choice vs spoken 1–5.

Interview questions

What do I do with a 58 Developing?

Pair bars. Schedule C-01 and C-08. Do not average into “I am a 58.”

Does this predict a hire?

No. It is a weekend rehearsal map.

INTERVIEW TIP: Bring the two weak bars into the mock as questions you *ask them* — “How do you lock S3 state on 1.11+ here?” — so the room sees you already know your gaps.

Certificate reminder

Finishing later modules can unlock a BayLearn course-completion certificate. It is not an industry certification. Do not put “CKA equivalent” on a résumé because this assessment went well.

Next: Module 1 unless your plan says otherwise.

25 scenario questions. Each card is tagged with the skill it scores. Open a card to read the prompt and the four choices.

  1. Linux cannot enforce memory limits on containers; the process is lying and the node is actually OOM.
  2. The container hit its cgroup memory.max (Docker --memory / Kubernetes memory limit). The kernel OOM-kills that cgroup. Host free memory is irrelevant once the container is over its quota.
  3. Node.js ignores cgroups; raise vm.overcommit_memory to 2 so malloc never fails.
  4. 256 MiB is below the kernel's minimum for PID 1, so the runtime always OOMs.

Scored take: enroll, open Learn, then this same lesson. One question at a time. After 15 you see your band and eight skill scores.

You will

  • Defend a production Dockerfile
  • Fix an insecure image without memorizing flags

Containers vs VMs10 min

Containers vs VMs

Containers vs VMs

In one sentence: A container is a process with isolation knobs (namespaces, cgroups, often a union filesystem) sharing the host kernel; a VM is a guest machine with its own kernel on a hypervisor.

The interview distinction

Interviewers are not asking you to hate VMs. They are asking whether you know what is shared. If the kernel is shared, a kernel CVE, a privileged container, or a docker.sock mount is a host problem. If you needed a different kernel, a different sysctl surface, or strong multi-tenant isolation, you wanted a VM (or a separate node pool, or a separate cluster) — not another container on the same kernel.

Containers share a kernel — VMs virtualize hardware Containers share a kernel — VMs virtualize hardware Virtual machineGuest OS per VMHypervisor · slower bootStrong isolation · heavierContainerShared host kernelRuntime + namespaces/cgroupsSeconds to start · denserInterview line: a container is a process with isolation, not a tiny VM.One kernel CVE can still reach every container on the node. That is why you still patch the host.
Container shares the kernel; VM has a guest kernel
DimensionContainerVirtual machine
KernelShared with hostGuest kernel
IsolationNamespaces + cgroups (+ seccomp, capabilities)Hypervisor + guest OS
DensityHigh — process-sizedLower — machine-sized
Start timeSeconds or lessTens of seconds and up
Works well whenSame kernel ABI, app-level packagesUntrusted tenants, other OS, kernel-sensitive workloads
Fails as a story whenYou say “complete isolation”You say “too heavy so we never use them”

Read the diagram, then say: I package the Order API as a container because I want a repeatable filesystem and resource caps, not because I believe it is a tiny VM. I still run those containers on VMs (or a managed node) because the node is the kernel I have to patch.

Namespaces and cgroups — the two halves

Namespaces answer “what can this process see?” PID, mount, network, UTS, IPC, user. The Order API’s 127.0.0.1 is *its* network namespace. That is why binding localhost inside the container does not publish the service to teammates.

cgroups answer “how much can it burn?” Memory max is a kill. CPU max is a throttle. Those are different production symptoms: OOMKilled versus mysterious latency. Host free can look healthy while the container is dead. That is not a contradiction. That is the model.

COMMON MISTAKE: “Containers are isolated like VMs, just faster.” Isolation is a spectrum. Privileged plus hostPath is basically the host.

SENIOR-LEVEL EXPECTATION: Name a case where you would *not* pack two teams on one kernel: hostile multi-tenancy, PCI scope, or a workload that needs a custom kernel module.

What “the container” is not

It is not a full init system unless you put one there. It is not a security boundary you can brag about without capabilities, seccomp, and a non-root user. It is not portable to a different architecture just because the Dockerfile built on your laptop (arm64 vs amd64 is a Module 1 trap).

It is also not Kubernetes. Docker Engine runs a container. Kubernetes schedules Pods (one or more containers) onto nodes. kind gives you a Kubernetes API on Docker; it does not make Docker “production orchestration.”

When a VM is the better isolation boundary

  • You sell a multi-tenant platform and a breakout is a company-ending event.
  • You must run Windows and Linux, or two kernel versions, on the same metal story.
  • Compliance wants a machine identity, not a cgroup.
  • The workload is a nested hypervisor or something that assumes it owns the kernel.

For the Order API in this sprint, a container on a kind node is the right lab boundary. In an interview, say what would make you split node groups or clusters — noisy neighbor, kernel, or blast radius — not “we containerized so isolation is solved.”

Linux extras interviewers actually use (not a second course)

You should be able to talk about:

  • PID 1 — SIGTERM lands here; zombies get reaped here.
  • File descriptors and ulimits — the container can be tighter than the host.
  • Capabilities — USER without dropping CAP_SYS_ADMIN is theater.
  • Bind address — 0.0.0.0 to receive traffic; restrict with policy, not by hoping localhost is “the machine.”
Container network — namespace, veth, bridge, then NAT Container network — namespace, veth, bridge, then NAT Processnetns · eth0veth pairinto the bridgedocker0 / CNIpod CIDRNATegressDNS127.0.0.11 Published ports are DNAT into the namespace. They are not how you expose prod Kubernetes.Two containers on one network can talk by name. Cross-host needs an overlay or CNI.
Container network namespace vs host

Spoken 90 seconds (practice)

“A VM virtualizes hardware and runs a guest kernel. A container is a jailed process on the host kernel: namespaces hide the view, cgroups cap the burn. I use containers for the Order API because I want a digest I can promote. I still patch nodes, drop capabilities, and refuse privileged. If a customer needed hard isolation, I would not put them on the same kernel as checkout.”

Check yourself

If they askDo not sayDo say
Are containers secure?“Yes, they are sandboxes.”“They reduce the package surface. Security is USER, caps, seccomp, and not mounting the host.”
Why not one VM per replica?“VMs are obsolete.”“Density and start time. I still use VMs as nodes.”
Can it reach the host network?“Containers have their own IP so they are isolated.”“Depends on mode: bridge, host, none. host network is a smell for an API.”

How this shows up on the Order API

A replica is a process: one digest, one uid, one cgroup. Three replicas are three processes, not three guest operating systems. They share the node kernel, so a kernel panic or a privileged sibling is a shared fate. That is why node pools and cluster splits exist — not because “Kubernetes wanted more YAML.”

When checkout OOMs, you ask: cgroup limit or node MemoryPressure? When checkout cannot bind, you ask: which network namespace? When SIGTERM does nothing, you ask: who is PID 1? Those three questions are this lesson with a pager.

kind does not change the model. A Pod is still one or more of these processes on a node kernel. Orchestration starts in the next module. Isolation starts here.

Weak vs strong answer

Weak: “Containers are lightweight VMs.”

Strong: “A container is a process with namespaces and cgroups on a shared kernel. A VM has a guest kernel. I still run containers on VMs because I still patch the node.”

Weak: “They are isolated, so we are safe.”

Strong: “Isolation is a spectrum. Privileged plus hostPath is the host. A kernel CVE is a shared fate.”

Whiteboard in 60 seconds

  1. Box the host kernel once. Put two containers on it; put a VM beside it with its own kernel.
  2. Label namespaces (what it sees) and cgroups (what it can burn).
  3. Draw the Order API as three processes, not three guest OS copies.
  4. Write: “kind does not change the kernel model.”

Follow-up ladder

  1. What is shared? → the kernel.
  2. Why can host free look fine? → the cgroup already killed the process.
  3. When is a VM the better box? → hostile multi-tenancy, other OS, kernel modules.
  4. What is PID 1’s job? → signals and reaping.
  5. Why is host networking a smell for an API? → you left the namespace.

Interview questions

Container vs VM — when is each the isolation boundary?

Same kernel vs guest kernel. Density vs breakout risk.

What do namespaces and cgroups each buy you?

View vs burn. OOM vs throttle are different pages.

Is Docker the same as Kubernetes?

Engine runs a container. Kubernetes schedules Pods of those processes.

INTERVIEW TIP: If they pivot to Kubernetes immediately, take one sentence to plant the kernel model. CrashLoop and OOM later will make more sense.

Next: Images, layers, and Dockerfiles.

Images, layers, and Dockerfiles12 min

Images, layers, and Dockerfiles

Images, layers, and Dockerfiles

In one sentence: An image is a stack of immutable layers plus config (user, env, entrypoint); a Dockerfile is a recipe whose instruction order is also a cache and leak policy.

Layers are not a trivia card

Each instruction that changes the filesystem typically adds a layer. Later instructions see the result of earlier ones. If you COPY . . before pip install, every source edit busts the dependency layer. If you COPY .env or RUN cat secret, that blob lives in history even if a later layer deletes the file.

Image layers are a stack — order is a cache decision Image layers are a stack — order is a cache decision FROMbase OS + glibcdeps layerpip / apt · cache meCOPY srcinvalidates oftenUSERnon-rootCMDprocess 1 Copy requirements before source so a code change does not rebuild dependencies.Each RUN is a layer. apt-get update && install && clean in one RUN keeps the image small.
Image layers and cache busts

Read the diagram, then say: I order the Dockerfile from least-changing to most-changing, and I never put a secret in a layer I cannot un-publish.

InstructionWhat it is forInterview trap
FROMBase; pin digest or immutable tag:latest moves under you
WORKDIRDirectory for later commandsForgetting it, then COPY to /
COPYExplicit files from contextContext is huge without .dockerignore
ADDExtra magic (URL, tar)Fetching URLs you cannot pin; surprise extraction
RUNBuild-time commands (layers)apt-get without cleanup; leaking tokens in RUN
ENVRuntime env persisted in configBaking secrets; confusing with ARG
ARGBuild-time only — unless you ENV it--build-arg in CI logs; leftover ENV ${ARG}
EXPOSEDocumentation of a portThinking it opens a firewall
USERDefault uid/gidName without numeric UID; files still owned by root
ENTRYPOINTThe processShell form swallows signals
CMDDefault args to ENTRYPOINTPeople think CMD is “the start command” always
HEALTHCHECKEngine-level checkNot a Kubernetes probe; different failure domain

Prefer COPY over ADD unless you have a pinned, understood reason. Prefer numeric USER. Prefer exec form JSON arrays.

RUN vs CMD vs ENTRYPOINT

This trio trips more people than multi-stage.

  • `RUN` happens at build. It installs packages, compiles, copies artifacts between stages. It is not what starts the Order API at 3 a.m.
  • `ENTRYPOINT` is the process Kubernetes will run (unless the Pod overrides command). Make it the server, or tini then the server.
  • `CMD` supplies default arguments. If ENTRYPOINT is the binary, CMD can be ["--port", "8080"]. If you only set CMD and no ENTRYPOINT, CMD is the process.

Both set: entrypoint is the binary, cmd is args. Override in Kubernetes with command / args — know which one you are replacing.

Shell form vs exec form: CMD npm start runs under /bin/sh -c. PID 1 is the shell. SIGTERM may not reach Node. CMD ["node", "server.js"] makes node PID 1 if it is the entrypoint. For a shell you cannot avoid, use tini or exec in a small script.

dockerfile

# Interview-correct shape (sketch)
FROM python:3.12-slim@sha256:… AS runtime
WORKDIR /app
COPY --from=build /app/.venv /app/.venv
COPY app ./app
USER 10001
EXPOSE 8080
ENTRYPOINT ["/app/.venv/bin/python", "-m", "uvicorn"]
CMD ["app.main:app", "--host", "0.0.0.0", "--port", "8080"]

COMMON MISTAKE: CMD python app.py plus a Kubernetes livenessProbe that kills a process that never received SIGTERM. You will see 137s and dropped in-flight work.

SENIOR-LEVEL EXPECTATION: Explain how a Pod command overrides image ENTRYPOINT, and why a platform team pins that in the golden manifest so app teams cannot silently swap PID 1.

Multi-stage builds

Multi-stage — compilers stay out of the runtime image Multi-stage — compilers stay out of the runtime image Stage: buildervenv · pip installcompilers · headersCOPY --fromonly /opt/venv + srcStage: runtimeslim base · USER 10001no gcc · no pip cache Ask: what is still in the final image? Secrets, .git, and tests should not be.Pin a tag (python:3.12-slim-bookworm). :latest is not a supply-chain strategy.
Builder stage stays behind; runtime copies the artifact

Why: compilers, headers, test toolchains, and SSH clients do not belong in the thing that serves checkout. You build in a fat stage and COPY --from=build the artifact into a slim or distroless stage.

What multi-stage does not fix: a 2 GB build context, a secret in the builder stage that you also copied, a final stage that COPY --from=build / the entire builder, or a runtime that still runs as root.

Distroless/scratch: smaller attack surface, harder debug (kubectl exec has no shell). That is an operational trade-off you should name, not a religion.

Cache, context, and Compose

Cache misses: instruction text changed, a copied file changed, or --no-cache / BuildKit mount mistakes. Debug by reading which step invalidated, not by turning cache off forever.

.dockerignore is a security and performance control. If context is the git root, you send .git, tests, local venvs, and sometimes .env. CI gets slow and flaky; leak risk goes up.

Compose is the right tool for a laptop Order API + Postgres. It is not production Kubernetes. Say when you stop: you need a scheduler, rolling updates, and a cluster API — that is kind in this sprint, and a managed cluster in production talk.

Image identity

The image in your daemon and the tag in the registry can diverge. Tags move. Digests do not. Production apply and GitOps should pin @sha256:…. Humans can still say orders:1.14 in chat; the cluster should not float.

Weak vs strong answer

Weak: “I use latest so we always get patches.”

Strong: “I pin a digest. Tags move. Promotion is the same bytes staging already ran.”

Weak: “CMD starts the app; RUN is the same thing at boot.”

Strong: “RUN is build. ENTRYPOINT is PID 1. CMD is default args. Exec form so SIGTERM lands.”

Whiteboard in 60 seconds

  1. Stack FROM → deps → COPY src → USER → CMD.
  2. Circle the cache bust: source before lockfile.
  3. Draw a fat builder and a slim runtime with COPY --from.
  4. Write @sha256:… under the registry, not :latest.

Follow-up ladder

  1. COPY vs ADD? → COPY unless you have a pinned reason.
  2. ARG vs ENV? → build-time vs persisted; do not ENV a secret ARG.
  3. Why .dockerignore? → context is a leak and a slow CI.
  4. Does EXPOSE publish? → no.
  5. HEALTHCHECK vs probes? → Engine vs kubelet.

Interview questions

Why does instruction order matter?

Cache and leak policy. A secret in an early layer is still in history.

What does multi-stage not fix?

A 2 GB context, COPY --from=build /, or a root runtime.

How do you identify the production image?

Digest. Humans can say 1.14 in chat; the cluster pins @sha256.

INTERVIEW TIP: If they ask HEALTHCHECK vs probes: Engine HEALTHCHECK is for docker run / Compose. Kubernetes will not honor it as readiness. You still write probes on the Pod.

Next: Build optimization and container security.

Build optimization and container security13 min

Build optimization and container security

Build optimization and container security

In one sentence: A fast, small image that still runs as root with a socket mount is not a win. Speed the cache and shrink the attack surface in the same pass.

Security is a production property

Interviewers do not want a CIS dump. They want you to name what a bad image does at 2 a.m.: a leaked npm token in layer history, a container that escaped via docker.sock, a UID 0 process that wrote into a hostPath, or a scanner that you ignored because “it is only critical in the builder stage” when that stage *is* the final image.

Runtime image — non-root, no secrets, no compiler Runtime image — non-root, no secrets, no compiler Pin digestnot :latestMulti-stageno gcc in prodUSER 10001drop capsRefusedocker.sockprivileged · .envA small image that still runs as root with a socket mount is not a win.Scan and sign in CI. Verify at deploy. History keeps every secret you COPY.
Non-root, no secrets, minimal final stage
Multi-stage — compilers stay out of the runtime image Multi-stage — compilers stay out of the runtime image Stage: buildervenv · pip installcompilers · headersCOPY --fromonly /opt/venv + srcStage: runtimeslim base · USER 10001no gcc · no pip cache Ask: what is still in the final image? Secrets, .git, and tests should not be.Pin a tag (python:3.12-slim-bookworm). :latest is not a supply-chain strategy.
Builder stays behind; runtime copies the artifact

Secure Dockerfile checklist (teach, then download)

ControlWhy it fails in production
Pin base by digest:latest on Monday is not Friday’s build
Multi-stage; no compiler in runtimeExtra packages are extra CVEs and extra shell
.dockerignoreSecrets and .git enter context
No secrets in ENV / COPY / `RUN curl \bash`History is forever; rotate is a fire drill
BuildKit secret mounts for tokensARG still shows up in docker history if misused
Numeric non-root USERAdmission runAsNonRoot; volume permissions
Drop capabilities; no privilegedPrivileged is host root with extra steps
No SSH daemon “for debug”You just shipped a remote-login API
HEALTHCHECK or document probesSilent death vs traffic still landing
SBOM + scan in CIScanner is a signal, not a proof of safety

COMMON MISTAKE: USER app but /app is root:root mode 700. The process dies on EACCES and someone “fixes” it with chmod 777.

SENIOR-LEVEL EXPECTATION: Separate build identity from runtime identity. CI uses OIDC to push. The running uid cannot pull or overwrite the production tag.

Networking and volumes (container scope)

Bridge / default: container has its own namespace; you publish a port to the host if a human must hit it. Host: the process shares the host stack — useful for some agents, a smell for the Order API. None: no NIC; you must be doing something very specific.

EXPOSE does not publish. Publish is -p or a Kubernetes Service.

Writable layer vs volume: the writable layer dies with the container and is a poor database. Named volumes and bind mounts have permission stories: the uid in the container must match what the volume already has. EACCES after you “fixed the mount” is usually uid/gid, not “Docker is broken.”

Do not store checkout data only in the overlay. Do not bind-mount / or the Docker socket to “make CI easier.”

Privileged, sockets, and DinD

privileged: true widens device access and almost all capabilities. It is rarely the fix for “my container cannot listen on 80” (CAP_NET_BIND_SERVICE or listen on 8080 instead).

Mounting /var/run/docker.sock is host root. A job that builds images should use a sandboxed builder (BuildKit remote, kaniko-style, or a dedicated builder) — not a privileged DinD sidecar as the golden path. Platform interviews stop people who productize the socket.

Scanning, SBOMs, signing

A scanner tells you known CVEs in the packages it can see. It does not tell you the app is safe, the Dockerfile is honest, or the running digest matches the signed attestation. Signing matters only if admission or the deploy robot verifies. Cosign in CI with no verify is a sticker.

Triage CVEs by reachability and whether the bit is in the *final* image. Do not block the company on a compiler CVE that never shipped — and do not ignore a crypto CVE in the runtime stage because the ticket is noisy.

Optimization that is actually senior

  1. Copy lockfiles / requirements.txt before source.
  2. Use BuildKit cache mounts for package managers in CI — without copying the whole monorepo first.
  3. Multi-arch: build linux/amd64 on purpose when nodes are amd64. Laptop arm64 success is not production.
  4. Do not squash “for security.” Squash can destroy cache and does not remove secrets already published.
  5. Do not mutate a running container to patch an incident. Bake a digest and roll. Mutation is the snowflake you will page about next week.

Spoken 90 seconds

“I pin a digest, build in a fat stage, copy a venv or binary into slim, drop to UID 10001, and keep secrets out of layers with BuildKit mounts. I publish 8080, not 22. I scan and sign in CI, and I verify at deploy. Privileged and docker.sock are not platform features.”

Challenges that lock this in

C-01 insecure Dockerfile, C-02 size, C-03 cache, C-04 startup bind, C-05 permissions. Do at least C-01 and C-03 before Module 2.

Review a Dockerfile out loud (90 seconds)

  1. What is PID 1, and will it see SIGTERM?
  2. Which layer last changed, and did that bust the dep cache?
  3. Is there a secret in history even if the file is gone?
  4. Who is the user, numerically, and can it read /app?
  5. What would a scanner miss that admission would catch (root, sock, privileged)?

If you can grade a stranger’s gist on those five, you are ready for C-01.

Weak vs strong answer

Weak: “We scan, so the image is safe.”

Strong: “Scan is a signal. I pin, drop to 10001, keep secrets out of layers, and verify the digest at deploy.”

Weak: “Privileged fixed the bind on 80.”

Strong: “Listen on 8080 or add CAP_NET_BIND_SERVICE. Privileged is host root with extra steps.”

Whiteboard in 60 seconds

  1. Pin → multi-stage → USER 10001 → refuse sock / privileged / .env.
  2. Show BuildKit secret mount vs ARG in history.
  3. Write: “CI identity ≠ runtime identity.”

Follow-up ladder

  1. Why numeric USER? → admission runAsNonRoot; name-only can still be 0.
  2. Why not docker.sock? → host root.
  3. What does a scanner miss? → a secret you already published; a root process.
  4. Squash for security? → no. Cache dies; history may already be public.
  5. Arm64 laptop vs amd64 node? → build the platform the node runs.

Interview questions

What belongs in the final image?

The binary or venv, a slim base, a numeric user. Not gcc, .git, or .env.

How do you handle a CVE?

Reachability in the *final* image. Do not halt on a builder-only compiler you did not ship.

INTERVIEW TIP: If they say “we run as root because the app writes to /tmp,” the answer is a writable emptyDir or a directory you chown in the Dockerfile — not root.

Next: Module 2 — Kubernetes.

You will

  • Explain readiness vs liveness
  • Trace a request from Ingress to Pod

Cluster architecture and core objects15 min

Cluster architecture and core objects

Cluster architecture and core objects

In one sentence: Kubernetes is a control loop: you write desired state, controllers reconcile it onto nodes. You do not need to memorize every internal to pass a DevOps interview.

Useful control plane — not a trivia recitation

Interviewers want to know who to look at when the API is slow, when a Pod stays Pending, or when a node dies. They do not want a list of every etcd flag.

Cluster — control plane decides; nodes run pods Cluster — control plane decides; nodes run pods API serveronly public brainetcddesired + actualschedulerbinds to a nodecontrollersreconcilekubeletnode agent + runtimeYou never 'talk to the scheduler'. You write objects; controllers converge.If the API server is down, kubectl fails. Workloads already running keep running.
Control plane and a worker node at interview depth
PieceJob in one sentenceWhen it shows up in an incident
API serverAuthenticated front door to cluster stateAuth errors, admission denials, “cannot list pods”
etcdDesired and observed state storeAPI latency, lost writes if you treat it casually
SchedulerBinds Pods to nodes using requests and constraintsPending, unschedulable, affinity mistakes
Controller managerReplicaSets, Deployments, Jobs, … chase specReplica count wrong, Job not completing
kubeletNode agent: runs Pods, reports status, runs probesNotReady, probe failures, image pull
kube-proxy / data pathService ClusterIP → Endpoints / EndpointSlicesEmpty Endpoints, conntrack, unexpected policy
CNIPod IP, often overlayMTU black holes, “node works, pod cannot”
CoreDNSCluster DNSSearch/ndots, NXDOMAIN, NetworkPolicy forgot 53

Do not memorize every controller. Do say: I change a Deployment; a ReplicaSet appears; Pods appear; kubelet pulls and starts; probes update Ready; the Service’s EndpointSlice gains IPs.

kind in this sprint runs that API on Docker. It is a real Kubernetes API with one or more Docker-backed nodes. It is not minikube. It is not EKS. Portable workload YAML should work here; cloud annotations belong in an overlay you can leave off the lab.

COMMON MISTAKE: Drawing fifteen boxes and then failing to say where kubectl apply lands (API server) or where a probe runs (kubelet).

SENIOR-LEVEL EXPECTATION: Admission webhooks sit in front of persist. Fail-closed vs fail-open is a platform incident, not a trivia item.

Pods are the atom

A Pod is the schedulable unit: one or more containers, shared network namespace, shared volumes you declared. Kubernetes does not place “a container” on a node. It places a Pod.

That is why sidecars share localhost with the app, why a second container can share a volume, and why you almost never run a lonely container as the production abstraction.

Pods are mortal. You do not SSH in and upgrade them. You replace them via a controller.

Core objects around a Pod — controllers own the atom Core objects around a Pod — controllers own the atom NamespaceDeploymentReplicaSetPodServiceCM / SecretYou write a Deployment. Controllers create the ReplicaSet and Pods. Service selects Ready.A lonely Pod is a debug object. Production is a controller plus a selector you can prove.
Core objects around a Pod
ConfigMap vs Secret — injection is the same; safety is not ConfigMap vs Secret — injection is the same; safety is not ConfigMapAPP_ENV · feature flagsenv or volumenot for tokensSecretbase64 in etcd — not encryptionRBAC still sees decodeuse a manager in prodInterview line: Secrets are not magically secure. They are namespaced objects.This lab ships dummy values only. Never bake credentials into the image.
ConfigMap vs Secret — same injection, different safety

Desired versus observed

You write replicas: 3 and a container port. The cluster reports Ready 2/3 and Events. Debugging is reconciling the gap, not deleting everything so the gap disappears.

kubectl get / describe / Events / logs are how you read observed state. apply / GitOps is how you change desired state. kubectl edit in production without a revert path is how GitOps clusters drift (Q-167).

Core objects you must speak

ObjectYou should be able to say
NamespaceSoft tenancy and RBAC boundary — not a hard security wall
PodAtom; IP; probes; resources
ReplicaSetOwns Pods matching a selector; usually created by a Deployment
DeploymentRolling updates, revision history, the usual API app
ServiceStable virtual IP + selector → Endpoints
Ingress / GatewayL7 (or specialized) entry; needs a controller
ConfigMapNon-secret config; still can break prod if you mount it wrong
SecretAPI object, base64 in the default representation, not magically secure
PVC / PVStorage claim vs provisioned volume
Job / CronJobRun-to-completion; concurrency policy matters
DaemonSetOne per node (or per selected node) — agents, not checkout replicas
ServiceAccount + RBACWho the Pod is to the API

StatefulSet, HPA, PDB, NetworkPolicy get depth in the next two lessons. Helm/Kustomize are optional overlays, not a four-hour requirement.

Secrets are not a vault

A Kubernetes Secret is a namespaced API object. By default, values are base64 in YAML — that is encoding, not encryption. etcd may be encrypted at rest. That still means anyone with get secrets in the namespace can read them. They appear as env or files in the Pod. They show up in backups.

Say this to close: encrypt etcd, tight RBAC, no Secrets in git, and a real secret manager or workload identity for production credentials. Sealed/SOPS/external operators are tactics. The object is not magic.

kind versus “a real cluster”

kind is a Kubernetes API. Controllers reconcile. kubelet on the kind node runs your Pod. What you may not have: a cloud LoadBalancer controller, an Ingress controller until you install one, IAM roles for service accounts, multi-AZ nodes. That absence is a teaching feature. If the YAML needs an annotation to schedule, it was not portable.

Do not spend interview minutes comparing kind to minikube. This sprint does not use minikube.

If they ask “is kind production?” the answer is no — it is the API you can operate without a bill. Production is the same objects plus node pools, an edge, and identity. YAML you cannot run on kind without a cloud annotation was never portable.

Weak vs strong answer

Weak: Recites fifteen control-plane boxes, then cannot say where kubectl apply lands.

Strong: “Apply hits the API server. Controllers reconcile. kubelet runs probes. I debug the gap between spec and status.”

Weak: “Secrets are encrypted, so they are safe.”

Strong: “Default YAML is base64. Anyone with get secrets can read them. I want etcd encryption, tight RBAC, and a real manager.”

Whiteboard in 60 seconds

  1. API server + etcd + scheduler + controllers on one side; kubelet on the node.
  2. Deployment → ReplicaSet → Pod; Service beside it.
  3. Arrow: apply into the API, not into the scheduler.

Follow-up ladder

  1. Where does apply persist? → API server / etcd.
  2. Why is a Pod Pending? → scheduler could not bind (requests, taints, PVC).
  3. Why is a Pod CrashLoop? → kubelet started it; the process died.
  4. Is kind production? → no. Same objects; no cloud controller until you add one.
  5. What is a Secret really? → a namespaced object, not a vault.

Interview questions

What happens after I apply a Deployment?

ReplicaSet appears, Pods bind, kubelet pulls, probes flip Ready, EndpointSlice gains IPs.

kind vs EKS?

kind is the API you can operate without a bill. Portable YAML should run here. Cloud annotations belong in an overlay.

INTERVIEW TIP: If they ask you to list every kube-system DaemonSet, redirect: “I can talk about CoreDNS and the node agent. I do not memorize the addon inventory of every cluster.”

Next: Deployments, Services, probes, resources.

Deployments, Services, probes, resources15 min

Deployments, Services, probes, resources

Deployments, Services, probes, resources

In one sentence: A Deployment keeps a replica set of Pods; a Service load-balances to Ready Pods; probes and requests decide who gets traffic and who fits on a node.

Deployment and ReplicaSet

A Deployment owns ReplicaSets. Each roll creates (or reuses) an RS with a new pod-template hash. You almost never create an RS by hand. You almost never kubectl delete pod as the *design* — the RS will replace it. Deleting a pod is a debug move. It is not a deploy strategy.

Rolling update: maxUnavailable / maxSurge, readiness, and a progress deadline. “Not all at once” is not enough. A safe roll means new pods become Ready before you take too many old ones, PDBs allow drain, and you can undo or halt.

Traffic — Deployment to Service to Ready pods Traffic — Deployment to Service to Ready pods Deploymentdesired replicasReplicaSettemplate hashReady podsprobes passServiceonly Ready IPs A rolling update creates a new ReplicaSet and drains the old one behind readiness.kubectl delete pod is a debug move. The ReplicaSet will replace what you meant.
Workload traffic: Deployment to Service to Ready pods
Deployment owns ReplicaSets; ReplicaSets own Pods Deployment owns ReplicaSets; ReplicaSets own Pods Deploymentrollout · pause · undoReplicaSetN copies of a templatePodone or more containers A rolling update creates a new ReplicaSet and drains the old one.You almost never create a bare Pod in production. Controllers restart what you meant.maxUnavailable: 0 keeps capacity during the surge — if the cluster has room.
Deployment owns ReplicaSets; ReplicaSets own Pods

Services — pick the right type on purpose

Service types — ClusterIP is the production default Service types — ClusterIP is the production default ClusterIPeast-west VIPproduction defaultNodePorthigh port on every nodelab / break-glassLoadBalancercloud or dummyneeds a controllerNodePort is not how you expose the internet. Ingress sits in front of ClusterIP.Empty Endpoints mean the selector or readiness is wrong — not 'the Service is broken'.
ClusterIP, NodePort, LoadBalancer
TypeWhat it doesProduction default?
ClusterIPVirtual IP inside the clusterYes for east-west. This is the default.
NodePortOpens a high port on every nodeTutorial / break-glass / some bare-metal. Not the default internet path.
LoadBalancerAsks the cloud (or a dummy in kind) for an external LBInternet or private LB when a controller can provision one

Why NodePort is not “how we expose prod”: you leak a port on every node, you skip L7 routing and certs at the edge, and you teach the team the wrong default. kind may show NodePort for laptop demos. Say that out loud so they know you are not confusing the lab with the internet.

Selector and ports: if labels do not match the Pod template, Endpoints stay empty. If targetPort ≠ containerPort, you get refused or silence. kubectl get endpoints / EndpointSlice is the first proof, not curl from your laptop.

Headless Services (clusterIP: None) return Pod IPs — useful for StatefulSets, not for a typical Order API.

Ingress and Gateway

An Ingress (or Gateway API) is not a replacement for ClusterIP. It is an L7 (or specialized) rule set in front of Services. Something must implement it (ingress-nginx, Gateway controller, cloud controller).

Ingress is L7 at the edge — Service stays ClusterIP Ingress is L7 at the edge — Service stays ClusterIP ClientIngresshost / path / TLSClusterIPin-cluster VIPPodsreadiness gates traffic Ingress is an API object. A controller (nginx, gateway, cloud LB) makes it real.kind has no controller until you install one. The manifest is still the interview shape.
Browser to Ingress to Service to Pod

Path: Browser → DNS → load balancer → Ingress/Gateway controller → Service ClusterIP → kube-proxy/datapath → Pod IP:containerPort. Module 4 expands this to the database. Here, remember: 502 often means the controller could not get a Ready backend, not “Kubernetes is down.”

kind: install a controller if you want real Ingress. Without one, Ingress objects sit idle. That is a common lab false-negative.

ConfigMaps and Secrets

ConfigMaps are for non-secret config. Mount as files if you need atomic-ish updates and signals; env vars are simple and require a roll to refresh.

Secrets: same mount/env mechanics. Still not a vault. Do not check them into git. Do not log them. Prefer workload identity over long-lived keys in Secret objects (Module 4).

A missing key is D-21. A Secret that exists but is the wrong key name is an env-from miss — the Pod may CrashLoop on start.

Probes — three jobs, three disasters if swapped

Startup, then Ready vs Live — drain versus restart Startup, then Ready vs Live — drain versus restart startupProbeoptional · slow bootdisables the othersreadinessProbein Service?fail → no trafficlivenessProbestill healthy?fail → restartWrong mix/health hits DBkill loop on blipLiveness must be cheap. Readiness may check config or a dependency.A 503 on /ready is a drain. A 503 on /health is a reboot. That is the TRACE split.
Startup, liveness, readiness
Requests place the pod — limits cap the process Requests place the pod — limits cap the process requestsscheduler mathCPU millicores · memorynode allocatablefits or PendinglimitsCPU throttlememory → OOMKill No requests: the pod is invisible to packing. Noisy neighbor.Limit below working set is the 'low memory' break-fix. describe shows OOMKilled.
Requests place the pod — limits cap the process
ProbeQuestion it answersIf you get it wrong
startupProbeHas the process finished booting?JVM/Python cold start killed by liveness
readinessProbeShould this Pod receive Service traffic?Traffic to a warming or dependency-broken replica
livenessProbeIs this process so stuck it should be restarted?Restart storm; self-DoS if it hits Postgres

Readiness may check a cheap dependency (or a local “I can serve 503”). Liveness should be local and cheap — “the event loop answers,” not “the database in another AZ answers.” If liveness depends on Postgres and Postgres blips, kubelet restarts every replica and you turn a blip into an outage.

Timeouts and failureThreshold are part of the design. A 1-second timeout on a 3-second GC is a flap.

Docker HEALTHCHECK ≠ these probes. Compose may use HEALTHCHECK; the cluster uses the Pod spec.

Requests, limits, QoS

FieldSchedulerRuntime
CPU requestFits the nodeBaseline for HPA / overcommit story
CPU limit—Throttle (latency), does not OOM
Memory requestFits the nodeBest-effort vs guaranteed
Memory limit—cgroup OOM kill (137 / OOMKilled)

Set neither: scheduler treats you as BestEffort; you are first to evict, and you can starve neighbors. Set only limits: request defaults to limit in some interpretations — know what *your* cluster does, and still set both explicitly in interviews.

QoS: Guaranteed (req = lim for all), Burstable, BestEffort. Eviction and MemoryPressure care.

COMMON MISTAKE: Raising memory limit because you saw CPU throttle — or raising CPU because you saw OOMKilled.

SENIOR-LEVEL EXPECTATION: Show a probe path that cannot take the whole fleet down, and requests that match the working set you measured, not a guess from a tutorial.

kubectl as support, not the answer

Know the commands. Do not perform them:

text

kubectl get deploy,po,svc,ep -n orders
kubectl describe pod <name>          # Events, probe, image, node
kubectl logs <name> --previous       # last crash
kubectl get replicaset,endpoints
kubectl rollout status deploy/orders
kubectl top pod                      # if metrics-server exists

The answer is the model. The commands are how you read it.

Weak vs strong answer

Weak: “We expose prod with NodePort because that is what the tutorial used.”

Strong: “ClusterIP east-west. Ingress or a gateway north-south. NodePort is a lab shortcut.”

Weak: “Liveness hits Postgres so we know the app works.”

Strong: “Liveness is local and cheap. A DB blip must not restart the fleet. Readiness may drain.”

Whiteboard in 60 seconds

  1. Deployment → ReplicaSet → Ready pods → Service.
  2. Ingress in front of ClusterIP, not instead of it.
  3. Three probes labeled: boot / traffic / restart.
  4. Requests for packing; memory limit for OOMKill.

Follow-up ladder

  1. Why empty Endpoints? → labels or not Ready.
  2. What does a rolling update create? → a new ReplicaSet.
  3. HEALTHCHECK vs probes? → Engine vs kubelet.
  4. CPU limit vs memory limit? → throttle vs kill.
  5. Why maxUnavailable: 0 can still fail? → the cluster has no room to surge.

Interview questions

Readiness vs liveness?

Drain vs restart. Swap them and you get a restart storm or traffic to a warming pod.

Default Service type in production?

ClusterIP. Prove it with kubectl get endpoints.

Challenges: C-06 CrashLoop, C-08 selector, C-09 probe, C-10 resources, C-11 ConfigMap, C-12 Secret, C-13 rollout, C-14 Ingress.

Next: Scheduling, scaling, security, troubleshooting.

Scheduling, scaling, security, troubleshooting15 min

Scheduling, scaling, security, troubleshooting

Scheduling, scaling, security, troubleshooting

In one sentence: The scheduler places work that fits; HPA scales on a signal you chose; security is RBAC, admission, and NetworkPolicy; troubleshooting is TRACE plus Events — not delete --all.

Scheduling

The scheduler binds a Pod to a node when requests fit leftover allocatable, and when taints/tolerations, affinity, topology, and PVC constraints allow it.

Pending is not CrashLoop. Pending is: unschedulable, PVC unbound, nodeSelector that matches nothing, or insufficient CPU/memory requests. describe the Pod and read Events. Image pull happens *after* schedule — ImagePullBackOff is a different state (D-03).

Requests place the pod — limits cap the process Requests place the pod — limits cap the process requestsscheduler mathCPU millicores · memorynode allocatablefits or PendinglimitsCPU throttlememory → OOMKill No requests: the pod is invisible to packing. Noisy neighbor.Limit below working set is the 'low memory' break-fix. describe shows OOMKilled.
Requests, packing, HPA
HPA changes replica count from a metric — not from hope HPA changes replica count from a metric — not from hope MetricCPU / custom / QPSHPAmin · max · targetDeploymentreplicas N → MPodsneed headroom HPA is stuck if the metrics server is missing — kind does not ship one.Scale the Deployment. Do not scale a bare Pod. Requests must exist or CPU % is fiction.
HPA changes replica count from a metric
StatefulSet — stable identity plus a volume per ordinal StatefulSet — stable identity plus a volume per ordinal StatefulSetdb-0 · db-1 · db-2Headless ServiceDNS per podPVC per ordinalsurvives rescheduleStorageClassprovisioner A Deployment + emptyDir is not a database. Identity and disks are the point.Deleting the StatefulSet can keep PVCs. That is a cleanup question, not a trivia one.
StatefulSet — stable identity plus a volume per ordinal

taints/tolerations keep checkout off a tainted system pool unless you meant it. affinity is a preference or a requirement — say which. topologySpread is how you avoid one AZ holding all replicas.

HPA

Horizontal Pod Autoscaler changes replica count from a metric (CPU, memory, or custom). CPU-only HPA flaps on JVM warmup and on throttle from a tight limit. You need:

  • A stable metric that tracks user pain or true load
  • Stabilization windows
  • Min/max that a PDB and the cluster can actually absorb
  • Requests that make “80% CPU” mean something

HPA does not add nodes. Cluster autoscaler / node pools do. Cloud interviews that mix “VM ASG” and “HPA” want both named (Q-190).

StatefulSet — do not put every database in Kubernetes

StatefulSet gives stable identity (ordinal names, stable storage per identity, ordered start/stop if you asked). Use it when the app protocol needs that identity (some brokers, some clustered data stores you truly operate).

Do not put every Postgres in-cluster because “we are a Kubernetes shop.” You then own backups, failover, storage classes, upgrades, and restore drills. A managed database is often the senior answer. If you do run data in-cluster, say the storage class, backup, and what happens when a node dies.

DaemonSet is the opposite shape: one per node (agents). Using it for a horizontally scalable API is a design error.

Jobs/CronJobs: restartPolicy, backoff, and concurrencyPolicy so a 5-minute job does not overlap itself into a thundering herd.

Networking and security

Four identities — pod IP, ClusterIP, Ingress host, node Four identities — pod IP, ClusterIP, Ingress host, node Pod IPephemeral · CNIClusterIPstable VIPIngress / GWL7 name + TLSNetworkPolicydefault denyEast-west: Service DNS. North-south: Ingress or a gateway — not NodePort as design.NetworkPolicy is allow-lists. Without a plugin that enforces it, the YAML is theater.
Four identities — pod IP, ClusterIP, Ingress, policy

Services + DNS: http://orders uses search/ndots. Cross-namespace, prefer FQDNs (orders.payments.svc.cluster.local). NetworkPolicy default-deny without allowing DNS and the probe path will look like “the mesh is down.”

RBAC: deploy robot gets apply in one namespace. Humans get debug. Cluster-admin in CI is an incident (Module 4).

Pod Security Admission / policy engines: restricted mode blocks root, hostPath, privileged. Roll it out namespace by namespace. Fail-closed admission is a platform outage if the webhook dies — decide that on purpose (mock M-03).

hostPath and privileged are cluster-level risks, not app conveniences.

PDB: protects voluntary disruption (drain, upgrade). It does not stop a node dying or an OOM of every replica. minAvailable == replicas can deadlock a drain.

Troubleshooting framework

Operating means TRACE (DEPLOY-IT):

  1. Triage impact — which users, which SLI, 5% or 50%
  2. Review recent changes — image, Terraform, flag, node recycle
  3. Analyze signals — Events, logs, traces, describe
  4. Check dependencies & capacity — DNS, disk, endpoints, downstream Ready-but-wrong
  5. Execute mitigation, then root cause — halt roll, rollback, cordon; then fix the probe or the selector
TRACE — operate before you exec TRACE — operate before you exec Triagewho · how muchReviewlast changeAnalyzeEvents · logsCheckdeps · capacityExecutemitigate · cause Impact first. Restarting kind is not step one. Empty Endpoints are a proof, not a feeling.Mitigation restores traffic. Root cause is the sentence you write for Monday.
TRACE on a Kubernetes incident
SymptomFirst proofsTypical miss
CrashLoopBackOfflogs --previous, describe, exit codeDelete pod so logs vanish
PendingEvents, requests vs allocatable, PVCTreat as image pull
ImagePullBackOffSecret, digest, node archWorks on one node (cached)
Empty EndpointsLabels, readiness, targetPort“Service is broken”
502 at IngressReady backends, controller logsRestart CoreDNS first
OOMKilledLast state 137, limit vs working setAdd nodes, ignore cgroup
CPU latencythrottle, limitRaise memory

Download kubernetes-troubleshooting.md after you can fill that table without looking.

kubectl cheat sheet (support)

text

# placement and health
kubectl describe pod POD | less
kubectl get events --sort-by=.lastTimestamp
kubectl get nodes -o wide
kubectl auth can-i list secrets -n orders

# traffic
kubectl get ep,endpointslice -n orders
kubectl get ingress -A
kubectl exec -it POD -- wget -qO- http://orders:8080/health

# roll
kubectl rollout history deploy/orders
kubectl rollout undo deploy/orders --to-revision=N

exec is after TRACE, not instead of it. In GitOps clusters, rollout undo is a mitigation that you must follow with a git revert or you will fight the sync.

COMMON MISTAKE: kubectl delete ns or restarting kind because one Service selector was wrong.

SENIOR-LEVEL EXPECTATION: Narrate TRACE on D-01 or D-09 in 90 seconds without listing twenty commands.

INTERVIEW TIP: kind-only lab: “I proved the YAML here. On EKS I would add the cloud controller and IRSA; the probes and selectors stay.”

Weak vs strong answer

Weak: “Pending means the image is bad.”

Strong: “Pending is unschedulable. ImagePullBackOff is after bind. I read Events before I pull.”

Weak: “Put every database in a StatefulSet — we are a Kubernetes shop.”

Strong: “StatefulSet is identity plus disks. A managed database is often the senior answer. If I run data in-cluster I own backup and restore.”

Whiteboard in 60 seconds

  1. Requests → node allocatable → bind or Pending.
  2. HPA → Deployment replicas. Cluster autoscaler → nodes.
  3. TRACE letters across the top of the incident.

Follow-up ladder

  1. HPA stuck at 1? → no metrics server, or no CPU requests.
  2. PDB deadlock? → minAvailable == replicas during drain.
  3. NetworkPolicy looks like an outage? → you forgot DNS or probes.
  4. kubectl edit in GitOps? → freeze sync, then PR, or the reconciler fights you.

Interview questions

HPA vs cluster autoscaler?

Pods vs nodes. Mixing “ASG” and “HPA” without naming both fails cloud interviews.

Walk CrashLoop in TRACE.

Impact → last change → logs --previous → mitigate (halt roll) → cause (bad probe, bad image, OOM).

Challenges C-07, C-15. Scenarios D-01–D-10, D-20–D-22.

Next: Module 3 — Terraform.

You will

  • Explain why production state is not committed to Git
  • Recover from a lock or unexpected replacement safely

Providers, plan/apply, and state14 min

Providers, plan/apply, and state

Providers, plan/apply, and state

In one sentence: Terraform is a graph of desired resources; plan diffs that graph against state (refreshed from the world); apply mutates the world and rewrites state.

The workflow you should say in order

init → plan → apply — review the plan like a pull request init → plan → apply — review the plan like a pull request initproviders · modulesbackendplandiff vs stateapplyconvergedestroysame code, reverse Never apply a plan you did not read. Targeted apply is an exception, not a habit.This lab validates locally with no AWS credentials. Cloud apply is optional.
init, plan, apply, and state
CommandWhat it is really doing
initDownload providers/modules; configure the backend
validateSyntax and type-ish checks — not a plan
fmtStyle; CI should check it
planRefresh (unless you skipped it), walk the graph, print the diff
applyTake the lock, apply the graph, write state
destroyInverse apply — rarely the incident tool

You do not “run Terraform.” You propose a plan and apply a known plan. In CI: save the plan file, require review, apply that file. Laptop apply on production is a control-plane failure (Module 6 platform mode).

Providers talk to APIs (hashicorp/aws >= 5.80, hashicorp/kubernetes 2.38+/3.x in this sprint’s policy). Pin provider versions. A surprise provider upgrade is a surprise replacement.

What state actually is

State is Terraform’s memory: address aws_s3_bucket.artifacts → real bucket name, plus attributes and dependencies it last saw. Without state, Terraform cannot know what it already created. It will want to create duplicates or will refuse.

State is the source of truth — the cloud is the messy world State is the source of truth — the cloud is the messy world Code*.tf · desiredStateIDs · attributescan hold secretsReal infradrift happens Refresh reads the world into memory; apply writes the next state.Commit code, never *.tfstate. If state is gone, Terraform wants to create duplicates.
State as the map between addresses and real objects

State often contains secrets (database passwords, private keys). It is not a document for git. It is not a whiteboard. Local terraform.tfstate on a laptop is how two engineers create two buckets and one outage.

Refresh updates state from the API so plan sees drift. Skipping refresh to “go faster” hides someone else’s console click.

COMMON MISTAKE: “State is just a cache; I can delete it if apply looks weird.” Deleting state orphans real infrastructure. The next apply may create a second of everything — or fail halfway and make it worse.

SENIOR-LEVEL EXPECTATION: Explain that two root modules must not manage the same object. Split-brain state is worse than no lock.

Variables, locals, outputs

Variables are the module’s input contract. Type them. Do not use string for a map you will for_each. Do not put secrets in TF_VAR_ files that get logged; use a secret store or a marked sensitive variable.

Locals are computed names and DRY expressions inside the module. They are not a second variable API.

Outputs are what other modules or humans consume. Mark sensitive outputs. Do not output the database password into plaintext CI logs.

terraform.tfvars is for non-secret environment values. The same module with different tfvars is how you get staging vs prod — plus separate state keys.

depends_on and lifecycle

Terraform’s graph usually sees references (bucket.id in another resource). `depends_on` is for *hidden* edges: an IAM policy that must exist before a service can use a role, when there is no attribute reference. Sprinkling depends_on everywhere makes plans slower and hides real coupling.

`lifecycle`

BlockInterview use
create_before_destroyAvoid downtime on replacements that can dual-exist
prevent_destroyGuardrails on state buckets and databases — not a substitute for RBAC
ignore_changesNarrow escape for an attribute another controller owns — easy to lie to yourself
replace_triggered_byExplicit replace when a side file changes

count vs for_each: count indexes by number; inserting at zero replaces everything. for_each on a map of names is the senior default for sets of similar objects (C-19).

Security of the workflow

  • No access keys in the repo. Plan/apply uses OIDC or a tightly scoped role.
  • State encrypted at rest; bucket versioning on; public access blocked.
  • terraform fmt -check and validate in CI; policy-as-code on the plan if you have it.
  • The Kubernetes provider applying raw YAML from CI is a trust-boundary question — often GitOps is cleaner for workloads, Terraform for the cluster’s surrounding cloud objects.

This sprint’s lab: terraform validate / plan locally. You do not need cloud credentials to learn the workflow. When you *talk* cloud, keep it portable: object store backend, lock, IAM-like role.

What you write from memory in M-01

A required_version >= 1.11, an S3 backend with encrypt and use_lockfile, and a hashicorp/aws pin >= 5.80. You do not need to invent a VPC. You need to prove you will not apply the same key from two laptops.

The next lesson writes that backend block in full and talks modules.

If you only remember one sentence from this file: state plus a lock is what you are protecting; HCL resources are how you describe the world to that product.

Team state — S3 + use_lockfile (DynamoDB locking is deprecated) Team state — S3 + use_lockfile (DynamoDB locking is deprecated) Dev A planreads stateS3 objectencrypt · versionuse_lockfile = trueLock fileone applyDo notDynamoDB lockas the design Terraform >= 1.11: native S3 lock files. Say 'deprecated' if they still mention DynamoDB.State IAM is as sensitive as production. Public buckets are an incident.
Team state — S3 plus use_lockfile

Weak vs strong answer

Weak: “State is a cache; I can delete it if plan looks weird.”

Strong: “State maps addresses to real objects and often holds secrets. Deleting it orphans infra. The next apply may duplicate the world.”

Weak: “I just apply until it goes green.”

Strong: “I review a saved plan like a pull request. Targeted apply is an exception.”

Whiteboard in 60 seconds

  1. init → plan → apply → (rarely) destroy.
  2. Code / state / real world as three boxes.
  3. Write use_lockfile = true on the S3 backend. Cross out DynamoDB for new stacks.

Follow-up ladder

  1. What does refresh do? → read the world into memory before the diff.
  2. count vs for_each? → index shift vs named keys.
  3. Why not commit *.tfstate? → secrets + split-brain.
  4. Two root modules, one bucket? → freeze, pick a winner.

Interview questions

What is Terraform state?

The product’s memory: address → real ID. Not a cache. Not for git.

DynamoDB lock table?

Deprecated as the current pattern. Terraform >= 1.11: S3 use_lockfile.

INTERVIEW TIP: If they still want DynamoDB locking, answer: “That pattern is deprecated. On 1.11+ I set use_lockfile on the S3 backend. I would migrate old stacks, not open a new lock table.”

Next: Modules, remote state, and locking.

Modules, remote state, and locking13 min

Modules, remote state, and locking

Modules, remote state, and locking

In one sentence: Modules are versioned contracts; each environment has its own state key; locking is S3 use_lockfile on Terraform 1.11+, not a new DynamoDB table.

Remote backend — write this from memory

hcl

terraform {
  required_version = ">= 1.11.0"

  backend "s3" {
    bucket       = "acme-tfstate-prod"
    key          = "orders/prod/terraform.tfstate"
    region       = "us-west-2"
    encrypt      = true
    use_lockfile = true
  }

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 5.80.0"
    }
  }
}

That is the current locking story. Native S3 lock files replace the DynamoDB lock table pattern. You may still *see* DynamoDB in old repos. Migration is a project. New stacks should not add DynamoDB “because a 2019 blog said so.”

Enable versioning and block public access on the bucket. Treat the bucket as production infrastructure of its own (often a bootstrap stack with extra care).

Team state — S3 + use_lockfile (DynamoDB locking is deprecated) Team state — S3 + use_lockfile (DynamoDB locking is deprecated) Dev A planreads stateS3 objectencrypt · versionuse_lockfile = trueLock fileone applyDo notDynamoDB lockas the design Terraform >= 1.11: native S3 lock files. Say 'deprecated' if they still mention DynamoDB.State IAM is as sensitive as production. Public buckets are an incident.
Remote state and a lock so two applies cannot race

If a lock is stuck: prove no apply is running, then follow current unlock procedure for lockfiles — do not destroy to “clear the lock.” D-11 exists for this.

COMMON MISTAKE: One state file for “the whole company.” Blast radius is every apply. Prefer per-system or per-team keys.

SENIOR-LEVEL EXPECTATION: Per-environment keys (orders/dev, orders/prod), CI-only apply, and a written migrate-to-use_lockfile plan for legacy DynamoDB stacks.

Modules as a product

A module is an interface: inputs, outputs, a version. App teams should not fork 400 lines of bucket policy. They should consume module "artifacts" { source = "…"; version = "2.3.0" }.

Modules are contracts — environments pass different variables Modules are contracts — environments pass different variables env/localkind metadatano AWS providermodule.networkmodule.computeenv/awsEKS / ECR / RDS A module is not a folder of copy-paste. Inputs, outputs, and version pins are the API.Root module owns the backend. Child modules should not hide a second state.
Module contract: inputs, resources, outputs
Design choiceWhy it matters
Small, purposeful modulesA “do everything cloud” module cannot version
Semantic versionsv2 can be breaking; do not surprise ten teams on Friday
Typed variablesC-17 — any hides mistakes until apply
Defaults that are safePublic ACL should not be a silent default
Examples + testskind/terraform tests for the contract, not only happy path

source from a registry or a tagged git ref, not main. Pin. The same discipline as image digests.

Module composition: root module per env/app wires child modules. Child modules should not assume they own the backend. The root does.

Repo structure trade-offs

There is no single holy layout. You must name the trade-off.

LayoutWinsLoses
Monorepo, modules/ + envs/prodOne PR, shared modulesBlast radius; CI must be smart
Repo per moduleIndependent versioningVersion soup; slower change
Terragrust-style wrappersDRY env wiringAnother DSL to interview on
One root, workspaces for envLooks simpleEasy to apply the wrong workspace to prod

Workspaces are a sharp tool. Many teams prefer separate state keys and directories over terraform workspace select prod on a laptop.

Do not mix the Order API’s Kubernetes manifests and the VPC in one apply unless you like 20-minute plans and surprise node replacements when you change a probe.

Variables versus locals versus data

  • variable — caller sets it (or a default).
  • local — you compute it; not part of the external API.
  • data — read existing objects. Data sources in apply-time that depend on just-created resources can create chicken-and-egg plans. Know when to split stacks.

terraform_remote_state data source couples stacks. It is convenient and creates hidden apply order. Prefer well-defined outputs consumed deliberately, or a second plan in a pipeline with an explicit dependency.

What you do *not* put in the first module

In engineer mocks (M-01): do not design a multi-region mesh on day one. Bucket, encryption, lock, and a role the pipeline can assume. Platform mocks (M-03): the module *is* the product — version, policy, per-team state.

INTERVIEW TIP: If they ask “Terraform or Crossplane?” stay on the control plane properties that do not change: desired state, lock, identity, policy. Then pick a tool.

Weak vs strong answer

Weak: “One state file for the company is simpler.”

Strong: “Per-system, per-environment keys. One apply must not be able to touch the whole estate.”

Weak: “Workspaces keep prod and staging in one folder. I just select.”

Strong: “Easy to apply the wrong workspace. I prefer directories and separate keys.”

Whiteboard in 60 seconds

  1. Write the S3 backend block with encrypt and use_lockfile.
  2. Root module wires module.network and module.compute.
  3. Two keys: orders/dev and orders/prod.

Follow-up ladder

  1. Who owns the backend? → the root module, not the child.
  2. Pin module source? → version or git tag, not main.
  3. Stuck lock? → prove no apply is running, then unlock. Never destroy to clear it.
  4. terraform_remote_state risk? → hidden apply order.

Interview questions

Write a production backend from memory.

S3, encrypt, versioned bucket, use_lockfile = true, Terraform >= 1.11.

What is a module?

A versioned contract: inputs, outputs, examples. Not a folder of copy-paste.

Challenges C-16, C-17, C-20, C-22.

Next: Drift, import, security, troubleshooting.

Drift, import, security, troubleshooting13 min

Drift, import, security, troubleshooting

Drift, import, security, troubleshooting

In one sentence: The console, a second state key, and a bad count index are how reality diverges from Terraform. You import or move addresses. You do not destroy to feel better.

Drift

State is the source of truth — the cloud is the messy world State is the source of truth — the cloud is the messy world Code*.tf · desiredStateIDs · attributescan hold secretsReal infradrift happens Refresh reads the world into memory; apply writes the next state.Commit code, never *.tfstate. If state is gone, Terraform wants to create duplicates.
State is the map — the cloud is the messy world
Team state — S3 + use_lockfile (DynamoDB locking is deprecated) Team state — S3 + use_lockfile (DynamoDB locking is deprecated) Dev A planreads stateS3 objectencrypt · versionuse_lockfile = trueLock fileone applyDo notDynamoDB lockas the design Terraform >= 1.11: native S3 lock files. Say 'deprecated' if they still mention DynamoDB.State IAM is as sensitive as production. Public buckets are an incident.
S3 lock file — do not design a new DynamoDB lock

Drift is: the world changed and state did not (or state changed and the world did not). Someone clicked in the console. A controller mutated a tag. An apply failed after creating but before writing state.

plan after refresh shows drift. Your job is to decide:

  1. Adopt it — update code to match, then apply a no-op or small align.
  2. Revert it — apply to push code back onto the object (know the blast radius).
  3. Ignore a narrow attribute — ignore_changes when another system owns it, and say so in a comment.

GitOps plus kubectl edit is the Kubernetes cousin. Terraform plus console click is this lesson.

COMMON MISTAKE: terraform apply -auto-approve in a panic to “fix drift” without reading the destroy line in the plan.

SENIOR-LEVEL EXPECTATION: Two state files managing one security group — freeze applies, pick a winner, state rm from the loser, import if needed. Do not apply both.

Import and state moves

Import attaches an existing object to an address. After import, the next plan should be small. If it wants to replace everything, your config does not match the object.

moved blocks (and state mv) rename addresses without recreate — essential when you extract a module or switch count to for_each.

Never “fix” a surprise replacement by destroying from the console while Terraform still thinks it owns the name. You will get a create that conflicts or a state that points at a ghost.

Unexpected replacement

Read the plan’s replace reason. Common causes:

  • name or an immutable identifier changed
  • count index shift
  • Provider upgrade behavior
  • force new on an AMI or engine version
  • A tag set you marked as identity

C-19 and D-12 live here. create_before_destroy only helps if two objects can exist at once (not always true for a unique DNS name).

Apply failed halfway (D-11, D-26 / Q-226)

TRACE it: impact (what exists in the cloud vs what state says), recent change (this apply), signals (error, partial resources), capacity/locks, then mitigate.

Usually: plan again, import what exists but is missing from state, or state rm what state thinks exists but the API deleted. Do not start a second apply from a second laptop against the same key if the lock is doing its job — wait or unlock with proof.

Stuck lock: confirm the runner is dead. Then unlock. If you unlock a live apply, you get corrupted state. That is why use_lockfile exists.

Security

ControlFailure if skipped
Encrypted, versioned, private state bucketState leak is a credential leak
use_lockfileTwo applies, split-brain
OIDC / scoped roleLong-lived keys in GitHub
No secrets in .tf or VCSHistory is forever
Policy on plan (deny public, deny *)Review fatigue misses the one ACL
Separate prod state and prod roleStaging pipeline cannot wipe prod

prevent_destroy is a seatbelt. RBAC on who can apply is the car.

Troubleshooting table

SymptomLook at
State lockedWho holds the lock; CI job still running
Plan wants replaceImmutable field, count, provider notes
Cycle in graphHidden depends_on or self-reference
Provider auth failedWrong account, expired OIDC, clock skew
“Object already exists”State miss — import
“Object not found”State ghost — rm or recreate on purpose

Download terraform-troubleshooting.md.

Spoken 90 seconds

“I treat state as sensitive production data in S3 with versioning and use_lockfile. Modules are versioned contracts. If apply dies, I reconcile state to reality with import and moves. I do not destroy the VPC to clear a lock, and I do not add DynamoDB locking to a new stack.”

Weak vs strong answer

Weak: “Apply -auto-approve until drift is gone.”

Strong: “I read the destroy line. I adopt, revert, or ignore a named attribute — on purpose.”

Weak: “Destroy the VPC to clear a stuck lock.”

Strong: “Confirm the runner is dead, then unlock. Unlocking a live apply corrupts state.”

Whiteboard in 60 seconds

  1. Code / state / world. Circle the mismatch.
  2. Import vs moved vs state rm.
  3. TRACE on a half-applied run.

Follow-up ladder

  1. Plan wants replace — first question? → which field is ForceNew.
  2. Object already exists? → import.
  3. Object not found in API, still in state? → state rm or recreate on purpose.
  4. Two states, one SG? → freeze both applies.

Interview questions

How do you recover a failed apply?

Plan again. Import what exists. Remove ghosts. Do not start a second laptop against the same key.

What is drift?

Reality and state diverged. Console click, failed apply, or another controller.

Challenges C-18, C-19, C-21. Scenarios D-11, D-12, D-13.

Next: Module 4.

You will

  • Promote one image digest across environments
  • Investigate latency when CPU looks normal

Pipelines, promotion, and GitOps12 min

Pipelines, promotion, and GitOps

Pipelines, promotion, and GitOps

In one sentence: CI proves a commit; CD takes a built digest to an environment; deploy is the act. Rebuilding for prod is how staging lied.

CI vs CD vs deploy

TermJobTypical trigger
CILint, test, build, scan, sign, push digestPR and main
CDPromote that digest, apply infra plan, sync clusterMain, tag, or gitops commit
DeployThe environment actually changesEnd of CD or a GitOps reconcile

People overload the build job with kubectl apply and production keys. That collapses the trust boundary: a fork PR should never be one checkbox from prod.

Pipeline — prove the artifact, then promote the same digest Pipeline — prove the artifact, then promote the same digest linttestbuildscanplaceholder heredeploy digestnot :latest This lab CI has no secrets and no registry login. Scan is a documented placeholder.Rebuild-for-prod is a different artifact. Promote the digest you already tested.
Pipeline — prove the artifact, then promote
Build once — promote the same digest Build once — promote the same digest CItest · build · scanDigestorders@sha256:…Stagingsame bytesProdsame bytes again Rebuilding for prod is how staging lied. Tags move. Digests do not.A fork PR must never assume the production OIDC role.
Build once, promote the digest

Immutable promotion: orders@sha256:abc… is what staging ran. Prod pulls the same bytes. Retagging :staging to :prod without digest pin is a weaker cousin — tags move. Digests do not.

PR pipelines: build and test. Do not apply to shared prod. pull_request_target that checks out a fork and assumes your OIDC role is an incident (M-02).

COMMON MISTAKE: :latest in the Deployment, or a CD job that docker build again with different build args.

SENIOR-LEVEL EXPECTATION: OIDC to the cloud, environment approvals, and a pipeline identity that cannot empty the account if one workflow is stolen.

Deployment strategies

Rolling, canary, blue/green — pick the control you have Rolling, canary, blue/green — pick the control you have Rollingsurge / unavailableDeployment defaultCanary1–10% then moreneeds an SLIBlue / greentwo stacks · one flipdouble capacityCanary without a metric that sees the canary is rolling with extra meetings.Rollback restores a digest. It does not rewind a destructive migration.
Rolling, canary, blue/green
Blue / green — two stacks, one flip, instant rollback Blue / green — two stacks, one flip, instant rollback Blue (live)v1 · 100% trafficGreen (idle)v2 · smoke firstFlipService / DNS / LBCost: you pay for two environments during the cut.Rollback is a pointer change — unless you also migrated the database forward-only.
Blue / green — two stacks, one flip
Canary — shift a slice of traffic, watch SLOs, then continue Canary — shift a slice of traffic, watch SLOs, then continue Stable90–99% · last goodCanary1–10% · new digestDecidepromote or abortNeeds a metric that actually sees the canary, not a cluster-wide average.A canary that shares a broken schema with stable is not a canary. It is a blast radius.
Canary — shift a slice, watch SLOs
StrategyHow it worksPick whenCost
RecreateDown then upYou can tolerate downtimeSimple, brutal
RollingSurge / unavailableDefault APISlow bugs hit 100% gradually
CanarySmall % then moreYou have a real SLINeeds traffic split and abort
Blue/greenTwo stacks, flipFast revert of edgeDouble capacity, sticky sessions
Feature flagCode on, behavior offSchema and UX uncertaintyFlag debt

Rolling is what a Deployment does. Canary and blue/green need a service mesh, Ingress weights, or two Services. Say which control you have. “We do canary” without a metric is rolling with extra meetings.

Rollback and databases

kubectl rollout undo or a GitOps revert restores the application digest. It does not rewind a destructive migration.

Expand/contract: add the new column nullable, deploy code that writes both, backfill, switch reads, drop the old. Rollback is possible in the middle. A one-shot DROP is not.

Forward-fix when the bad state is data you cannot revert. Rollback when the digest is wrong and the schema is compatible. Who decides: the incident commander using the SLO, not whoever wants the pipeline to look green.

GitOps

GitOps — Git holds desired state; a reconciler applies it GitOps — Git holds desired state; a reconciler applies it GitPR · review · SHAReconcilerArgo / FluxClusterconvergeDriftkubectl edit loses CI builds and signs the image. CD (GitOps) moves the tag in Git.A dashboard click that Git does not know about is the next outage's mystery.
Desired git, reconciler, cluster

Git is the desired cluster state. A reconciler (Argo CD, Flux, or equivalent) applies it. Benefits: audit, revert is a git revert, no laptop kubeconfig for routine deploys.

Drift: kubectl edit during an incident must be followed by a git commit or the reconciler will undo you — or you disable sync and create a snowflake. Say the break-glass: freeze sync, mitigate, PR the mitigation.

Push-based CD (pipeline applies) is still valid when the team is small or the infra is Terraform-only. Keep it from becoming “whoever has the key applies from main.” Lock, plan file, approval.

Preview environments: great for UI/API PRs; expensive and leaky if they share prod data or prod credentials.

Pipeline security gates

  • Pin Actions by digest
  • Scan image; fail on policy, not on every CVE noise
  • SBOM attached to the digest
  • Sign; verify at admission or deploy
  • No docker.sock on the build Pod as a platform feature
  • Secrets from a manager or OIDC, not repo variables copied into the Dockerfile

C-23–C-27: pipeline failure, safe prod deploy, rollback, security gates, promote immutable artifact.

Order API pipeline you should be able to sketch

  1. PR: test, build, scan. Artifact is a digest in a registry the PR cannot overwrite in prod.
  2. Main: sign, attach SBOM, push. Staging Deployment pins that digest.
  3. Prod: same digest after approval or GitOps sync. Terraform plan for surrounding infra is a separate, locked apply.
  4. Abort: SLI burn or canary error rate — not a Slack emoji.

If step 2 rebuilds with different build-args than step 1, you do not have promotion. You have two artifacts and a story.

Weak vs strong answer

Weak: “CD rebuilds for prod with production build-args.”

Strong: “Staging ran orders@sha256:…. Prod pulls those bytes. Rebuild is a different artifact.”

Weak: “We do canary” (no metric).

Strong: “I shift 5% only if I have an SLI that sees the canary. Otherwise I am rolling with meetings.”

Whiteboard in 60 seconds

  1. PR: test/build. Main: sign. Staging then prod: same digest.
  2. Three strategy boxes: rolling / canary / blue-green.
  3. Git → reconciler → cluster. kubectl edit loses.

Follow-up ladder

  1. Why not :latest in the Deployment? → tags move.
  2. Rollback vs forward-fix? → digest vs data.
  3. GitOps break-glass? → freeze sync, mitigate, PR.
  4. pull_request_target + OIDC? → fork-to-prod incident.

Interview questions

CI vs CD vs deploy?

Prove a commit; promote a digest; the environment changes.

Can the pipeline apply Terraform?

Yes, with a lock, a saved plan, and an identity that cannot empty the account.

INTERVIEW TIP: If they ask Helm vs Kustomize, answer in one sentence (templating vs overlays) and return to promotion and revert. This sprint does not require Helm fluency.

Next: Linux, networking, and cloud mapping.

Linux, networking, and cloud mapping11 min

Linux, networking, and cloud mapping

Linux, networking, and cloud mapping

In one sentence: Linux essentials and a hop-by-hop path beat a cloud-product quiz. AWS names are an optional translation, not a second course.

Linux essentials (not a second course)

You already used this in Module 1. In interviews, keep it operational:

TopicInterview use
Processes, PID 1, signalsGraceful shutdown, 137 vs SIGTERM
cgroupsOOM vs throttle
Disk vs inodesCI “disk full” that df -h does not show
ulimits / fds“Too many open files”
CapabilitiesNon-root is incomplete
systemd vs containerNodes have init; containers often should not fake a full OS

You do not need to be an LFCS instructor. You need to not recommend reboot the node as step one.

The path you must walk out loud

Browser to DNS to LB to Ingress to Service to Pod to DB Browser to DNS to LB to Ingress to Service to Pod to DB BrowserDNSLBIngressServicePodDatabase 502 is often 'no Ready backend', not 'Kubernetes is down'. TRACE picks the hop.Refuse vs timeout vs TLS fail are different. Ping never proved HTTPS.
Browser to DNS to LB to Ingress to Service to Pod to DB
Four identities — pod IP, ClusterIP, Ingress host, node Four identities — pod IP, ClusterIP, Ingress host, node Pod IPephemeral · CNIClusterIPstable VIPIngress / GWL7 name + TLSNetworkPolicydefault denyEast-west: Service DNS. North-south: Ingress or a gateway — not NodePort as design.NetworkPolicy is allow-lists. Without a plugin that enforces it, the YAML is theater.
Four Kubernetes identities on that path
Container network — namespace, veth, bridge, then NAT Container network — namespace, veth, bridge, then NAT Processnetns · eth0veth pairinto the bridgedocker0 / CNIpod CIDRNATegressDNS127.0.0.11 Published ports are DNAT into the namespace. They are not how you expose prod Kubernetes.Two containers on one network can talk by name. Cross-host needs an overlay or CNI.
Container network namespace vs host

Read the diagram, then say it as a story:

  1. Browser looks up a hostname.
  2. DNS returns the load balancer (or anycast) — TTL and cache mean failover is not instant.
  3. Load balancer (L4 or L7) terminates or passes TLS, health-checks something. If it health-checks the wrong target, you get 502s with quiet app logs.
  4. Ingress / Gateway routes host and path to a Service.
  5. Service (usually ClusterIP) selects Ready Pods.
  6. Pod handles the request in its network namespace; it calls orders.payments.svc or a remote name.
  7. Database (often *not* in the cluster) — security group, NetworkPolicy, connection pool, TLS.

Failure can be any hop. TRACE starts with impact and recent changes, then you pick the hop with signals — you do not restart kind.

SymptomHop to doubt first
NXDOMAIN in the browserDNS, wrong zone, split horizon
Connection timeout to the VIPLB, SG, NLB vs target
502/504 from the edgeNo Ready backends, idle timeout, MTU
Connection refused in the podBind 127.0.0.1, wrong port
Works on the node, fails in the podRouting, DNS, NetworkPolicy, proxy
DB “too many connections”HPA × pool size

Refuse vs timeout vs TLS fail are different (Q-230). Ping success never proved HTTPS.

Cloud-neutral primitives

Stay here first — this is not the AWS Solutions Architect Interview Sprint.

PrimitiveProblem it solvesCost surprise
Account/project isolationBlast radiusShared logging still crosses
VPC / subnets / routesWhere packets may goCross-AZ data
NATPrivate subnet egressPer-GB and idle
L4 vs L7 balancerTCP vs HTTP routing / certsHealth-check mismatch
Object vs block vs file storageBlob vs disk vs shared FSPutting a DB on object store
Managed KubernetesControl plane as a serviceYou still own nodes, addons, IAM, apps
RegistryWhere digests liveCross-region pull + scan

IaaS: you patch machines. PaaS: you patch less and lose some knobs. Managed Kubernetes: the API is theirs; the YAML, the node image, and the IAM are still yours.

Multi-AZ is the usual reliability first step. Multi-region is a product, not a checkbox (Q-185).

Optional AWS mapping (not a curriculum)

Use this table only when the interviewer speaks AWS. Do not study it instead of the path above.

Portable concernOptional AWS name
Managed KubernetesEKS
NodesEKS managed node groups / Karpenter (name as examples)
Container registryECR
Object store / TF stateS3 (+ use_lockfile)
L7 HTTP balancerALB
L4 balancerNLB
DNSRoute 53
Workload identityEKS Pod Identity / IRSA
Secrets managerAWS Secrets Manager / SSM (still not “K8s Secret is enough”)
Pipeline identityGitHub OIDC to IAM

kind remains the lab. An optional EKS path is documented for cost-controlled demos; it is not required for completion or the certificate.

COMMON MISTAKE: Reciting VPC exam trivia and then failing to say why the Pod cannot use the node’s resolv.conf blindly.

SENIOR-LEVEL EXPECTATION: Compare the two paths (node curl vs pod curl) hop by hop before blaming the application.

Weak vs strong answer

Weak: Recites VPC exam trivia, then cannot say why the Pod cannot use the node’s resolv.conf.

Strong: “I walk browser → DNS → LB → Ingress → Service → Pod → DB. I compare node curl vs pod curl before I blame the app.”

Weak: “Ping worked, so HTTPS is fine.”

Strong: “Refuse vs timeout vs TLS fail are different. Ping never proved checkout.”

Whiteboard in 60 seconds

  1. Seven hops, left to right.
  2. Mark where 502 usually lives (no Ready backend).
  3. Optional AWS names under the portable boxes — only if they asked.

Follow-up ladder

  1. NXDOMAIN? → DNS / split horizon.
  2. Works on the node, fails in the pod? → DNS, NetworkPolicy, bind address.
  3. DB too many connections? → HPA × pool size.
  4. Multi-region first? → usually no. Multi-AZ first.

Interview questions

Walk a 504.

TTL, idle timeout, Ready backends, then the pod, then the pool.

kind vs EKS on this path?

Same objects. Cloud LB and IRSA are overlays. The lab stays kind.

INTERVIEW TIP: If they pull you into a 20-minute AWS SA recap, say: “I can map these boxes. I would rather walk the checkout 504 on this path.” Then TRACE.

Next: Observability, SRE, and DevSecOps.

Observability, SRE, and DevSecOps12 min

Observability, SRE, and DevSecOps

Observability, SRE, and DevSecOps

In one sentence: Logs, metrics, and traces answer different questions. SLIs measure user pain. Security is both a pipeline and a runtime property. A scanner sticker is not enough.

Three signals

Logs, metrics, traces — one correlation id across them Logs, metrics, traces — one correlation id across them LogsJSON · no secretsMetricsRED / USE · SLOsTracesspan per hopCorrelationX-Request-IdLiveness is not observability. A green probe can still be a 2s p99.Never log Authorization, tokens, or raw PAN. Cardinality explodes on raw IDs as labels.
Logs, metrics, traces on one request
SignalGood forBad as the only tool
MetricsRate, saturation, cheap alerting“Why *this* order failed”
LogsThe exact error, auditCardinality if you log every field as a metric label
TracesWhere time went across servicesStorage cost; you must sample on purpose

Structured logs with a correlation / trace id. Never tokens, passwords, or raw cards. The Order API should log order_id and status, not the payment blob.

Golden signals (latency, traffic, errors, saturation) still work. Pair them with RED and USE.

RED and USE

RED on the API — USE on the node and the pool RED on the API — USE on the node and the pool RED (request path)Rate · Errors · Durationcheckout success / latencyUSE (resources)Utilization · Saturation · ErrorsCPU, disk, conntrack, pool50% CPU can still be saturated on threads or connections. Utilization is not the story.Page on SLI burn. Disk 80% is a ticket unless users are already hurting.
RED on the API, USE on the node
MethodStands forFirst dashboard
REDRate, Errors, DurationUser-facing request path (checkout)
USEUtilization, Saturation, ErrorsResources: node disk, CPU throttle, conntrack, pool

A 50% CPU service can be saturated on thread pools or connection pools. Utilization is not the whole story (Q-209).

SLI, SLO, SLA, error budget

SLI measured — SLO targeted — SLA contracted SLI measured — SLO targeted — SLA contracted SLIwhat you measureSLOinternal targetSLAcustomer promiseError budget1 − SLO Users buy HTTP 200 in a time bound — not CPU. CPU is a poor SLI.When the budget is gone, you slow the refactor. That is policy, not a dashboard color.
SLI measured, SLO targeted, SLA contracted
TermWho feels it
SLIThe measurement (successful checkouts / attempts)
SLOThe internal target (99.9% over 30 days)
SLAWhat you promised a customer (usually looser, with credits)
Error budget1 − SLO; how much unreliability you can *spend* on change

CPU is a poor SLI. Users do not buy CPU. They buy HTTP 200 in a time bound, or “order created.”

When the budget is exhausted, you slow the payments refactor — that is a policy conversation (M-04), not a dashboard color.

Alert on symptoms (burn rate of the SLI) with multi-window multi-burn (Q-206). Cause alerts (disk 80%) belong on a team that owns disk, or as tickets, not as 3 a.m. pages when users are happy.

Cardinality: user_id as a metric label will melt the TSDB. Use logs or traces for high-cardinality identity.

TRACE is how you operate

TRACE — operate before you exec TRACE — operate before you exec Triagewho · how muchReviewlast changeAnalyzeEvents · logsCheckdeps · capacityExecutemitigate · cause Impact first. Restarting kind is not step one. Empty Endpoints are a proof, not a feeling.Mitigation restores traffic. Root cause is the sentence you write for Monday.
TRACE maps onto those signals

You already have the table in DEPLOY-IT. In this lesson, connect it to signals:

TRACE stepObservability move
Triage impactWhich SLI, how much budget, which region
Review changesDeploy annotations, Terraform apply, flags — on one timeline
Analyze signalsTrace the 504; do not trust Ready on payments
Dependencies & capacityPool, disk, conntrack, lock
Mitigate then causeCanary off, then the bad probe

Toil is manual work that does not add enduring value. Automate the weekly drain checklist; do not automate a vague “fix production” button.

Blameless postmortem: name the systemic gap and the owner of the *fix*, not the human to punish.

DevSecOps — shift left without abandoning runtime

GateStill needed at runtime
Dockerfile review, non-rootPSS / admission
Scan + SBOM + signVerify digest; reject unsigned
Least-privilege SA in CIRuntime SA cannot create clusterroles
No secrets in gitRotation, etcd encryption, external store
NetworkPolicy in codeDefault-deny actually applied
OIDC / workload identityNo static keys in Secrets

Kubernetes Secrets remain not magic. Privileged and hostPath remain cluster incidents. docker.sock remains host root.

CVE triage: block what is reachable in the final image and exploitable in your threat model. Do not halt the company on a noise CVE in a unused builder package you did not ship — and do not ignore openssl in the runtime stage.

Spoken 90 seconds

“I SLI checkout success and latency, SLO it, and page on burn rate. RED on the API, USE on nodes and pools. Traces find the liar that is still Ready. TRACE before exec. Security is pin, sign, verify, identity, and policy — a scanner badge is not a control.”

COMMON MISTAKE: Alerting on CPU 80% while the SLO is green — and missing the 502.

SENIOR-LEVEL EXPECTATION: Write a two-window burn-rate alert and refuse four nines you cannot measure.

Weak vs strong answer

Weak: “We alert on CPU 80%.”

Strong: “I page on SLI burn. CPU is a cause signal. Users buy checkout 200s.”

Weak: “We have a scanner badge.”

Strong: “Pin, sign, verify, identity, and policy. A sticker is not a control.”

Whiteboard in 60 seconds

  1. Logs / metrics / traces + one correlation id.
  2. RED on checkout, USE on node and pool.
  3. SLI → SLO → SLA → error budget.

Follow-up ladder

  1. Why is CPU a poor SLI? → users do not buy CPU.
  2. High-cardinality user_id as a label? → melts the TSDB.
  3. Ready but 2s p99? → probes are not observability.
  4. Four nines you cannot measure? → refuse the SLO.

Interview questions

RED vs USE?

Request path vs resources. A 50% CPU service can still be saturated on the pool.

What is an error budget?

1 − SLO. Spend it on change. Exhausted means you slow the refactor.

INTERVIEW TIP: Certificate reminder if they ask: this sprint’s paper is a BayLearn completion certificate, not an SRE or CKA cert.

Next: Module 5 — production challenge.

Download the full lab (all code)

Docker + Kubernetes + Terraform production lab: sample Order API, multi-stage Dockerfile, kind manifests, local Terraform, and TRACE break/fix. Unzip and run locally. BayLearn does not execute candidate code.

Download cd-production-lab.zip

You will

  • Run the local lab path
  • Inject a failure and recover without guessing

Lab 501 — Production deployment (LAB-CD-501)35 min

Lab 501 — Production deployment (LAB-CD-501)

Production deployment lab (LAB-CD-501)

In one sentence: Build the Order API image, run it on kind, validate the Terraform that would surround it, and read the pipeline as a promotion story — all on your laptop.

What you are proving

LAB-CD-501 — local path from laptop to kind (AWS is optional) LAB-CD-501 — local path from laptop to kind (AWS is optional) Order APIFastAPIImagemulti-stagekindnot minikubeClusterIPprobes + HPA*Terraform localvalidate · no AWSCI: lint · test · build · scan-placeholder · terraform validate. No secrets.* Ingress and HPA are example objects. Optional AWS maps this to EKS / ECR / RDS.Break/fix injects one fault. TRACE it, then scripts/deploy-local.sh restores.
Order API from image to kind to Terraform to CI
Pipeline — prove the artifact, then promote the same digest Pipeline — prove the artifact, then promote the same digest linttestbuildscanplaceholder heredeploy digestnot :latest This lab CI has no secrets and no registry login. Scan is a documented placeholder.Rebuild-for-prod is a different artifact. Promote the digest you already tested.
Pipeline the lab CI is practicing
init → plan → apply — review the plan like a pull request init → plan → apply — review the plan like a pull request initproviders · modulesbackendplandiff vs stateapplyconvergedestroysame code, reverse Never apply a plan you did not read. Targeted apply is an exception, not a habit.This lab validates locally with no AWS credentials. Cloud apply is optional.
Terraform workflow you validate locally

The architecture prompt (ARCH-01): package a backend Order API, deploy it to Kubernetes, provision supporting infrastructure with Terraform, automate delivery, observe it, then break and fix it.

Start: application, Docker, registry (local or a throwaway tag).

Evolve: Kubernetes, Service / Ingress, Terraform, CI/CD, logs / metrics / traces.

Discuss: multi-stage, non-root, probes, requests/limits, rolling updates, state + locking, immutable promotion, canary vs blue/green, TRACE, rollback vs forward-fix.

You will not stand up a billed EKS cluster in this block. You will stand up kind and talk the optional mapping table if asked.

Prerequisites

ToolPolicy (13 Sep 2026)
Docker Engine + BuildxCurrent stable
kindv0.30+ (around v0.33)
kubectlMatches lab APIs 1.31+
Terraform>= 1.11 (validate/plan; 1.15.x current stable)
Python3.12+ for the sample app tests

Exact pins: docs/interview-sprints/cloud-devops/TOOL_VERSION_POLICY.md. Full operator notes: docs/interview-sprints/cloud-devops/PRODUCTION_LAB.md.

Suggested 25-minute path

  1. App sanity — in labs/production-deployment/app, run the documented pytest. You are not here to redesign FastAPI.
  2. Image — read the Dockerfile. Confirm multi-stage, numeric USER, no .env in context, exec-form PID 1. Build. Hit /health on the published port.
  3. kind — create (or reuse) the lab cluster. Apply the workload YAML. Confirm:

- Pod Ready

- Service ClusterIP has Endpoints

- probes are not liveness-on-Postgres

- requests and limits are present

  1. Terraform — fmt -check, validate, plan in the lab stack. Read the backend block. If the example shows S3, it must show use_lockfile = true. A local backend in the lab is fine for validate; your spoken production answer is S3 + lockfile.
  2. CI — open the GitHub Actions (or equivalent) YAML. Confirm: build and scan on PR; no prod apply on fork; digest as the artifact.

If a step fails, do not skip to Module 6 pretending. TRACE it or pick the matching challenge (C-01, C-06, C-08).

What “done” looks like in an interview

You can screenshare or narrate:

  • docker build produced a digest you can name
  • kubectl get deploy,po,svc,ep tells a consistent story
  • terraform validate is green
  • You can explain what you would add for Ingress on kind (controller) versus a cloud LB
  • You know how you will delete the kind cluster and images so the laptop is clean

Safety

  • No cloud credentials in the repo. .env.example has placeholders only.
  • Do not commit terraform.tfstate or kubeconfigs.
  • BayLearn staff do not execute your cluster. If something looks like “paste us your AWS keys,” refuse.

COMMON MISTAKE: Applying cloud-only annotations on kind and declaring Kubernetes broken.

SENIOR-LEVEL EXPECTATION: Separate portable workload YAML from cloud overlays. The lab tests the portable path.

What you say if a tool is missing

No Docker: you still walk the Dockerfile and the YAML; you do not invent a passing lab.

No kind: kubectl apply --dry-run=client plus a honest gap.

No Terraform binary: you still write the backend block with use_lockfile and explain validate vs plan.

No AWS account: completion is still valid. Optional EKS is extra credit with a budget, not a certificate requirement.

The mock can proceed on narration. The lab is how you earn confidence, not a hidden industry exam.

Document what you actually ran (cluster name, digest prefix, validate output) in a note for Module 7. Interviewers prefer a short honest lab log over a claim that “EKS is up” with no cluster.

If you finish early, do not install extra addons for sport. Open C-08 or D-09 and TRACE. Extra mesh is how the 35-minute block evaporates.

Cleanup before you leave the machine: kind delete, remove lab image tags, no leftover tfstate in git. See docs/interview-sprints/cloud-devops/COST_AND_CLEANUP.md.

Weak vs strong answer

Weak: “EKS is up” with no cluster and a cloud annotation that kind cannot satisfy.

Strong: “ClusterIP is Ready. Ingress needs a controller I did not install. Terraform validate is green. I can delete the kind cluster.”

Whiteboard in 60 seconds

  1. App → image → kind → ClusterIP → Terraform local → CI.
  2. Star optional AWS as an overlay, not the completion path.
  3. Write the cleanup: kind delete, no tfstate in git.

Follow-up ladder

  1. No Docker? → walk the Dockerfile and YAML honestly.
  2. No kind? → kubectl apply --dry-run=client.
  3. Why not minikube? → this sprint’s lab is kind only.
  4. Is AWS required for the certificate? → no.

Interview questions

What does done look like?

A named digest, get deploy,po,svc,ep consistent, terraform validate green, a cleanup plan.

What do you refuse?

Cloud credentials in the repo. Staff executing your cluster. Claiming EKS without a bill you meant to pay.

INTERVIEW TIP: Timebox. A working ClusterIP plus a honest “Ingress controller not installed” is better than a half-mesh.

Next: Break/fix.

Lab pack README

Lab pack README

Labs — Cloud DevOps Interview Sprint

Hands-on work for LAB-CD-501. Nothing here is executed on BayLearn

servers. You run Docker, kind, and Terraform locally.

LabPathWhat you practice
Production deployment`production-deployment/`Multi-stage image, kind (not minikube), ClusterIP + probes, Terraform validate without AWS credentials, break/fix

From production-deployment/:

bash

scripts/validate-lab.sh   # pytest, terraform, kubectl dry-run, docker, kind if present
scripts/kind-up.sh && scripts/deploy-local.sh
scripts/break-fix.sh      # then restore with scripts/deploy-local.sh
scripts/cleanup.sh

Student zip (generated by scripts/pack_lab_zip.sh):

course-ui/downloads/cd-production-lab.zip

Rules

  • No cloud credentials in the repo
  • No remote code execution
  • kind only — do not switch the lab to minikube
  • Kubernetes Secrets in the manifests are dummy values
  • Terraform remote state: S3 + use_lockfile = true (DynamoDB locking is deprecated)
  • Optional AWS/EKS path is documentation only and is not required to finish

Production lab README

Production lab README

LAB-CD-501 — Production deployment lab

Package a tiny Order API, run it as a non-root image, deploy it to kind,

record intent with Terraform, and break it on purpose.

BayLearn does not execute your Docker / Kubernetes / Terraform remotely.

Success is pytest, docker build, terraform validate, and a kind

rollout on your machine.

kind only. Not minikube.

text

app/          FastAPI Order API (in-memory)
docker/       Multi-stage, non-root, no credentials
kubernetes/   Probes, resources, ClusterIP, example Ingress/HPA
terraform/    Local validate (no AWS creds) + optional AWS mapping
scripts/      kind-up, deploy-local, break-fix, cleanup
docs/         LOCAL.md · AWS.md · CLEANUP.md

Quick start

bash

# 1. App
cd app && python3.12 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]" && pytest && cd ..

# 2. Cluster
scripts/kind-up.sh
scripts/deploy-local.sh

# 3. Terraform (no cloud account)
cd terraform/environments/local
terraform init -backend=false
terraform validate

Reach the ClusterIP Service with port-forward, not NodePort:

bash

kubectl --context kind-baylearn-cd -n baylearn-lab port-forward svc/order-api 8080:80
curl -sS http://127.0.0.1:8080/health

What to say in the interview

  • Multi-stage image: build tools stay out of the runtime layer.
  • Non-root USER + readOnlyRootFilesystem + dropped capabilities.
  • /health is liveness (cheap). /ready is readiness (config present).
  • Requests schedule the pod; limits cap it. Missing requests is a noisy-neighbor bug.
  • ClusterIP is the default. Ingress is the edge. NodePort is a lab shortcut.
  • Kubernetes Secrets are base64, not encryption. Dummy values only in this repo.
  • Terraform state is the source of truth. Team lock is S3 use_lockfile = true.

DynamoDB locking is deprecated.

  • In-memory orders are not shared across replicas — that is the RDS talking point.

Safety

  • .env.example has no secrets.
  • kubernetes/secret.yaml is a dummy token plus a warning.
  • CI does not log in to a registry and does not run a paid scanner.
  • Optional AWS path is documented only. See docs/AWS.md.

Break / fix

bash

scripts/break-fix.sh              # one random fault
scripts/deploy-local.sh           # restore
scripts/cleanup.sh                # kind + local Terraform files

More: docs/LOCAL.md.

Local path

Local path

Local path (kind)

This is the path that completes LAB-CD-501. No AWS account.

Prerequisites

  • Docker Engine
  • kind (not minikube)
  • kubectl
  • Python 3.12+ (for app tests)
  • Terraform >= 1.11 (for validate; apply is optional and writes local files only)

App tests (no cluster)

bash

cd app
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest

Copy .env.example to .env if you run uvicorn on the host. It contains no secrets.

bash

APP_ENV=local uvicorn app.main:app --reload --app-dir src

Cluster

bash

scripts/kind-up.sh
scripts/deploy-local.sh
kubectl --context kind-baylearn-cd -n baylearn-lab port-forward svc/order-api 8080:80

bash

curl -sS http://127.0.0.1:8080/health
curl -sS http://127.0.0.1:8080/ready
curl -sS -X POST http://127.0.0.1:8080/orders \
  -H 'Content-Type: application/json' \
  -d '{"customer_id":"cust-1","sku":"SKU-42","quantity":2}'

The Service is ClusterIP. Port-forward is how you reach it from the laptop.

Do not treat NodePort as the production default.

Ingress and HPA manifests are examples. kind has no ingress controller or

metrics server unless you install them.

Terraform (no cloud credentials)

bash

cd terraform/environments/local
terraform init -backend=false
terraform validate
terraform apply   # writes generated/*.json only

Remote state for a team is S3 with use_lockfile = true. DynamoDB locking

is deprecated. See the comments in main.tf and docs/AWS.md.

Break / fix

bash

scripts/break-fix.sh            # random fault
scripts/break-fix.sh missing-env
scripts/deploy-local.sh         # restore (recreates the Deployment so maxUnavailable: 0 cannot deadlock)

Faults: wrong-image, broken-probe, missing-env, bad-port, low-memory.

deploy-local.sh deletes and re-applies the Deployment on purpose. After a fault, a not-Ready surge pod plus maxUnavailable: 0 can stall a plain kubectl apply forever. The YAML still teaches the safe-roll fields; restore is a recreate.

Validate (offline + Docker; kind if the cluster exists)

bash

scripts/validate-lab.sh

Cleanup

bash

scripts/cleanup.sh

Cleanup

Cleanup

Cleanup

Local (default)

Idempotent:

bash

scripts/cleanup.sh

That deletes the kind cluster baylearn-cd, removes the local image tag,

and drops Terraform local state / generated/ files.

Manual equivalent:

bash

kind delete cluster --name baylearn-cd
docker image rm -f baylearn/order-api:local
rm -rf terraform/environments/local/.terraform \
       terraform/environments/local/generated \
       terraform/environments/local/terraform.tfstate*

App virtualenv (optional): rm -rf app/.venv.

Optional AWS

If you created EKS / ECR / RDS / NAT:

  1. Delete Kubernetes workloads in the EKS cluster.
  2. terraform destroy in the environment that created the cluster.
  3. Empty ECR if the repository remains.
  4. In the console, confirm no NAT Gateway, ELB, unattached EBS, or orphan ENI.
  5. Keep the S3 state bucket only if you still need the state object.

Forgotten NAT + EKS is the common training-account surprise. Budget alarms

first; destroy the same day you apply.

Read the lab source

Same files as the zip. Open one at a time — map the function to the interview sentence.

Loading module…

Break/fix with TRACE10 min

Break/fix with TRACE

Break/fix — practice TRACE on purpose

In one sentence: Inject one failure into the lab (or open a D-series scenario), narrate TRACE, mitigate, then name the root cause in one sentence.

Why we break a working lab

Operating is not a lecture. Interviewers watch whether you triage impact before kubectl exec, whether you look at the last change, and whether you halt a roll before you invent a novel CNI theory.

TRACE — operate before you exec TRACE — operate before you exec Triagewho · how muchReviewlast changeAnalyzeEvents · logsCheckdeps · capacityExecutemitigate · cause Impact first. Restarting kind is not step one. Empty Endpoints are a proof, not a feeling.Mitigation restores traffic. Root cause is the sentence you write for Monday.
TRACE on the lab
Startup, then Ready vs Live — drain versus restart Startup, then Ready vs Live — drain versus restart startupProbeoptional · slow bootdisables the othersreadinessProbein Service?fail → no trafficlivenessProbestill healthy?fail → restartWrong mix/health hits DBkill loop on blipLiveness must be cheap. Readiness may check config or a dependency.A 503 on /ready is a drain. A 503 on /health is a reboot. That is the TRACE split.
Probes — drain versus restart if you injected a bad liveness
Service — stable virtual IP in front of changing pods Service — stable virtual IP in front of changing pods ClusterIPproduction defaultEndpoints / slicesready pod IPskube-proxy / IPVSDNAT / loadReady podsfail probe → drop NodePort is a lab shortcut, not the production default.Not Ready means the Service stops sending traffic. That is the readiness contract.
Service only load-balances Ready pods

Pick one injection (10 minutes)

Do one. Write the TRACE letters as you go.

InjectionHowYou should discover
Empty ServiceFlip a label on the Service selectorEndpoints empty; app still Ready
Bad livenessPoint liveness at a missing path or at “Postgres”Restart storm
Wrong image tag:latest or a typo digestImagePullBackOff
Bind localhostApp listens on 127.0.0.1Refused from Service IP
Resource trapMemory limit 32MiOOMKilled 137
Locked apply story(Discussion) two applies, one keyuse_lockfile, do not destroy

Alternatively, play D-01 CrashLoop, D-06 readiness, D-08 Service unreachable, D-09 Ingress 502, or D-11 state locked in the player — same spoken discipline.

TRACE script (say it)

  1. Triage impact — “Checkout 5xx for users hitting /orders. Lab-only, one namespace. SLI would be success rate; here it is curl from my laptop.”
  2. Review recent changes — “I changed the Service selector” or “the last apply was 1.14.”
  3. Analyze signals — Events, describe, logs, get ep. Ready on the pod does not mean the Service is honest.
  4. Dependencies & capacity — DNS, disk, the fake payments dependency if you added one.
  5. Mitigate then cause — put the selector back (mitigation). Then say: “Root cause was a label mismatch, not a cluster failure.”

If you skip to kind delete cluster, you failed the exercise even if you eventually “fix” it.

What to write down for Module 7

  • One keep: the signal that told the truth (get endpoints)
  • One change: the command you typed too early
  • One follow-up challenge if you needed more than ten minutes

COMMON MISTAKE: Fixing silently and telling the interviewer “it works now” without the cause.

SENIOR-LEVEL EXPECTATION: Separate mitigation (restore traffic) from elimination (commit the YAML, add a test, add a policy).

Weak vs strong answer

Weak: kind delete cluster then “it works now.”

Strong: “Impact is lab-only checkout. Last change was the selector. Endpoints empty. I put the label back, then I say the cause.”

Whiteboard in 60 seconds

  1. TRACE across the top.
  2. One injection box (selector / probe / image / bind / OOM / lock).
  3. Mitigation arrow vs root-cause sentence.

Follow-up ladder

  1. Ready but no traffic? → Endpoints / selector.
  2. Restart storm? → liveness hitting a dependency.
  3. 137? → memory limit, not “add nodes first.”
  4. Two applies, one key? → lockfile, do not destroy.

Interview questions

Why break a working lab?

Operating is scored. Interviewers watch order, not luck.

What do you write for Module 7?

The signal that told the truth, the command you typed too early, one follow-up D-scenario.

INTERVIEW TIP: In the mock they will inject a story, not always a live cluster. The letters stay the same.

Next: Module 6 — mock.

You will

  • Sit a 45–60 minute mock
  • Leave with a weighted score and 7-day plan

Mock process10 min

Mock process

Mock interview process

In one sentence: Pick a mode, run the timer, speak deploy / automate / operate, score 1–5 with the published weights, and write feedback a human can use on Monday.

Deploy It. Automate It. Operate It. — the weekend loop Deploy It. Automate It. Operate It. — the weekend loop AssessContainerizeOrchestrateProvisionAutomateOperateTRACE · mock Spoken frame: Deploy It (image + YAML), Automate It (digest + lock), Operate It (TRACE).Module 0 scores the map. Module 5 proves it on kind. Module 6 scores the spoken interview.
The loop you are being scored on
TRACE — operate before you exec TRACE — operate before you exec Triagewho · how muchReviewlast changeAnalyzeEvents · logsCheckdeps · capacityExecutemitigate · cause Impact first. Restarting kind is not step one. Empty Endpoints are a proof, not a feeling.Mitigation restores traffic. Root cause is the sentence you write for Monday.
Operating is TRACE when they say something is broken

Before the clock

  • Mode from profile or instructor override.
  • Candidate has Module 0 bars and, ideally, a kind lab they can refer to.
  • Instructor (BayAreaLa8s Team) has the scenario JSON (modules/module-6-mock/scenarios.json) and the scorecard.
  • Screen share optional. Whiteboard or a gist is enough. Live kind is a bonus, not a gate.

Agenda shape (all modes)

SliceYou should hear
BackgroundWhat they own vs hope someone else owns
Docker / LinuxUSER, PID 1, digest, no secrets
KubernetesReady vs live, ClusterIP, a roll
TerraformS3 use_lockfile, 1.11+; DynamoDB is legacy
CI/CDPromote digest; no PR-to-prod
OperateTRACE on an injected failure
Their questionsThey interview you back

Exact minutes differ by mode (M-01 is 45; others 60). Do not skip Terraform locking to save time — it is a scoring landmine.

How to answer (candidate)

  1. Repeat the constraint (“kind is fine; I’ll map EKS only if needed”).
  2. Deploy: a concrete image and YAML shape.
  3. Automate: one digest, locked apply.
  4. Operate: TRACE letters in order when they say “it is broken.”
  5. Name a trade-off and something you refuse.

Do not dump twenty kubectl commands. Do not design a service mesh unless they ask.

How to score (instructor)

Each dimension 1–5. lib/scoring.js weights:

DimensionWeight
Containers0.10
Kubernetes0.20
Terraform0.17
CI/CD0.10
Linux / Networking0.08
Cloud0.07
Observability / Reliability0.10
Security0.06
Troubleshooting0.08
Communication / Trade-offs0.04

Contribution is rating * 20 * weight. All fives → 100. Edit comments before the learner sees them. Deduct Troubleshooting if they restart the cluster before impact. Deduct Terraform if they propose DynamoDB as the modern lock.

Disclaimer on every report: This score measures rehearsal performance against the BayLearn Cloud DevOps rubric. It does not predict a hiring outcome.

After the clock

Three keeps, three changes, two weak bars → Module 7 plan. Do not invent a new industry certification name on the feedback form.

COMMON MISTAKE: Treating the mock as a quiz of leftover trivia from Module 2.

SENIOR-LEVEL EXPECTATION: Lead and platform modes score *refusal* and blast radius as heavily as YAML.

Weak vs strong answer

Weak: Twenty kubectl commands, no trade-off, DynamoDB lock on a new stack.

Strong: “Deploy this digest. Automate with use_lockfile. Operate with TRACE. I refuse :latest and PR-to-prod.”

Whiteboard in 60 seconds

  1. Deploy / automate / operate across the top.
  2. One YAML shape, one backend block, one TRACE.
  3. A refuse list: latest, laptop apply, every DB in Kubernetes.

Follow-up ladder

  1. Which mode? → engineer 45 vs platform 60.
  2. Why Kubernetes is 20%? → most DevOps screens die on Ready / Endpoints.
  3. Why Terraform is 17%? → lock and state, not HCL trivia.
  4. Does 92 predict an offer? → no.

Interview questions

What must I say about locking?

S3 use_lockfile on 1.11+. DynamoDB is legacy.

What gets deducted first?

Restarting the cluster before impact. Laptop apply to prod.

INTERVIEW TIP: Ask where state lives and who can apply. The answer tells you more than a memorized provider argument.

Next: Feedback & 7-day plan.

You will

  • Read the readiness report
  • Practice the weakest two skills first

Feedback and 7-day plan10 min

Feedback and 7-day plan

Feedback and the 7-day plan

In one sentence: Turn two weak dimensions into seven dated rehearsals. Do not open 240 questions as a novel.

Deploy It. Automate It. Operate It. — the weekend loop Deploy It. Automate It. Operate It. — the weekend loop AssessContainerizeOrchestrateProvisionAutomateOperateTRACE · mock Spoken frame: Deploy It (image + YAML), Automate It (digest + lock), Operate It (TRACE).Module 0 scores the map. Module 5 proves it on kind. Module 6 scores the spoken interview.
Redraw the journey on day 7
TRACE — operate before you exec TRACE — operate before you exec Triagewho · how muchReviewlast changeAnalyzeEvents · logsCheckdeps · capacityExecutemitigate · cause Impact first. Restarting kind is not step one. Empty Endpoints are a proof, not a feeling.Mitigation restores traffic. Root cause is the sentence you write for Monday.
Day 3 and day 6 are TRACE on purpose
Team state — S3 + use_lockfile (DynamoDB locking is deprecated) Team state — S3 + use_lockfile (DynamoDB locking is deprecated) Dev A planreads stateS3 objectencrypt · versionuse_lockfile = trueLock fileone applyDo notDynamoDB lockas the design Terraform >= 1.11: native S3 lock files. Say 'deprecated' if they still mention DynamoDB.State IAM is as sensitive as production. Public buckets are an incident.
Day 4 — S3 plus use_lockfile, not a new DynamoDB table

Read the score like an adult

Status (mock)RangeMonday move
Needs Foundation0–49Redo Module 1–2 lessons out loud. C-01, C-08.
Developing50–64Lab + D-01 + locking backend from memory
Interview Capable65–74Two TRACE scenarios + C-24 / C-27
Interview Ready75–84Full mock again in 5 days; work the lowest dimension
Strong85–92Lead probes: what you refuse; paved road
Exceptional93–100Teach someone else TRACE and use_lockfile

These bands are not Module 0’s Foundation / Developing / Interview Capable / Interview Ready / Advanced cut-points. Do not mix reports.

The mock number is rehearsal. It does not predict hiring.

Default 7-day plan

Used when the player does not override with your weak skills:

DayFocusWhy
1Docker + container securityDeploy starts at USER and PID 1
2Kubernetes workloads + ServicesEmpty Endpoints fail more people than etcd trivia
3Kubernetes operations + TRACEOperate
4Terraform + state + modulesuse_lockfile, not DynamoDB
5CI/CD + deployment strategiesPromote the digest
6Observability + production troubleshootingRED/USE + a 502
7Full DevOps mockRehearse the frame under the clock

Swap days 1–6 so your weakest Module 6 dimensions land on days 1–3.

Daily practice recipe (45–70 minutes)

  1. Speak one question from interview-questions.md for 90 seconds.
  2. Do one challenge or one D-scenario.
  3. Redraw one diagram from memory (Browser→DB, state+lock, or TRACE).
  4. Write one “I refuse …” sentence (latest tags, PR-to-prod, laptop apply, every DB in Kubernetes).

Ten spoken answers beat fifty skims. Practice that way this week.

Certificate and honesty

If you complete the course, you may receive BayLearn Certificate of Completion: Cloud DevOps Interview Sprint — Docker + Kubernetes + Terraform. Put it on a résumé as a BayLearn course. Do not expand it into CKA.

The mock score disclaimer stays on any screenshot you share with a coach.

COMMON MISTAKE: Booking another mock immediately without doing days 1–3.

SENIOR-LEVEL EXPECTATION: The plan names artifacts (C-18, D-09, a backend block written from memory), not “review Kubernetes.”

INTERVIEW TIP: Bring the 7-day plan to a real on-site as your warm-up list. Interviewers like people who already know their gaps.

Weak vs strong answer

Weak: “Review Kubernetes” as the whole week.

Strong: “Day 1 C-01. Day 2 C-08. Day 4 write the backend block from memory. Day 7 remock.”

Whiteboard in 60 seconds

  1. Two weak dimensions on days 1–3.
  2. One diagram a day: Browser→DB, state+lock, TRACE.
  3. One refuse sentence a day.

Follow-up ladder

  1. Mix Module 0 bands with Module 6 bands? → no.
  2. Book another mock tomorrow? → not before days 1–3.
  3. Put CKA on the résumé? → no. BayLearn completion only.

Interview questions

What is a daily block?

90-second spoken answer, one challenge or D-scenario, one diagram from memory.

What artifact proves the week worked?

A second mock score and a backend block you can write without notes.

You are done with the curriculum spine. Downloads and the 240-question index are for the week after.

Pricing

Choose a delivery mode. BayAreaLa8s invoices after you request a session.

This text is a draft. It is not a current BayLearn offer and it does not change existing bookings. Read the draft refund policy

Self-paced

$59

Small group

$129

Live 1:1

$349

Introductory $299

Book a session

Request a slot. Invoicing is handled by BayAreaLa8s after the request — no Stripe checkout.

Log in or enroll to request a live session time.