Prompting guidesContainers and Kubernetes
Containers and Kubernetes terms for AI prompting
Contents
- How to prompt with these
- 1. Linux isolation under a container
- 2. Images and builds
- 3. Registries and supply chain
- 4. Runtimes
- 5. API objects and the control plane
- 6. Workload controllers
- 7. Scheduling and placement
- 8. Resources, QoS and eviction
- 9. Health, lifecycle and rollouts
- 10. Autoscaling
- 11. Networking
- 12. Storage
- 13. Configuration and secrets
- 14. Access control and Pod security
- 15. Extending Kubernetes and delivery
- 16. Debugging and observability
- Sources
Each term below is the name the Kubernetes docs, the OCI specs or the Linux man pages use for a thing. Each row says where the term lives, which is usually an API field, a component or a file, and gives a prompt line with numbers you can paste. Every section opens with the vague ask it replaces. The overview for this topic explains why each area matters, with whiteboard sketches.
How to prompt with these
Name the object, name the field, and give the number. A model that hears “make it production ready” guesses. A model that hears “requests cpu 250m memory 256Mi, limit memory 256Mi, no CPU limit, readiness probe on /healthz every 5 s” writes the manifest you meant.
- Use the API field name. Write
spec.template.spec.containers[].resources.requests, or at least “resources.requests”, instead of “give it enough memory”. Field names are unambiguous and the model has seen them in thousands of manifests. - Give units the way Kubernetes spells them. CPU in millicores like
250m, memory in binary units like256Mi, durations in seconds for probe fields. Mixing256Mand256Miis a real bug, because they differ by about 4.9%. - Pin versions. Name the Kubernetes minor version you run and the image digest you want. Fields move between alpha, beta and stable, and a manifest written for 1.36 can fail on 1.30.
- Ask for one resource kind per prompt section. Deployment, then Service, then NetworkPolicy. Ask for all of them in one file separated by
---only after each one is right. - State the failure you are fixing. “Pods restart with OOMKilled every 40 minutes” gets a better answer than “pods keep crashing”. Paste the
kubectl describe podevents. - Ask for the verification command. Every prompt should end with the
kubectlcommands that prove the change worked, such askubectl rollout statusorkubectl auth can-i. - Say what must not change. “Do not touch the StatefulSet’s volumeClaimTemplates” stops a model from writing a change that Kubernetes rejects, because that field is immutable.
- Ask for least privilege by default. Name the Pod Security Standard level and the RBAC verbs you expect, so the model doesn’t reach for
privileged: trueor a wildcard Role to make an error go away.
A template to copy:
Kubernetes 1.34 cluster, containerd runtime, Cilium CNI.
Write <kind> for <app> in namespace <ns>.
Spec:
- <field>: <value with units>, <one-line reason>
- <field>: <value with units>, <one-line reason>
Security: Pod Security Standard "restricted"; ServiceAccount <name> with only <verbs> on <resources>.
Do not change: <objects or fields>.
Verify with: <kubectl commands and the output I should see>.
1. Linux isolation under a container
Instead of “run it in a container so it’s isolated”, say which kernel mechanism does the isolating. A container is an ordinary Linux process placed in a set of namespaces and a cgroup, with capabilities dropped and a seccomp filter applied. Each of those is a separate setting.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| Namespace, Linux | Wraps a global resource so processes inside see their own copy | namespaces(7); eight kinds: cgroup, IPC, network, mount, PID, time, user, UTS |
“Explain which of the eight Linux namespaces this container shares with the host, and confirm with lsns -p <pid>.” |
| PID namespace | The container’s first process is PID 1 and can’t see host processes | pid_namespaces(7) |
“The app runs as PID 1, so it must handle SIGTERM and reap child processes. Use tini as the entrypoint if the app spawns children.” |
| Network namespace | Own interfaces, routes, ports and firewall rules | network_namespaces(7) |
“Containers in one Pod share a network namespace, so the app on port 8080 and the sidecar on 9090 must not collide.” |
| Mount namespace | Own view of the filesystem tree | mount_namespaces(7) |
“Mount only /data as writable; everything else comes from the image.” |
| User namespace | Maps root inside the container to an unprivileged UID on the host | user_namespaces(7); Pod field hostUsers: false, stable in Kubernetes 1.36 |
“Set hostUsers: false so UID 0 in the container maps to an unprivileged host UID.” |
| cgroup v2 | The kernel’s unified hierarchy that limits and accounts CPU, memory and I/O per group of processes | Documentation/admin-guide/cgroup-v2.rst; Kubernetes support stable since 1.25 |
“Assume cgroup v2 nodes. Show the memory.max and cpu.max values the kubelet will write for this container.” |
| cpu.max | The CFS quota and period that enforce a CPU limit | cgroup v2 file | “A CPU limit of 500m becomes cpu.max 50000 100000, which throttles the container after 50 ms of CPU in each 100 ms period.” |
| memory.max | Hard memory ceiling; exceeding it triggers the OOM killer inside the cgroup | cgroup v2 file | “memory.max equals the container’s memory limit. Explain what happens to the process when RSS plus page cache crosses it.” |
| PSI, pressure stall information | Per-cgroup time spent stalled waiting on CPU, memory or I/O | cgroup v2 files cpu.pressure, memory.pressure, io.pressure |
“Read memory.pressure for this Pod’s cgroup and alert when some avg10 stays above 10 for 5 minutes.” |
| Capabilities | Root’s powers split into about 40 separate privileges | capabilities(7); securityContext.capabilities |
“Drop ALL capabilities and add back only NET_BIND_SERVICE so the app can bind port 80 without root.” |
| seccomp | A BPF filter that allows or blocks system calls | Kernel seccomp_filter.rst; securityContext.seccompProfile |
“Set seccompProfile.type: RuntimeDefault on the Pod.” |
| No new privileges | Stops a process gaining privileges through setuid binaries | securityContext.allowPrivilegeEscalation: false |
“Set allowPrivilegeEscalation false on every container.” |
| OverlayFS | Union filesystem that stacks read-only image layers under one writable layer | Kernel overlayfs.rst; containerd’s default snapshotter |
“Explain why writes to /var/log inside the container vanish on restart: they land in the overlay upper directory, which is deleted with the container.” |
| Rootless containers | The runtime itself runs as an unprivileged user | Podman, rootless containerd and Docker | “Build and run this locally with rootless Podman; no sudo in any step.” |
2. Images and builds
Instead of “write a Dockerfile”, say how small, how reproducible and what user it runs as. An OCI image is a manifest that points to a config file and an ordered list of layer tarballs, all addressed by SHA-256 digest.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| OCI image | A manifest, a config and layers, defined by the Open Container Initiative | OCI Image Spec | “Push the image with OCI media types and check them with crane manifest.” |
| Image manifest | JSON that lists the config and each layer by digest, size and media type | Media type application/vnd.oci.image.manifest.v1+json |
“Print the manifest and list each layer’s size so we can see which step adds the most.” |
| Image index | A list of manifests, one per platform | Media type application/vnd.oci.image.index.v1+json |
“Build one tag that covers linux/amd64 and linux/arm64 as an image index using docker buildx build --platform.” |
| Layer | A tar changeset of files added, changed or removed | OCI layer spec; removals are whiteout files named .wh.<name> |
“Deleting a file in a later RUN step doesn’t shrink the image. Remove build tools in the same RUN step that installs them, or use a multi-stage build.” |
| Digest | sha256: plus the hash of the content; immutable |
OCI descriptor | “Reference the base image as node:22-slim@sha256:<digest> so rebuilds use the same bytes.” |
| Tag | A movable name that points at a digest | Registry | “Never deploy :latest. Tag with the git SHA and deploy by digest.” |
| Multi-stage build | Several FROM stages; only the last one ships | Dockerfile | “Stage 1 compiles with the full Go toolchain; stage 2 copies only the binary into gcr.io/distroless/static. Target image under 25 MB.” |
| Distroless or minimal base | A base with no shell or package manager | Google distroless, Chainguard, Alpine, scratch |
“Use a distroless base. Note that kubectl exec sh won’t work, so debug with kubectl debug instead.” |
| Layer cache ordering | Steps that change least go first so later builds reuse cache | Dockerfile | “Copy package.json and lockfile, run npm ci, then copy the source, so code edits don’t reinstall dependencies.” |
| BuildKit cache mount | A cache directory kept between builds but left out of the image | RUN --mount=type=cache |
“Use --mount=type=cache,target=/root/.cache/go-build for Go builds.” |
| Build secret | A secret available during one RUN step and absent from layers | RUN --mount=type=secret |
“Pass the npm token with --mount=type=secret,id=npmrc; it must not appear in docker history.” |
| .dockerignore | Files excluded from the build context | .dockerignore |
“Exclude .git, node_modules, .env and test fixtures from the context.” |
| Exec form | ENTRYPOINT ["app"] runs the binary directly, so it receives signals |
Dockerfile | “Use exec form for ENTRYPOINT so SIGTERM reaches the app, not a /bin/sh -c wrapper.” |
| USER | The UID the process runs as | Dockerfile USER 10001 |
“Create UID 10001 in the build stage and set USER 10001:10001; the Pod must pass runAsNonRoot: true.” |
| Reproducible build | Same source gives the same digest | SOURCE_DATE_EPOCH, pinned bases |
“Set SOURCE_DATE_EPOCH from the commit time and pin every base by digest so two CI runs give the same image digest.” |
| Image config | Entrypoint, env, user, working directory and layer diff IDs | Media type application/vnd.oci.image.config.v1+json |
“Show the image config and confirm User is 10001 and no secrets are in Env.” |
3. Registries and supply chain
Instead of “make the images secure”, name which artifact proves what. A registry stores images, and the same registry can store signatures, SBOMs and attestations attached to an image digest.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| Registry | Server that stores and serves images over HTTP | OCI Distribution Spec | “Push to our private registry; the cluster pulls with an imagePullSecrets entry on the ServiceAccount.” |
| Referrers API | Lists artifacts whose subject field points at a given manifest |
OCI Distribution Spec 1.1 | “Attach the SBOM and signature as referrers of the image digest and list them with oras discover.” |
| SBOM | Software bill of materials: every package in the image with versions | SPDX or CycloneDX formats; Syft generates | “Generate a CycloneDX SBOM with Syft during the build and attach it to the image.” |
| Vulnerability scan | Matches packages against CVE databases | Trivy, Grype | “Fail the pipeline on fixable CRITICAL CVEs only; list unfixable ones in the report.” |
| Image signing | Cryptographic signature over the image digest | Sigstore cosign | “Sign the image by digest with cosign in CI.” |
| Keyless signing | Short-lived certificate tied to an OIDC identity instead of a long-lived key | Sigstore Fulcio and the Rekor transparency log | “Use cosign keyless signing from GitHub Actions OIDC; verify with --certificate-identity and --certificate-oidc-issuer.” |
| Provenance | A signed record of how, where and from what source an artifact was built | SLSA, in-toto attestations | “Emit SLSA build provenance from the CI system and attach it to the image.” |
| SLSA Build level | L1 provenance exists; L2 signed by a hosted build platform; L3 hardened builder | SLSA spec | “Target SLSA Build L2: builds run only on hosted CI, and provenance is signed by the platform.” |
| Admission verification | The cluster rejects images without a valid signature | Kyverno verifyImages, Sigstore policy-controller |
“Add a Kyverno policy that requires a cosign signature from our CI identity for images in namespace prod.” |
| Image pull policy | When the kubelet pulls | imagePullPolicy: IfNotPresent / Always / Never |
“Deploy by digest with IfNotPresent; a digest can’t change, so re-pulling adds nothing.” |
| Pull-through cache | A registry mirror that caches upstream images | containerd hosts.toml, Harbor proxy cache |
“Configure containerd on nodes to pull docker.io through our Harbor proxy cache.” |
4. Runtimes
Instead of “use Docker on the nodes”, name the layer. Kubernetes talks to a CRI runtime, which calls an OCI runtime, which calls the kernel.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| OCI runtime | Takes a bundle directory and a config.json and runs a container |
OCI Runtime Spec; operations create, start, kill, delete, state | “Show the config.json runc receives for this Pod and point out the namespaces and seccomp sections.” |
| runc | The reference OCI runtime | opencontainers/runc | “Assume runc unless the Pod sets a runtimeClassName.” |
| CRI | The gRPC API between kubelet and the runtime | Container Runtime Interface | “Debug at the CRI level with crictl ps and crictl inspect on the node.” |
| containerd | A CRI runtime and image manager | CNCF project | “Configure containerd’s SystemdCgroup = true to match the kubelet’s systemd cgroup driver.” |
| CRI-O | A CRI runtime built only for Kubernetes | CNCF project | “Write the same node config for CRI-O instead of containerd.” |
| dockershim removal | Kubernetes stopped talking to Docker Engine directly in 1.24 | Kubernetes docs | “Don’t mount /var/run/docker.sock; nodes run containerd and have no Docker daemon.” |
| RuntimeClass | Selects a different runtime handler per Pod | node.k8s.io/v1 RuntimeClass, stable since 1.20 |
“Create a RuntimeClass gvisor with handler runsc and run the untrusted job with runtimeClassName: gvisor.” |
| Sandboxed runtime | Adds a kernel boundary: a user-space kernel or a micro-VM | gVisor, Kata Containers | “Run user-submitted code under Kata Containers so a kernel exploit stays inside the VM.” |
| Pause container | Holds a Pod’s namespaces while app containers restart | Created by the runtime per Pod sandbox | “Explain why crictl ps shows a pause container for every Pod.” |
5. API objects and the control plane
Instead of “deploy it to Kubernetes”, describe what you’re asking the API to store and what will act on it. Every Kubernetes object has a spec you write and a status the system writes, and controllers work to close the gap.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| kube-apiserver | The only component that reads and writes etcd; everything else goes through it | Control plane | “All automation talks to the API server with a ServiceAccount token; nothing touches etcd directly.” |
| etcd | Consistent key-value store for all cluster state | Control plane; run an odd number of members, five recommended for production | “Run a three-member etcd and take a snapshot every 6 hours with etcdctl snapshot save; test a restore.” |
| Desired state and observed state | spec is what you want; status is what the system reports |
Every object | “Write only spec. Never set status from a client.” |
| Controller | A loop that watches objects and acts to move status toward spec | kube-controller-manager and custom controllers | “Explain which controller acts when I scale this Deployment from 3 to 5.” |
| Reconciliation | One pass of a controller: read desired, read actual, act, requeue | Controller pattern | “Make the reconcile function idempotent: running it twice with no change makes no API writes.” |
| Watch | A stream of change events from the API server, resumed by resourceVersion | API concept | “Use an informer with a shared cache instead of polling List every 10 seconds.” |
| Labels and selectors | Key-value tags and the queries that match them | metadata.labels, spec.selector |
“Use app.kubernetes.io/name and app.kubernetes.io/instance labels; the Service selector uses both.” |
| Annotations | Non-identifying metadata read by tools | metadata.annotations |
“Put the git SHA in an annotation, not a label, because nothing selects on it.” |
| Namespace, Kubernetes | A scope for names, RBAC, quotas and policies | v1 Namespace |
“One namespace per team per environment: payments-prod, payments-staging.” |
| ownerReferences | Links a dependent object to its owner for garbage collection | metadata.ownerReferences |
“Set an ownerReference from each ConfigMap to its custom resource so deleting the CR deletes them.” |
| Finalizer | A key that blocks deletion until a controller removes it | metadata.finalizers |
“Add a finalizer that deletes the cloud bucket before the object goes away. Explain how to clear it by hand if the controller is gone.” |
| Server-side apply | The API server merges fields and records which manager owns each one | kubectl apply --server-side, managedFields |
“Use server-side apply with --field-manager=ci; report conflicts instead of forcing.” |
| Lease | A small object used for heartbeats and leader election | coordination.k8s.io/v1 Lease |
“Run 2 replicas of the controller with leader election through a Lease; only the leader reconciles.” |
| Admission controller | Code that mutates or validates requests after authentication and before storage | API server plugins and webhooks | “List which admission plugins will see this Pod create request and in which order.” |
6. Workload controllers
Instead of “keep it running”, pick the controller whose guarantees match the workload. The Pod is the unit that runs. The controllers create Pods from a template and differ in identity, ordering and completion.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| Pod | One or more containers sharing a network namespace and volumes, scheduled together | v1 Pod |
“Never create a bare Pod for a service; use a Deployment so a deleted Pod is replaced.” |
| ReplicaSet | Keeps N identical Pods running | apps/v1, owned by a Deployment |
“Don’t edit the ReplicaSet; change the Deployment template.” |
| Deployment | Rolling updates of stateless Pods through ReplicaSets | apps/v1 Deployment |
“Deployment with 3 replicas, revisionHistoryLimit: 5, rolling update maxSurge 1, maxUnavailable 0.” |
| StatefulSet | Pods with stable names, ordinal startup and one PVC each | apps/v1 StatefulSet |
“StatefulSet pg with 3 replicas, headless Service pg, volumeClaimTemplates 50Gi each, podManagementPolicy: OrderedReady.” |
| DaemonSet | One Pod per matching node | apps/v1 DaemonSet |
“DaemonSet for the log agent on every Linux node, tolerating the control-plane taint.” |
| Job | Runs Pods to completion | batch/v1 Job |
“Job with completions: 10, parallelism: 3, backoffLimit: 4, activeDeadlineSeconds: 1800.” |
| CronJob | Creates Jobs on a schedule | batch/v1 CronJob |
“CronJob at 0 3 * * * in time zone America/New_York, concurrencyPolicy: Forbid, keep 3 successful and 1 failed Job.” |
| Init container | Runs to completion before app containers start | spec.initContainers |
“Init container waits for the database by running pg_isready in a loop with a 60 s timeout.” |
| Sidecar container | An init container with restartPolicy: Always that runs alongside the app |
Stable in Kubernetes 1.33 | “Define the log shipper as a native sidecar so it starts before the app and stops after it.” |
| Ephemeral container | A debugging container added to a running Pod | kubectl debug, stable since 1.25 |
“Debug the distroless Pod with kubectl debug -it <pod> --image=busybox --target=app.” |
| Pod template hash | Label that ties Pods to their ReplicaSet | pod-template-hash |
“Explain why changing an annotation in the template starts a rollout.” |
7. Scheduling and placement
Instead of “spread it out” or “put it on the big nodes”, give the constraint and whether it is required or preferred. The scheduler filters nodes that can’t fit the Pod, then scores the rest.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| kube-scheduler | Binds each unscheduled Pod to a node in two phases, filtering then scoring | Control plane | “Explain from the events why this Pod is Pending: which filter rejected each node.” |
| nodeSelector | Required node labels, exact match | spec.nodeSelector |
“Schedule only on nodes labeled node.kubernetes.io/instance-type=m7g.xlarge.” |
| Node affinity | Required or preferred rules over node labels | affinity.nodeAffinity |
“requiredDuringSchedulingIgnoredDuringExecution on arm64; preferred weight 50 for zone us-east-1a.” |
| Pod anti-affinity | Keep Pods away from each other | affinity.podAntiAffinity |
“Required anti-affinity on kubernetes.io/hostname so no two replicas share a node.” |
| Topology spread constraints | Limit how unevenly Pods spread across a topology key | topologySpreadConstraints |
“maxSkew 1 across topology.kubernetes.io/zone, whenUnsatisfiable: DoNotSchedule.” |
| Taint | A node mark that repels Pods without a matching toleration | node.spec.taints; effects NoSchedule, PreferNoSchedule, NoExecute |
“Taint GPU nodes nvidia.com/gpu=present:NoSchedule.” |
| Toleration | Lets a Pod schedule onto a tainted node | spec.tolerations |
“Only the training Job tolerates the GPU taint and requests nvidia.com/gpu: 1.” |
| PriorityClass | Ranks Pods; higher priority can preempt lower | scheduling.k8s.io/v1 |
“PriorityClass critical value 100000 for ingress controllers; batch Jobs get preemptionPolicy: Never.” |
| Preemption | Evicting lower-priority Pods to fit a pending higher-priority Pod | Scheduler | “Explain which Pods would be preempted if this Pod can’t fit.” |
| PodDisruptionBudget | Limits voluntary evictions such as drains | policy/v1 PodDisruptionBudget, stable since 1.21 |
“PDB with minAvailable: 2 for the 3-replica API so a node drain evicts one Pod at a time.” |
| Voluntary disruption | Evictions someone chose: drains, autoscaler scale-down | Disruptions docs | “List which of our maintenance steps count as voluntary and are blocked by the PDB.” |
| Cordon and drain | Mark a node unschedulable, then evict its Pods through the eviction API | kubectl cordon, kubectl drain |
“Drain with --ignore-daemonsets --delete-emptydir-data --timeout=10m.” |
8. Resources, QoS and eviction
Instead of “give it more resources”, set requests from measured usage and limits from the failure you can accept. Requests drive scheduling. Limits are enforced by the kernel, and CPU and memory fail differently.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| Request | The amount the scheduler reserves on a node | resources.requests |
“Set requests to the p95 of usage over 7 days from Prometheus: cpu 250m, memory 300Mi.” |
| Limit | The ceiling the kernel enforces | resources.limits |
“Set memory limit equal to request; leave CPU limit unset.” |
| CPU throttling | A container over its CPU limit waits until the next CFS period | cgroup cpu.max, metric container_cpu_cfs_throttled_periods_total |
“Alert when throttled periods exceed 25% of total periods over 10 minutes.” |
| OOMKilled | The kernel killed a container that crossed its memory limit | Container lastState.terminated.reason |
“The Pod shows OOMKilled with exit code 137. Find whether the cause is a leak or a low limit from the memory graph before raising it.” |
| Millicore | One thousandth of a CPU | Quantity 250m |
“Write CPU as millicores, 250m, not 0.25.” |
| Binary memory units | Mi and Gi are powers of 1024; M and G are powers of 1000 | Resource quantities | “Use Mi and Gi everywhere.” |
| QoS class | Guaranteed, Burstable or BestEffort, derived from requests and limits | status.qosClass |
“Make the database Pod Guaranteed: requests equal limits for CPU and memory in every container.” |
| Node-pressure eviction | The kubelet evicts Pods when node memory or disk runs low | Default hard thresholds memory.available<100Mi, nodefs.available<10%, imagefs.available<15% |
“Explain eviction order on this node: BestEffort first, then Burstable Pods over their requests.” |
| Allocatable | Node capacity minus system and kubelet reservations | node.status.allocatable |
“Set systemReserved memory 1Gi and kubeReserved 500Mi on 16Gi nodes.” |
| Ephemeral storage | Local disk for container writable layers, logs and emptyDir | resources.requests.ephemeral-storage |
“Request 1Gi ephemeral-storage and limit 2Gi so a runaway log can’t fill the node.” |
| LimitRange | Per-namespace defaults and bounds for container resources | v1 LimitRange |
“Default request cpu 100m memory 128Mi, max memory 4Gi, in namespace team-a.” |
| ResourceQuota | Per-namespace total caps | v1 ResourceQuota |
“Quota for team-a: requests.cpu 20, requests.memory 64Gi, pods 200, services.loadbalancers 2.” |
| In-place resize | Change a running Pod’s CPU or memory without recreating it | /resize subresource, resizePolicy; stable in 1.35 |
“Raise the memory request in place through the resize subresource with resizePolicy NotRequired for CPU and RestartContainer for memory.” |
9. Health, lifecycle and rollouts
Instead of “make deploys safe”, say what each probe checks, how long shutdown takes and how many Pods may be missing during a rollout.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| Readiness probe | Failing removes the Pod from Service endpoints; the container keeps running | readinessProbe |
“Readiness: HTTP GET /ready on 8080, periodSeconds 5, failureThreshold 3. /ready checks the app’s own dependencies with a 1 s timeout.” |
| Liveness probe | Failing restarts the container | livenessProbe |
“Liveness: GET /healthz that checks only the process, never the database, so a database outage doesn’t restart every Pod.” |
| Startup probe | Holds off liveness and readiness until the app has started | startupProbe |
“Startup probe failureThreshold 30, periodSeconds 10, giving 300 s for a cold JVM start.” |
| Probe defaults | periodSeconds 10, timeoutSeconds 1, failureThreshold 3, successThreshold 1 | Probe spec | “State every probe field explicitly instead of relying on defaults.” |
| CrashLoopBackOff | Container keeps exiting; restarts back off 10 s, 20 s, 40 s up to 300 s | kubelet | “The Pod is in CrashLoopBackOff. Get the exit code and kubectl logs --previous before changing anything.” |
| Graceful termination | SIGTERM, then SIGKILL after the grace period, default 30 s | terminationGracePeriodSeconds |
“On SIGTERM, stop accepting new requests, finish in-flight ones within 25 s, then exit 0. Grace period 30 s.” |
| preStop hook | Runs before SIGTERM is sent | lifecycle.preStop |
“preStop sleep 5 s so endpoint removal propagates before the app stops listening.” |
| Rolling update | Replace Pods gradually | strategy.type: RollingUpdate; defaults maxSurge 25%, maxUnavailable 25% |
“maxUnavailable 0, maxSurge 1, so capacity never drops during a rollout.” |
| progressDeadlineSeconds | Marks a rollout failed if it stops progressing | Deployment spec, default 600 | “progressDeadlineSeconds 300; CI fails if kubectl rollout status --timeout=6m fails.” |
| minReadySeconds | A new Pod must stay Ready this long before it counts as available | Deployment spec | “minReadySeconds 15 so a Pod that crashes after 10 s doesn’t let the rollout continue.” |
| Rollback | Return to the previous ReplicaSet | kubectl rollout undo |
“Give the exact rollback command and how to confirm which revision is live.” |
| Canary | Send a small share of traffic to the new version first | Argo Rollouts, Flagger, Gateway API weights | “Canary with Argo Rollouts: 10% for 5 minutes, then 50%, abort if the 5xx rate exceeds 1%.” |
| Blue-green | Run both versions and switch the Service selector at once | Two Deployments, one Service | “Blue-green by switching the Service selector from version blue to green after smoke tests pass.” |
10. Autoscaling
Instead of “make it scale”, name what scales, on which metric and how fast it may shrink.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| HorizontalPodAutoscaler | Changes replica count from metrics | autoscaling/v2 HPA |
“HPA minReplicas 3, maxReplicas 30, target average CPU utilization 70% of requests.” |
| HPA formula | desiredReplicas = ceil(currentReplicas × current metric ÷ target metric), with a 0.1 tolerance | HPA docs | “Show the HPA’s arithmetic for 4 replicas at 105% CPU against a 70% target.” |
| Scale-down stabilization | The HPA uses the highest recommendation from a trailing window before scaling down, default 300 s | behavior.scaleDown.stabilizationWindowSeconds |
“Scale up immediately, scale down at most 20% per minute with a 300 s window.” |
| metrics-server | Supplies CPU and memory metrics to the HPA | Resource Metrics API | “Confirm metrics-server is installed with kubectl top pods.” |
| Custom and external metrics | HPA on queue depth, requests per second and similar | Custom and External Metrics APIs, Prometheus Adapter, KEDA | “Scale the worker on SQS queue depth with KEDA: one replica per 100 messages, max 50.” |
| VerticalPodAutoscaler | Recommends or sets requests from observed usage | Kubernetes autoscaler project | “Run VPA in updateMode: Off for 2 weeks and give me its recommendations.” |
| Cluster Autoscaler | Adds nodes when Pods are unschedulable and removes idle nodes | Kubernetes autoscaler project | “Cluster Autoscaler with scale-down after 10 minutes below 50% utilization.” |
| Karpenter | Provisions right-sized nodes directly from pending Pod requirements | Karpenter project | “Karpenter NodePool limited to arm64 and amd64 spot and on-demand, consolidation enabled.” |
11. Networking
Instead of “expose the app”, say which traffic, from where, at which layer. Every Pod gets its own IP, Pods reach each other without NAT, and a Service gives a set of Pods one stable address.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| Kubernetes network model | Every Pod has a cluster-wide unique IP; Pods talk to Pods without NAT | Networking concepts | “Explain how a packet gets from Pod A on node 1 to Pod B on node 2 with our CNI.” |
| CNI | Spec and plugins that wire a Pod’s network namespace | CNI spec; operations ADD, DEL, CHECK, STATUS, VERSION | “Use Cilium as the CNI in eBPF mode with kube-proxy replacement.” |
| Service | A stable virtual IP and DNS name in front of matching Pods | v1 Service |
“ClusterIP Service api port 80 targetPort 8080 selecting app.kubernetes.io/name: api.” |
| Service types | ClusterIP, NodePort with default range 30000 to 32767, LoadBalancer, ExternalName | spec.type |
“Expose internally only as ClusterIP; the Gateway handles outside traffic.” |
| Headless Service | No virtual IP; DNS returns Pod IPs directly | clusterIP: None |
“Headless Service for the StatefulSet so each Pod gets pg-0.pg.db.svc.cluster.local.” |
| EndpointSlice | Lists the ready addresses behind a Service, 100 per slice by default | discovery.k8s.io/v1 |
“Show the EndpointSlices for api and confirm only Ready Pods are listed.” |
| kube-proxy | Programs Service routing on each node | iptables mode, nftables mode; IPVS mode deprecated in 1.35 | “Use kube-proxy in nftables mode.” |
| externalTrafficPolicy | Local keeps client source IPs and skips the extra hop | Service spec | “LoadBalancer with externalTrafficPolicy: Local so the app sees client IPs.” |
| Cluster DNS | CoreDNS answers <service>.<namespace>.svc.cluster.local |
DNS for Services and Pods | “Call the service by api.payments.svc.cluster.local. with the trailing dot to skip search-path lookups.” |
| Ingress | HTTP routing to Services; the API is frozen | networking.k8s.io/v1 Ingress |
“Don’t add new Ingress objects; write Gateway API routes.” |
| Gateway API | GatewayClass, Gateway and route resources, with roles for infrastructure provider, cluster operator and application developer | gateway.networking.k8s.io |
“Cluster operator owns Gateway public in namespace infra; the app team writes an HTTPRoute in its own namespace that attaches to it.” |
| HTTPRoute | Matches host, path and headers and forwards to backends with weights | Gateway API | “HTTPRoute for api.example.com: path /v2 to api-v2 weight 90 and api-v3 weight 10.” |
| NetworkPolicy | Allow-list rules for Pod ingress and egress | networking.k8s.io/v1; needs a CNI that enforces it |
“Default-deny ingress and egress in namespace payments, then allow egress to kube-dns on UDP and TCP 53 and ingress from the Gateway namespace on 8080.” |
| Service mesh | Sidecar or node proxies adding mTLS, retries and traffic metrics | Istio, Linkerd, Cilium; Gateway API GAMMA for mesh routing | “Enable mTLS STRICT between namespaces with Istio ambient mode; no sidecars.” |
12. Storage
Instead of “add a database disk”, say the access mode, what happens on delete, and when the volume binds.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| Volume | Storage mounted into a Pod’s containers | spec.volumes |
“Mount a ConfigMap volume read-only at /etc/app.” |
| emptyDir | Scratch space that lives as long as the Pod | emptyDir, optional medium: Memory |
“emptyDir with sizeLimit 1Gi for /tmp; note that medium: Memory counts against the memory limit.” |
| PersistentVolumeClaim | A request for storage of a size and access mode | v1 PVC |
“PVC 50Gi, ReadWriteOnce, storageClassName gp3-retain.” |
| PersistentVolume | The actual piece of storage bound to a claim | v1 PV |
“Show the PV bound to this PVC and its reclaim policy.” |
| StorageClass | Template for dynamic provisioning: driver, parameters, policies | storage.k8s.io/v1 |
“StorageClass gp3-retain: EBS CSI, type gp3, 3000 IOPS, reclaimPolicy: Retain, allowVolumeExpansion: true.” |
| Access modes | ReadWriteOnce, ReadOnlyMany, ReadWriteMany, ReadWriteOncePod | PV and PVC spec | “Use ReadWriteOncePod so only one Pod in the cluster can mount it.” |
| Reclaim policy | Delete removes the backing disk with the PVC; Retain keeps it | persistentVolumeReclaimPolicy |
“Retain for anything holding customer data.” |
| volumeBindingMode | WaitForFirstConsumer delays provisioning until a Pod is scheduled | StorageClass | “WaitForFirstConsumer so the disk is created in the same zone as the Pod.” |
| CSI | gRPC spec storage drivers implement: CreateVolume, ControllerPublishVolume, NodeStageVolume, NodePublishVolume | Container Storage Interface spec | “Explain which CSI call fails when the Pod is stuck in ContainerCreating with a FailedAttachVolume event.” |
| volumeClaimTemplates | Per-replica PVCs in a StatefulSet; immutable | StatefulSet spec | “Each replica gets data-pg-<n>; deleting the StatefulSet keeps the PVCs.” |
| VolumeSnapshot | Point-in-time copy through the CSI driver | snapshot.storage.k8s.io/v1 |
“Nightly VolumeSnapshot of each data PVC, keep 7.” |
| Volume expansion | Grow a PVC in place | allowVolumeExpansion: true |
“Resize the PVC from 50Gi to 100Gi and confirm the filesystem grew inside the Pod.” |
13. Configuration and secrets
Instead of “pass the config in”, say where values come from and who can read them.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| ConfigMap | Non-secret key-value config | v1 ConfigMap |
“Mount the ConfigMap as files; mounted keys update in place, environment variables don’t.” |
| Secret | Small sensitive values, stored base64-encoded | v1 Secret |
“Base64 isn’t encryption. Who can get secrets in this namespace?” |
| Encryption at rest | API server encrypts Secrets before writing to etcd | EncryptionConfiguration; Secrets are unencrypted in etcd by default | “Enable encryption at rest for secrets with a KMS v2 provider.” |
| External Secrets | Syncs secrets from a vault into Kubernetes Secrets | External Secrets Operator | “ExternalSecret pulling prod/db from AWS Secrets Manager every 1 h into Secret db-creds.” |
| Secrets Store CSI Driver | Mounts vault secrets as files without creating a Secret object | Kubernetes SIG project | “Mount the Vault secret through the Secrets Store CSI Driver so it never lands in etcd.” |
| Immutable ConfigMap or Secret | Can’t be changed after creation; saves the kubelet from watching it | immutable: true |
“Make config immutable and roll it with a name suffix hash, as Kustomize’s configMapGenerator does.” |
| Projected service account token | Short-lived, audience-bound JWT mounted into the Pod | Projected volume serviceAccountToken |
“Mount a token with audience vault and expirationSeconds 3600 for Vault Kubernetes auth.” |
| Downward API | Exposes Pod fields such as name, namespace and limits to the container | fieldRef, resourceFieldRef |
“Expose limits.memory as MEMORY_LIMIT through the downward API and set GOMEMLIMIT to 90% of it in the entrypoint.” |
14. Access control and Pod security
Instead of “lock it down”, name the subject, the verbs and the Pod Security level.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| RBAC | Role-based access control through four object kinds | rbac.authorization.k8s.io/v1 |
“Least privilege only. No wildcards in verbs or resources.” |
| Role and ClusterRole | Sets of verbs on resources, namespaced or cluster-wide | RBAC | “Role deployer in ns app: get, list, watch, patch on deployments; get on pods/log.” |
| RoleBinding and ClusterRoleBinding | Grant a role to users, groups or ServiceAccounts | RBAC | “Bind ClusterRole view with a RoleBinding in ns app only, not a ClusterRoleBinding.” |
| Escalation verbs | escalate, bind and impersonate let a subject gain more rights |
RBAC docs | “Flag any Role that grants escalate, bind, impersonate, or create on pods/exec.” |
| ServiceAccount | Identity for Pods | v1 ServiceAccount |
“One ServiceAccount per app; automountServiceAccountToken: false unless the app calls the API.” |
| kubectl auth can-i | Checks what a subject may do | kubectl | “Verify with kubectl auth can-i --list --as=system:serviceaccount:app:deployer -n app.” |
| Pod Security Standards | Three levels: Privileged, Baseline, Restricted | Kubernetes docs | “All app namespaces meet Restricted.” |
| Pod Security Admission | Built-in admission that applies the standards per namespace in enforce, audit or warn mode | Namespace labels pod-security.kubernetes.io/<mode> |
“Label ns app with enforce=restricted and warn=restricted, pinned to version v1.34.” |
| securityContext | Per-Pod and per-container security fields | Pod spec | “runAsNonRoot true, runAsUser 10001, readOnlyRootFilesystem true, allowPrivilegeEscalation false, capabilities drop ALL, seccompProfile RuntimeDefault.” |
| Privileged container | Has all host capabilities and devices | securityContext.privileged: true |
“Explain why this needs privileged; propose specific capabilities instead.” |
| ValidatingAdmissionPolicy | In-process validation rules written in CEL | admissionregistration.k8s.io/v1, stable since 1.30 |
“ValidatingAdmissionPolicy that rejects Deployments without resources.requests in namespaces labeled env=prod.” |
| Policy engine | Admission webhooks for validation, mutation and image verification | Kyverno, OPA Gatekeeper | “Kyverno ClusterPolicy in Audit mode first; switch to Enforce after a week with no violations.” |
| Audit log | API server record of who did what | Audit policy | “Audit policy: Metadata level for secrets, RequestResponse for RBAC changes.” |
15. Extending Kubernetes and delivery
Instead of “automate the deployment”, say what defines the desired state and what applies it.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| CustomResourceDefinition | Adds a new resource type to the API | apiextensions.k8s.io/v1 CRD |
“CRD Database with an OpenAPI schema, a status subresource and printer columns for phase and age.” |
| Operator | A custom controller that runs an application’s operational tasks through a CRD | Operator pattern | “Operator for Postgres: on spec.version change, back up, upgrade replicas one at a time, then the primary.” |
| controller-runtime and Kubebuilder | Go libraries and a project generator for controllers | kubernetes-sigs | “Scaffold with Kubebuilder; reconcile returns RequeueAfter: 5m for drift checks.” |
| Status conditions | Typed True, False or Unknown entries with reason and message | status.conditions |
“Set a Ready condition with reason and observedGeneration on every reconcile.” |
| observedGeneration | The spec generation the controller last acted on | status.observedGeneration |
“Readers treat status as stale while observedGeneration is below metadata.generation.” |
| Helm | Templated packages called charts, installed as releases | Helm | “Helm chart with values for replicas, image digest and resources; helm template output must pass kubeconform.” |
| Kustomize | Overlays that patch plain YAML per environment | Built into kubectl | “Base plus overlays dev and prod; prod patches replicas to 6 and adds the PDB.” |
| GitOps | A controller syncs the cluster to a git repository | Argo CD, Flux | “Argo CD Application with automated sync, prune and selfHeal for path deploy/prod.” |
| Drift | Live state differs from the declared state | GitOps tools | “Report drift instead of auto-correcting for the first week.” |
| Manifest validation | Schema checks before apply | kubeconform, kubectl apply --dry-run=server |
“Run kubeconform with strict mode and a server-side dry run in CI.” |
16. Debugging and observability
Instead of “it’s broken, fix it”, paste the evidence and ask for the next command.
| Term | What it is | Where it lives | Prompt line |
|---|---|---|---|
| Events | Short-lived records of what controllers and the kubelet did | kubectl events, kubectl describe |
“Here are the events. Which component emitted the failure and what does the reason mean?” |
| Pending | Pod not yet scheduled, or waiting for volumes | Pod phase | “The Pod is Pending with FailedScheduling 0/6 nodes are available. Read the reasons and propose the smallest fix.” |
| ImagePullBackOff | The kubelet failed to pull the image and is backing off | Container waiting reason | “Check image name, tag, registry auth through imagePullSecrets, and node egress, in that order.” |
| CreateContainerConfigError | A referenced ConfigMap or Secret key is missing | Container waiting reason | “Find which ConfigMap or Secret key the Pod references that doesn’t exist.” |
| Exit code 137 | Process killed by SIGKILL, often the OOM killer | Container terminated state | “Distinguish OOMKilled from a liveness-probe kill using the reason field and events.” |
| kubectl logs —previous | Logs from the container’s last crashed instance | kubectl | “Always get --previous logs for a restarted container.” |
| Golden signals | Latency, traffic, errors, saturation | Google SRE book | “Dashboard per Service with the four golden signals plus Pod restarts and CPU throttling.” |
| kube-state-metrics | Exposes object state as Prometheus metrics | Kubernetes project | “Alert on kube_deployment_status_replicas_available below spec for 10 minutes.” |
| OpenTelemetry Collector | Receives, processes and exports traces, metrics and logs | OpenTelemetry | “Run the OTel Collector as a DaemonSet with the k8sattributes processor.” |
Sources
Pages read for this guide on 2026-12-02. Prompt values not attributed to a source are suggested starting points.
- Kubernetes Components, Kubernetes docs
- Controllers, Kubernetes docs
- Leases, Kubernetes docs
- Operating etcd clusters for Kubernetes, Kubernetes docs
- Server-Side Apply, Kubernetes docs
- Finalizers, Kubernetes docs
- Pod Lifecycle, Kubernetes docs
- Liveness, Readiness, and Startup Probes, Kubernetes docs
- Deployments, Kubernetes docs
- StatefulSets, Kubernetes docs
- Sidecar Containers, Kubernetes docs
- Ephemeral Containers, Kubernetes docs
- Kubernetes Scheduler, Kubernetes docs
- Pod Topology Spread Constraints, Kubernetes docs
- Taints and Tolerations, Kubernetes docs
- Disruptions, Kubernetes docs
- Resource Management for Pods and Containers, Kubernetes docs
- Pod Quality of Service Classes, Kubernetes docs
- Node-pressure Eviction, Kubernetes docs
- About cgroup v2, Kubernetes docs
- Horizontal Pod Autoscaling, Kubernetes docs
- Service, Kubernetes docs
- Virtual IPs and Service Proxies, Kubernetes docs
- EndpointSlices, Kubernetes docs
- DNS for Services and Pods, Kubernetes docs
- Ingress, Kubernetes docs
- Network Policies, Kubernetes docs
- Gateway API introduction, Kubernetes SIG Network
- Persistent Volumes, Kubernetes docs
- Storage Classes, Kubernetes docs
- Secrets, Kubernetes docs
- Using RBAC Authorization, Kubernetes docs
- Pod Security Standards, Kubernetes docs
- Pod Security Admission, Kubernetes docs
- Validating Admission Policy, Kubernetes docs
- User Namespaces, Kubernetes docs
- Runtime Class, Kubernetes docs
- Container Runtime Interface, Kubernetes docs
- Migrating from dockershim, Kubernetes docs
- Images, Kubernetes docs
- Operator pattern, Kubernetes docs
- Custom Resources, Kubernetes docs
- Feature gates, Kubernetes docs, for the SidecarContainers, UserNamespacesSupport and InPlacePodVerticalScaling stages
- OCI Image Format Specification, with its manifest, image index and layer documents
- OCI Runtime Specification
- OCI Distribution Specification
- CNI Specification
- Container Storage Interface Specification
- Control Group v2, Linux kernel docs
- Seccomp BPF, Linux kernel docs
- Overlay Filesystem, Linux kernel docs
- namespaces(7), user_namespaces(7) and capabilities(7), Linux man-pages
- Sigstore keyless signing overview, Sigstore docs
- SLSA security levels, SLSA v1.0; version 1.2 is current