Kubernetes workload design
Prerequisite: node-deployment-health-and-shutdown. Objective: Review resource and probe manifest. Each example is independent. Tested with Node.js 22.16.0 on Linux. Save as main.mjs in a fresh disposable directory and run node main.mjs. These are static code blocks; external system behavior is not established by a local model.
How it works
Use matching Deployment selectors and Pod labels. Requests influence scheduling; limits constrain runtime consumption depending on resource and platform. Node heap size is only part of process memory; buffers, native allocations and threads also need room. Set startup, readiness and liveness probes based on observed behavior, and use a termination grace period longer than the application drain. A rolling deployment needs compatible old and new instances and database schema.
Check selector and request model
import assert from 'node:assert/strict';const selector={app:'catalog'},labels={app:'catalog',tier:'api'};assert.ok(Object.entries(selector).every(([k,v])=>labels[k]===v));console.log(3*250,'millicores requested');Expected output:
750 millicores requestedCPU requests add across replicas; scheduler feasibility is not tested.
Budget memory beyond V8 heap
import assert from 'node:assert/strict';const limitMiB=512,heapMiB=320,otherEstimateMiB=120;const headroom=limitMiB-heapMiB-otherEstimateMiB;assert.equal(headroom,72);console.log(headroom);Expected output:
72Hypothetical headroom is not measured peak RSS or a guarantee against OOM.
Common mistake
A valid manifest is not evidence that the image starts, probes succeed, networking works or resources are adequate.
Practice
Review the staged workload and calculate requested CPU for three replicas at 250 millicores each.
Reference candidate: node-kubernetes-workload-design-lookup (route unverified). Documentation anchors: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/, https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/, https://kubernetes.io/docs/concepts/workloads/controllers/deployment/. External versions and full integration are pending.
Administrative staged lab: staged-deployment-labs/kubernetes/deployment.yaml.template. Read its README for prerequisites, execution boundaries and cleanup. Not a verified public route.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Kubernetes workload design — knowledge check
Apply the lesson to a fresh scenario and explain the evidence boundary.
What do resource requests primarily affect?
Why leave memory above a heap target?
Which test is still needed after YAML validation?