Kubernetes Master Decision Tables

Architectural decision matrices for selecting the right Kubernetes primitive for your production constraints.


1. Workload Controller Selection

flowchart TD
    Start{"What kind of process are you running?"} --> Batch{"Runs to completion?"}
    Batch -- Yes --> Cron{"Scheduled recurring?"}
    Cron -- Yes --> CJ["CronJob"]
    Cron -- No --> J["Job"]
    Batch -- No --> NodeLevel{"Exactly one per node?"}
    NodeLevel -- Yes --> DS["DaemonSet<br/>(Log forwarder, CNI, node agent)"]
    NodeLevel -- No --> State{"Requires stable network ID & ordered storage?"}
    State -- Yes --> STS["StatefulSet<br/>(Kafka, Cassandra, PostgreSQL)"]
    State -- No --> DEP["Deployment<br/>(Stateless APIs, web services, worker consumers)"]
ControllerPrimary Use CaseState & IdentityRollout StrategyWhen to Choose
DeploymentStateless web APIs, event consumersEphemeral pods, random hostnames, dynamic IPsRollingUpdate (maxSurge / maxUnavailable), RecreateDefault choice for 90% of business applications.
StatefulSetDistributed databases, message queuesPredictable ordinal index (app-0), dedicated PVC per replicaRollingUpdate in reverse ordinal order, OnDeleteClustered databases (Zookeeper, Kafka, MongoDB, Postgres).
DaemonSetNode-level infrastructure agentsExactly 1 Pod per eligible node; ignores node capacity schedulersRollingUpdate (maxUnavailable), OnDeleteStorage daemons, log shippers (Fluent Bit), CNI plugins, monitoring daemons.
JobOne-off batch execution, DB migrationsPod runs to completion (exit 0), terminatesParallelism, completions, backoffLimitSchema migrations, report generation, batch ML inference.
CronJobScheduled recurring jobsCreates Jobs on a cron schedule (* * * * *)concurrencyPolicy: Allow | Forbid | ReplaceNightly backups, periodic reconciliation scripts, cleanups.

2. Configuration & Secret Management

MechanismSensitivityStorage LocationIn-Pod DeliveryUpdate MechanicsProduction Recommendation
ConfigMapNon-sensitive onlyPlaintext in etcdEnv vars or volume mountVolume mounts update via symlink swap; env vars require pod restartGeneral app settings, JSON/YAML configs.
Kubernetes SecretConfidential (tokens, certs)Base64 encoded in etcd (plaintext unless KMS configured)Env vars or tmpfs volume mountVolume mounts update automatically; env vars require restartAcceptable for basic secrets only if KMS v2 envelope encryption is enabled.
External Secrets Operator (ESO)Highly sensitive (API keys, DB passwords)External Vault, AWS Secrets Manager, Azure Key VaultSynchronizes external store into native k8s SecretsContinuous polling/webhook synchronizationBest practice for enterprise multi-cloud teams with centralized secret stores.
CSI Secret Store DriverExtreme sensitivity (Zero footprint)External Vault / AWS SMMounted directly into memory volume; no native Secret createdProjected file refreshed at CSI rotation intervalRegulated environments forbidding secrets stored in etcd even in encrypted form.

3. Traffic Exposition: Ingress vs Gateway API vs Services

flowchart TD
    Client["External Client Traffic"] --> Edge{"Where is traffic routed?"}
    Edge -- Outside Cluster --> Layer7{"Advanced L7 routing needed?<br/>(Header matching, cross-namespace, traffic splitting)"}
    Layer7 -- Yes --> GW["Gateway API<br/>(Gateway + HTTPRoute / GRPCRoute)"]
    Layer7 -- No --> ING["Ingress Controller<br/>(Traefik, Envoy, HAProxy)"]
    Edge -- Inside Cluster --> L4{"Internal Service Discovery?"}
    L4 --> CIP["ClusterIP Service<br/>(Virtual IP + CoreDNS discovery)"]
    L4 -- Direct Node Port --> NP["NodePort Service<br/>(Port 30000-32767)"]
MechanismLayerMulti-TenancyAdvanced RoutingStatus (2026)When to Choose
ClusterIPL4 (TCP/UDP)Namespace scopedRound-robin load balancing via EndpointSlicesGA (Core)Standard intra-cluster communication between internal services.
NodePortL4Node scopedStatic port range (30000–32767)GA (Core)Bare-metal clusters without load balancers; debugging access.
LoadBalancerL4Cloud provider scopedDirect cloud load balancer provisioningGA (Core)Direct TCP/UDP stream routing into cluster without L7 proxying.
Ingress APIL7 (HTTP/S)Single-object (tightly couples host and path routing)Host/Path routing, basic TLS terminationStable / MaintenanceLegacy deployments; simple static website hosting. (Note: ingress-nginx retired March 2026).
Gateway APIL7 / L4Role-oriented separation: Infra (GatewayClass), Ops (Gateway), Dev (HTTPRoute)Header matching, traffic splitting/canaries, cross-namespace routingGA (Standard Channel)Modern production standard for all complex ingress, API gateways, and multi-team routing.

