Kubernetes Advanced
This chapter connects ingress and TLS, metrics-driven and event-driven scaling, availability budgets, reusable Helm packages, least-privilege RBAC, and persistent state.
- Explain Ingress, HPA & KEDA by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Helm charts by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain RBAC & PersistentVolumes by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Storage & pod security details by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Trace the chapter's complete execution path and identify where memory, I/O, concurrency, persistence, or rendering cost accumulates.
How to use this chapter
For Kubernetes Advanced, read the explanations first and predict every example before running it. Keep a learning repository containing code, tests, command output, and the short written submission. The roadmap checklist at the end audits coverage; the chapter itself follows the operations learning arc appropriate to this subject.
The problem this chapter solves
This chapter connects ingress and TLS, metrics-driven and event-driven scaling, availability budgets, reusable Helm packages, least-privilege RBAC, and persistent state.
Automation reduces configuration drift and makes deployments, rollbacks, capacity, permissions, and incident response reproducible.
Learning outcomes
- Explain Ingress, HPA & KEDA by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Helm charts by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain RBAC & PersistentVolumes by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Storage & pod security details by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Trace the chapter's complete execution path and identify where memory, I/O, concurrency, persistence, or rendering cost accumulates.
- Build the worked example, make one failure visible, and defend the design in a review.
Chapter progression
The order below is intentional: later sections depend on guarantees established earlier.
Runtime or system overview
A container is an isolated process using kernel namespaces and cgroups, not a virtual machine. Kubernetes controllers continuously compare desired and observed state. CI runners execute an immutable workflow revision. Observability correlates metrics, logs, and traces across those layers. In Kubernetes Advanced, use that execution model to decide where the chapter's validation, state ownership, cleanup, and evidence belong.
Execution trace
- A versioned manifest or workflow is parsed and validated, and authentication plus authorization determines which control-plane operations are allowed.
- The platform records desired state; controllers, runners, or cloud services reconcile it by creating artifacts, workloads, routes, identities, and telemetry pipelines.
- Readiness and health gates control traffic while resource requests, limits, quotas, pools, and autoscaling signals bound capacity.
- A failed rollout, hook, job, or health condition follows the documented retry, pause, rollback, or incident path without changing immutable artifact identity.
- Deployment verification checks the user path, version/digest, metrics, logs, traces, alerts, permissions, and recovery procedure rather than only command exit status.
Memory and performance lens
Resource requests drive scheduling; limits constrain cgroups and may trigger throttling or OOM termination. Build layers, image caches, log buffers, telemetry cardinality, and unbounded queues consume storage or memory even when application code appears stable. For Kubernetes Advanced, connect those costs to the concrete operations in the topic sections rather than assuming the friendly surface syntax is cheap.
When tuning Kubernetes Advanced, measure build duration, artifact size, rollout health, CPU/memory saturation, restart/OOM rate, telemetry cardinality, and rollback time rather than optimizing from source-code appearance.
1. Ingress, HPA & KEDA
The Ingress, HPA & KEDA unit begins with Nginx Ingress + Cert-Manager automatic TLS: Ingress and certificate controllers expose routed TLS traffic, while HPA and KEDA reconcile replica count from resource, custom, or event-pressure metrics and PDB limits voluntary disruption. Set realistic requests, stabilize scale decisions, test zero-to-one activation, and monitor the downstream bottleneck as replicas grow. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
Desired state and operational contract: Ingress, HPA & KEDA
| Concept | Meaning | Engineering decision |
|---|---|---|
| Nginx Ingress + Cert-Manager automatic TLS | Ingress and certificate controllers expose routed TLS traffic, while HPA and KEDA reconcile replica count from resource, custom, or event-pressure metrics and PDB limits voluntary disruption. | Set realistic requests, stabilize scale decisions, test zero-to-one activation, and monitor the downstream bottleneck as replicas grow. |
| HPA: CPU/memory targets | Ingress and certificate controllers expose routed TLS traffic, while HPA and KEDA reconcile replica count from resource, custom, or event-pressure metrics and PDB limits voluntary disruption. | Set realistic requests, stabilize scale decisions, test zero-to-one activation, and monitor the downstream bottleneck as replicas grow. |
| custom metrics HPA (requests per second) | Ingress and certificate controllers expose routed TLS traffic, while HPA and KEDA reconcile replica count from resource, custom, or event-pressure metrics and PDB limits voluntary disruption. | Set realistic requests, stabilize scale decisions, test zero-to-one activation, and monitor the downstream bottleneck as replicas grow. |
| KEDA: event-driven scaling (Kafka lag/queue depth) | Ingress and certificate controllers expose routed TLS traffic, while HPA and KEDA reconcile replica count from resource, custom, or event-pressure metrics and PDB limits voluntary disruption. | Set realistic requests, stabilize scale decisions, test zero-to-one activation, and monitor the downstream bottleneck as replicas grow. |
| PodDisruptionBudget for availability | Ingress and certificate controllers expose routed TLS traffic, while HPA and KEDA reconcile replica count from resource, custom, or event-pressure metrics and PDB limits voluntary disruption. | Set realistic requests, stabilize scale decisions, test zero-to-one activation, and monitor the downstream bottleneck as replicas grow. |
What the platform reconciles: Ingress, HPA & KEDA
Nginx Ingress + Cert-Manager automatic TLS. Controllers observe objects and metrics, calculate desired replicas, and update workload state; KEDA activates or scales from sources such as Kafka lag or queue depth; a PDB constrains eviction rather than guaranteeing capacity.
HPA: CPU/memory targets. Controllers observe objects and metrics, calculate desired replicas, and update workload state; KEDA activates or scales from sources such as Kafka lag or queue depth; a PDB constrains eviction rather than guaranteeing capacity.
custom metrics HPA (requests per second). Controllers observe objects and metrics, calculate desired replicas, and update workload state; KEDA activates or scales from sources such as Kafka lag or queue depth; a PDB constrains eviction rather than guaranteeing capacity.
KEDA: event-driven scaling (Kafka lag/queue depth). Controllers observe objects and metrics, calculate desired replicas, and update workload state; KEDA activates or scales from sources such as Kafka lag or queue depth; a PDB constrains eviction rather than guaranteeing capacity.
PodDisruptionBudget for availability. Controllers observe objects and metrics, calculate desired replicas, and update workload state; KEDA activates or scales from sources such as Kafka lag or queue depth; a PDB constrains eviction rather than guaranteeing capacity.
Read these as one system: Nginx Ingress + Cert-Manager automatic TLS establishes the starting contract, HPA: CPU/memory targets changes how that contract is executed or represented, and PodDisruptionBudget for availability exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
Configuration with an observable result: Ingress, HPA & KEDA
1apiVersion: autoscaling/v22kind: HorizontalPodAutoscaler3spec:4 minReplicas: 25 maxReplicas: 10This Ingress, HPA & KEDA slice makes Nginx Ingress + Cert-Manager automatic TLS observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward PodDisruptionBudget for availability, predict its behavior for empty, invalid, repeated, and large input.
Failure and security boundaries: Ingress, HPA & KEDA
| Risk | Why it matters |
|---|---|
| Nginx Ingress + Cert-Manager automatic TLS | Kafka lag here is a scaling signal, not the SQL LAG window function; autoscaling cannot repair an exhausted database. |
| HPA: CPU/memory targets | Kafka lag here is a scaling signal, not the SQL LAG window function; autoscaling cannot repair an exhausted database. |
| custom metrics HPA (requests per second) | Kafka lag here is a scaling signal, not the SQL LAG window function; autoscaling cannot repair an exhausted database. |
| KEDA: event-driven scaling (Kafka lag/queue depth) | Kafka lag here is a scaling signal, not the SQL LAG window function; autoscaling cannot repair an exhausted database. |
| PodDisruptionBudget for availability | Kafka lag here is a scaling signal, not the SQL LAG window function; autoscaling cannot repair an exhausted database. |
Operations drill: Ingress, HPA & KEDA
- Foundation: implement or demonstrate Nginx Ingress + Cert-Manager automatic TLS with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine Nginx Ingress + Cert-Manager automatic TLS with HPA: CPU/memory targets. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for PodDisruptionBudget for availability. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
2. Helm charts
The Helm charts unit begins with Chart.yaml/values.yaml/templates/ structure: A Helm chart packages parameterized Kubernetes manifests, release metadata, validation, hooks, and upgrade or rollback operations. Keep defaults safe, validate values, render and lint in CI, make hooks idempotent, and use expand-migrate-contract for schemas. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
Desired state and operational contract: Helm charts
| Concept | Meaning | Engineering decision |
|---|---|---|
| Chart.yaml/values.yaml/templates/ structure | A Helm chart packages parameterized Kubernetes manifests, release metadata, validation, hooks, and upgrade or rollback operations. | Keep defaults safe, validate values, render and lint in CI, make hooks idempotent, and use expand-migrate-contract for schemas. |
| {{ .Values.image.tag }} template syntax | A Helm chart packages parameterized Kubernetes manifests, release metadata, validation, hooks, and upgrade or rollback operations. | Keep defaults safe, validate values, render and lint in CI, make hooks idempotent, and use expand-migrate-contract for schemas. |
| _helpers.tpl for reusable templates | A Helm chart packages parameterized Kubernetes manifests, release metadata, validation, hooks, and upgrade or rollback operations. | Keep defaults safe, validate values, render and lint in CI, make hooks idempotent, and use expand-migrate-contract for schemas. |
| helm install/upgrade/rollback/lint/template | A Helm chart packages parameterized Kubernetes manifests, release metadata, validation, hooks, and upgrade or rollback operations. | Keep defaults safe, validate values, render and lint in CI, make hooks idempotent, and use expand-migrate-contract for schemas. |
| pre-install migration job hooks | A Helm chart packages parameterized Kubernetes manifests, release metadata, validation, hooks, and upgrade or rollback operations. | Keep defaults safe, validate values, render and lint in CI, make hooks idempotent, and use expand-migrate-contract for schemas. |
What the platform reconciles: Helm charts
Chart.yaml/values.yaml/templates/ structure. Go templates render chart files with supplied values; Helm submits the resulting objects and stores release revisions; lifecycle hooks can run separately ordered Jobs such as backward-compatible database migrations.
{{ .Values.image.tag }} template syntax. Go templates render chart files with supplied values; Helm submits the resulting objects and stores release revisions; lifecycle hooks can run separately ordered Jobs such as backward-compatible database migrations.
_helpers.tpl for reusable templates. Go templates render chart files with supplied values; Helm submits the resulting objects and stores release revisions; lifecycle hooks can run separately ordered Jobs such as backward-compatible database migrations.
helm install/upgrade/rollback/lint/template. Go templates render chart files with supplied values; Helm submits the resulting objects and stores release revisions; lifecycle hooks can run separately ordered Jobs such as backward-compatible database migrations.
pre-install migration job hooks. Go templates render chart files with supplied values; Helm submits the resulting objects and stores release revisions; lifecycle hooks can run separately ordered Jobs such as backward-compatible database migrations.
Read these as one system: Chart.yaml/values.yaml/templates/ structure establishes the starting contract, {{ .Values.image.tag }} template syntax changes how that contract is executed or represented, and pre-install migration job hooks exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
Failure and security boundaries: Helm charts
| Risk | Why it matters |
|---|---|
| Chart.yaml/values.yaml/templates/ structure | A Helm migration hook is not a Django migration explanation, and rolling manifests back cannot undo arbitrary data changes. |
| {{ .Values.image.tag }} template syntax | A Helm migration hook is not a Django migration explanation, and rolling manifests back cannot undo arbitrary data changes. |
| _helpers.tpl for reusable templates | A Helm migration hook is not a Django migration explanation, and rolling manifests back cannot undo arbitrary data changes. |
| helm install/upgrade/rollback/lint/template | A Helm migration hook is not a Django migration explanation, and rolling manifests back cannot undo arbitrary data changes. |
| pre-install migration job hooks | A Helm migration hook is not a Django migration explanation, and rolling manifests back cannot undo arbitrary data changes. |
Operations drill: Helm charts
- Foundation: implement or demonstrate Chart.yaml/values.yaml/templates/ structure with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine Chart.yaml/values.yaml/templates/ structure with {{ .Values.image.tag }} template syntax. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for pre-install migration job hooks. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
3. RBAC & PersistentVolumes
The RBAC & PersistentVolumes unit begins with ServiceAccount/Role/ClusterRole/RoleBinding: Kubernetes RBAC authorizes API operations for users or ServiceAccounts, while PV, PVC, StorageClass, and access modes define durable storage provisioning and attachment contracts. Grant namespaced least privilege, test permissions with auth can-i, select access modes from the storage backend, and rehearse restore and expansion. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
Desired state and operational contract: RBAC & PersistentVolumes
| Concept | Meaning | Engineering decision |
|---|---|---|
| ServiceAccount/Role/ClusterRole/RoleBinding | Kubernetes RBAC authorizes API operations for users or ServiceAccounts, while PV, PVC, StorageClass, and access modes define durable storage provisioning and attachment contracts. | Grant namespaced least privilege, test permissions with auth can-i, select access modes from the storage backend, and rehearse restore and expansion. |
| kubectl auth can-i auditing | Kubernetes RBAC authorizes API operations for users or ServiceAccounts, while PV, PVC, StorageClass, and access modes define durable storage provisioning and attachment contracts. | Grant namespaced least privilege, test permissions with auth can-i, select access modes from the storage backend, and rehearse restore and expansion. |
| PV/PVC with dynamic StorageClass | Kubernetes RBAC authorizes API operations for users or ServiceAccounts, while PV, PVC, StorageClass, and access modes define durable storage provisioning and attachment contracts. | Grant namespaced least privilege, test permissions with auth can-i, select access modes from the storage backend, and rehearse restore and expansion. |
| StatefulSet volumeClaimTemplates | Kubernetes RBAC authorizes API operations for users or ServiceAccounts, while PV, PVC, StorageClass, and access modes define durable storage provisioning and attachment contracts. | Grant namespaced least privilege, test permissions with auth can-i, select access modes from the storage backend, and rehearse restore and expansion. |
What the platform reconciles: RBAC & PersistentVolumes
ServiceAccount/Role/ClusterRole/RoleBinding. The API server evaluates Role or ClusterRole bindings; ServiceAccount tokens identify workloads; claims bind to volumes statically or through a provisioner and retain lifecycle according to reclaim policy.
kubectl auth can-i auditing. The API server evaluates Role or ClusterRole bindings; ServiceAccount tokens identify workloads; claims bind to volumes statically or through a provisioner and retain lifecycle according to reclaim policy.
PV/PVC with dynamic StorageClass. The API server evaluates Role or ClusterRole bindings; ServiceAccount tokens identify workloads; claims bind to volumes statically or through a provisioner and retain lifecycle according to reclaim policy.
StatefulSet volumeClaimTemplates. The API server evaluates Role or ClusterRole bindings; ServiceAccount tokens identify workloads; claims bind to volumes statically or through a provisioner and retain lifecycle according to reclaim policy.
Read these as one system: ServiceAccount/Role/ClusterRole/RoleBinding establishes the starting contract, kubectl auth can-i auditing changes how that contract is executed or represented, and StatefulSet volumeClaimTemplates exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
Failure and security boundaries: RBAC & PersistentVolumes
| Risk | Why it matters |
|---|---|
| ServiceAccount/Role/ClusterRole/RoleBinding | Kubernetes RBAC is not JWT application authorization, and deleting a claim can delete data under some reclaim policies. |
| kubectl auth can-i auditing | Kubernetes RBAC is not JWT application authorization, and deleting a claim can delete data under some reclaim policies. |
| PV/PVC with dynamic StorageClass | Kubernetes RBAC is not JWT application authorization, and deleting a claim can delete data under some reclaim policies. |
| StatefulSet volumeClaimTemplates | Kubernetes RBAC is not JWT application authorization, and deleting a claim can delete data under some reclaim policies. |
Operations drill: RBAC & PersistentVolumes
- Foundation: implement or demonstrate ServiceAccount/Role/ClusterRole/RoleBinding with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine ServiceAccount/Role/ClusterRole/RoleBinding with kubectl auth can-i auditing. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for StatefulSet volumeClaimTemplates. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
4. Storage & pod security details
The Storage & pod security details unit begins with ReadWriteOnce/ReadOnlyMany/ReadWriteMany/ReadWriteOncePod access modes: Persistent-volume access modes describe supported node/pod attachment patterns, not ordinary filesystem read/write permissions inside a mounted volume. Choose a mode from workload concurrency and driver guarantees, test rescheduling/failover, and keep database clustering semantics separate from storage attachment. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
Desired state and operational contract: Storage & pod security details
| Concept | Meaning | Engineering decision |
|---|---|---|
| ReadWriteOnce/ReadOnlyMany/ReadWriteMany/ReadWriteOncePod access modes | Persistent-volume access modes describe supported node/pod attachment patterns, not ordinary filesystem read/write permissions inside a mounted volume. | Choose a mode from workload concurrency and driver guarantees, test rescheduling/failover, and keep database clustering semantics separate from storage attachment. |
| PVC online expansion prerequisites | Online PVC expansion increases requested storage while a workload remains mounted only when the StorageClass, CSI driver, volume type, and filesystem all support the required stages. | Enable allowVolumeExpansion, test the exact driver/filesystem path, monitor free space and conditions, and retain backup/restore procedures. |
| fsGroup/runAsUser/runAsNonRoot/readOnlyRootFilesystem | These security-context fields constrain container identity and writable filesystem behavior: numeric user, refusal of root, group ownership for supported volumes, and an immutable root filesystem. | Set a known non-root UID/GID, provide explicit writable emptyDir or PVC mounts, and test startup under the exact policy. |
| capability drop and seccomp RuntimeDefault | Dropping Linux capabilities removes privileged kernel operations from a container, while seccompProfile: RuntimeDefault filters the allowed system-call surface. | Drop all capabilities, add back only a measured requirement, avoid privilege escalation, and run integration tests under the production seccomp profile. |
What the platform reconciles: Storage & pod security details
ReadWriteOnce/ReadOnlyMany/ReadWriteMany/ReadWriteOncePod access modes. The CSI driver and scheduler use requested modes during binding and attachment. RWO allows read-write mounting from one node, RWOP narrows to one pod where supported, while ROX/RWX require storage capable of those patterns.
PVC online expansion prerequisites. The control plane updates capacity, the driver expands the backing volume, and kubelet/filesystem expansion makes space usable. Status conditions expose pending resize work.
fsGroup/runAsUser/runAsNonRoot/readOnlyRootFilesystem. The runtime configures process credentials and mount flags before exec; kubelet or the CSI driver may recursively adjust volume ownership for fsGroup, which can be expensive on large volumes.
capability drop and seccomp RuntimeDefault. The container runtime applies capability sets and a seccomp BPF policy before starting the process. Requests outside those permissions fail even if application code is compromised.
Read these as one system: ReadWriteOnce/ReadOnlyMany/ReadWriteMany/ReadWriteOncePod access modes establishes the starting contract, PVC online expansion prerequisites changes how that contract is executed or represented, and capability drop and seccomp RuntimeDefault exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
Failure and security boundaries: Storage & pod security details
| Risk | Why it matters |
|---|---|
| ReadWriteOnce/ReadOnlyMany/ReadWriteMany/ReadWriteOncePod access modes | RWO can still permit several pods on the same node, and requesting RWX from unsupported block storage leaves claims pending. |
| PVC online expansion prerequisites | Increasing a PVC is usually one-way and does not repair a full or corrupted filesystem; unsupported expansion can stall indefinitely. |
| fsGroup/runAsUser/runAsNonRoot/readOnlyRootFilesystem | Declaring runAsNonRoot without a numeric non-root image user or enabling read-only root without writable temp paths causes deployment-time or runtime failure. |
| capability drop and seccomp RuntimeDefault | Granting broad capabilities such as SYS_ADMIN or disabling seccomp turns a small application exploit into a much larger host/kernel attack surface. |
Operations drill: Storage & pod security details
- Foundation: implement or demonstrate ReadWriteOnce/ReadOnlyMany/ReadWriteMany/ReadWriteOncePod access modes with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine ReadWriteOnce/ReadOnlyMany/ReadWriteMany/ReadWriteOncePod access modes with PVC online expansion prerequisites. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for capability drop and seccomp RuntimeDefault. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
Complete worked example
This example integrates the chapter rather than demonstrating an isolated method.
1apiVersion: autoscaling/v22kind: HorizontalPodAutoscaler3metadata: {name: documind-api}4spec:5 scaleTargetRef: {apiVersion: apps/v1, kind: Deployment, name: documind-api}6 minReplicas: 27 maxReplicas: 108 behavior:9 scaleDown:10 stabilizationWindowSeconds: 30011 metrics:12 - type: Resource13 resource:14 name: cpu15 target: {type: Utilization, averageUtilization: 70}16---17apiVersion: policy/v118kind: PodDisruptionBudget19metadata: {name: documind-api}20spec: {minAvailable: 1, selector: {matchLabels: {app: documind-api}}}Expected result
1CPU pressure scales within 2–10 replicas; voluntary disruption keeps at least one selected Pod available.Line-by-line reading
| Line | Code | Explanation |
|---|---|---|
| 1 | apiVersion: autoscaling/v2 | Declares one level of a desired-state or automation document. |
| 2 | kind: HorizontalPodAutoscaler | Declares one level of a desired-state or automation document. |
| 3 | metadata: {name: documind-api} | Declares one level of a desired-state or automation document. |
| 4 | spec: | Declares one level of a desired-state or automation document. |
| 5 | scaleTargetRef: {apiVersion: apps/v1, kind: Deployment, name: documind-api} | Implements the next yaml statement in the example's data flow. |
| 6 | minReplicas: 2 | Implements the next yaml statement in the example's data flow. |
| 7 | maxReplicas: 10 | Implements the next yaml statement in the example's data flow. |
| 8 | behavior: | Implements the next yaml statement in the example's data flow. |
| 9 | scaleDown: | Implements the next yaml statement in the example's data flow. |
| 10 | stabilizationWindowSeconds: 300 | Implements the next yaml statement in the example's data flow. |
| 11 | metrics: | Implements the next yaml statement in the example's data flow. |
| 12 | - type: Resource | Implements the next yaml statement in the example's data flow. |
| 13 | resource: | Implements the next yaml statement in the example's data flow. |
| 14 | name: cpu | Implements the next yaml statement in the example's data flow. |
| 15 | target: {type: Utilization, averageUtilization: 70} | Implements the next yaml statement in the example's data flow. |
| 16 | --- | Implements the next yaml statement in the example's data flow. |
| 17 | apiVersion: policy/v1 | Declares one level of a desired-state or automation document. |
| 18 | kind: PodDisruptionBudget | Declares one level of a desired-state or automation document. |
| 19 | metadata: {name: documind-api} | Declares one level of a desired-state or automation document. |
| 20 | spec: {minAvailable: 1, selector: {matchLabels: {app: documind-api}}} | Declares one level of a desired-state or automation document. |
Step-by-step execution
- A versioned manifest or workflow is parsed and validated, and authentication plus authorization determines which control-plane operations are allowed.
- The platform records desired state; controllers, runners, or cloud services reconcile it by creating artifacts, workloads, routes, identities, and telemetry pipelines.
- Readiness and health gates control traffic while resource requests, limits, quotas, pools, and autoscaling signals bound capacity.
- A failed rollout, hook, job, or health condition follows the documented retry, pause, rollback, or incident path without changing immutable artifact identity.
- Deployment verification checks the user path, version/digest, metrics, logs, traces, alerts, permissions, and recovery procedure rather than only command exit status.
Common mistakes and professional corrections
| Area | Common failure | Better engineering choice |
|---|---|---|
| Ingress, HPA & KEDA | Kafka lag here is a scaling signal, not the SQL LAG window function; autoscaling cannot repair an exhausted database. | Set realistic requests, stabilize scale decisions, test zero-to-one activation, and monitor the downstream bottleneck as replicas grow. |
| Helm charts | A Helm migration hook is not a Django migration explanation, and rolling manifests back cannot undo arbitrary data changes. | Keep defaults safe, validate values, render and lint in CI, make hooks idempotent, and use expand-migrate-contract for schemas. |
| RBAC & PersistentVolumes | Kubernetes RBAC is not JWT application authorization, and deleting a claim can delete data under some reclaim policies. | Grant namespaced least privilege, test permissions with auth can-i, select access modes from the storage backend, and rehearse restore and expansion. |
| Storage & pod security details | RWO can still permit several pods on the same node, and requesting RWX from unsupported block storage leaves claims pending. | Choose a mode from workload concurrency and driver guarantees, test rescheduling/failover, and keep database clustering semantics separate from storage attachment. |
Interview and review notes
- Define the central abstraction without naming a library function.
- Trace one request, call, query, message, render, or state transition from input to observable result.
- Compare two alternatives from this chapter by guarantee, cost, and failure behavior.
- Explain the most likely production bug and the test or metric that reveals it.
- State what remains authoritative after process loss, retry, reconnect, or deployment.
Practice set
Easy
- Define every bold term in the concept tables in one precise sentence.
- Reproduce the focused examples and annotate the value or state after each important line.
- Explain the chapter progression diagram aloud in two minutes.
Medium
- Replace one convenient default with an explicit policy for validation, timeout, ordering, pagination, cleanup, or error handling.
- Write a negative test for each topic group.
- Compare the measured behavior before and after one justified change.
Hard
- Combine all topic groups into one thin vertical slice.
- Inject a realistic failure at the most important external boundary and prove recovery.
- Write a one-page design note covering ownership, trade-offs, security, observability, and rollback.
Chapter submission
Submit:
- source code or reproducible commands;
- automated tests plus one deliberately failing-before-fix test;
- captured output, query plan, trace, screenshot, or metric;
- a 300–500 word explanation of the execution flow and one rejected alternative;
- a short README with setup, versions, limitations, and cleanup steps.
- Continue with the DocuMind K8s Production Setup project workshop.
Self-review rubric
| Dimension | Beginning | Competent | Professional |
|---|---|---|---|
| Explanation | Names APIs | Explains behavior | Connects guarantees, internals, and trade-offs |
| Implementation | Happy path only | Validated and tested | Clear ownership, failure recovery, and cleanup |
| Evidence | Manual claim | Repeatable output | Tests plus meaningful measurement or inspection |
| Communication | Steps missing | Reproducible README | Decisions, limits, and alternatives are explicit |
Roadmap coverage checklist
- To do: Ingress, HPA & KEDA: Nginx Ingress + Cert-Manager automatic TLS
- To do: Ingress, HPA & KEDA: HPA: CPU/memory targets
- To do: Ingress, HPA & KEDA: custom metrics HPA (requests per second)
- To do: Ingress, HPA & KEDA: KEDA: event-driven scaling (Kafka lag/queue depth)
- To do: Ingress, HPA & KEDA: PodDisruptionBudget for availability
- To do: Helm charts: Chart.yaml/values.yaml/templates/ structure
- To do: Helm charts: {{ .Values.image.tag }} template syntax
- To do: Helm charts: _helpers.tpl for reusable templates
- To do: Helm charts: helm install/upgrade/rollback/lint/template
- To do: Helm charts: pre-install migration job hooks
- To do: RBAC & PersistentVolumes: ServiceAccount/Role/ClusterRole/RoleBinding
- To do: RBAC & PersistentVolumes: kubectl auth can-i auditing
- To do: RBAC & PersistentVolumes: PV/PVC with dynamic StorageClass
- To do: RBAC & PersistentVolumes: StatefulSet volumeClaimTemplates
- To do: Storage & pod security details: ReadWriteOnce/ReadOnlyMany/ReadWriteMany/ReadWriteOncePod access modes
- To do: Storage & pod security details: PVC online expansion prerequisites
- To do: Storage & pod security details: fsGroup/runAsUser/runAsNonRoot/readOnlyRootFilesystem
- To do: Storage & pod security details: capability drop and seccomp RuntimeDefault
Quick revision
- Ingress, HPA & KEDA: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Helm charts: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- RBAC & PersistentVolumes: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Storage & pod security details: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Re-read the worked-example execution trace instead of memorizing isolated syntax.
- If you cannot name the owner of state and cleanup, the design is not yet complete.
Mastery check
How well can you recall this?
Finished this lesson?