4. Storage Access Modes & CSI Topology

Access ModeCLI AbbrDescriptionSupported BackendsMulti-Node Scheduling
ReadWriteOnceRWOVolume mounted as read-write by a single node. Multiple pods on that same node can mount it.AWS EBS, GCP PD, Azure Disk, local host pathPods are bound to the node where the disk was created.
ReadWriteManyRWXVolume mounted as read-write by many nodes simultaneously.NFS, AWS EFS, Azure Files, CephFS, GlusterFSPods can be scheduled across any nodes in the cluster.
ReadOnlyManyROXVolume mounted as read-only by many nodes simultaneously.Shared disk snapshots, NFS, object storage gatewaysRead-only static assets, reference ML models.
ReadWriteOncePodRWOPVolume mounted as read-write by exactly one single Pod.CSI drivers supporting single-pod accessStrict stateful databases that must prevent split-brain write corruption.

TIP

Always pair local-path or cloud block storage StorageClasses with volumeBindingMode: WaitForFirstConsumer so the persistent disk is provisioned in the specific Availability Zone where the pod is scheduled.


5. Autoscaling Selection Matrix

AutoscalerTarget MetricControlsScale SpeedCaveats & Interplay
Horizontal Pod Autoscaler (HPA)CPU, Memory, Custom metricsPod replica countMinutes (polls every 15s, stabilization window)Avoid pairing with VPA on CPU/Memory; requires metrics-server.
Vertical Pod Autoscaler (VPA)Historical CPU/Memory usageContainer resource requestsMinutes/Hours (evicts and restarts pods by default)In-place vertical scaling (v1.37 GA) reduces restarts; do not pair on same metrics as HPA.
KEDAEvent-driven queues (Kafka lag, SQS, Redis)Pod replica count (can scale to 0)Seconds to minutesReplaces HPA custom metrics adapters; scales consumers dynamically based on backlog.
Cluster AutoscalerUnschedulable Pending PodsNode groups / Auto Scaling Groups2–5 minutes (provisions VM instances)Cloud-specific node groups; slow node scale-up compared to modern provisioners.
KarpenterSpecific workload resource requestsDirect, heterogeneous EC2/compute node provisioning30–60 secondsGroup-less node provisioning; bins pods tightly and optimizes spot/on-demand compute costs.

6. Pod Placement & Scheduling Controls

ControlConstraint StrengthTarget EntityDirectionPrimary Use Case
nodeSelectorHard filterNode labelsAttractsSimple placement: disktype: ssd, gpu: "true".
nodeAffinityHard (required) or Soft (preferred)Node labelsAttractsMulti-zone placement, architecture preferences (arm64 vs amd64).
podAntiAffinityHard (required) or Soft (preferred)Other Pod labelsRepelsHigh availability: keep replicas of the same service on separate nodes/zones.
topologySpreadConstraintsHard (DoNotSchedule) or Soft (ScheduleAnyway)Topology domain (zone, rack, host)BalancesDistributes pods evenly across failure domains (maxSkew: 1).
taints & tolerationsHard (NoSchedule), Soft (PreferNoSchedule), Evict (NoExecute)Node conditionRepels by defaultDedicated GPU nodes, master node protection, node draining.

7. Cluster Governance & Policy Engines

Engine / MechanismLanguageEvaluation PhaseMutation SupportBest Used For
RBACNative API YAMLAuthorization (Pre-admission)NoControlling who can call which API verbs on which resources.
Pod Security Standards (PSS)Built-in namespace labelsAdmission (Validation)NoEnforcing baseline/restricted container hardening without installing third-party controllers.
ValidatingAdmissionPolicy (VAP)Common Expression Language (CEL)Admission (Validation)NoIn-tree, high-performance validation rules evaluated directly in kube-apiserver without webhook latency.
KyvernoNative Kubernetes YAMLAdmission (Validation, Mutation, Generation)YesComprehensive policy management: auto-injecting labels, mutating configs, verifying Cosign image signatures.
OPA / GatekeeperRegoAdmission (Validation, Audit)LimitedEnterprise multi-system governance spanning Kubernetes, CI/CD, and Terraform.
NetworkPolicyNative API YAMLData Plane (CNI)NoIsolating pod-to-pod network traffic; enforcing microsegmentation.

Next Steps