Active Nerds
Kubernetes Learning Stream

Kubernetes Roadmap Articles & Question Stream

Browse questions, read quick answers, or expand full article breakdowns on demand. Filter by level, domain, or completion status using the sidebar dashboard.

Showing 69 of 69 questions
expertCluster Architecture, Installation & Configuration40 min+25 XP

Debugging in a Highly Distributed Kubernetes Environment: Architecture & Implementation

Question

Your microservices platform has 200+ services across 3 clusters. Users report intermittent 5-second latency spikes affecting checkout. The issue is non-reproducible locally, affects only ~2% of requests, and disappears before you can investigate. Walk through your systematic debugging approach.

advancedWorkloads & Scheduling8 min+20 XP

GitLab CI/CD Integration: Automated Container Builds and Manifest Deployments

Question

How do you configure a GitLab CI/CD pipeline to build container images, update Kubernetes manifests, and execute secure deployments to a Kubernetes cluster using ServiceAccounts?

beginnerCluster Architecture, Installation & Configuration2 min+10 XP

Kubernetes Architecture: Why Container Orchestration is Essential

Question

Why is container orchestration essential when running containerized applications at scale, and what core problems does Kubernetes solve compared to manual container management?

intermediateWorkloads & Scheduling8 min+15 XP

Production Deployment Design: Stateless Scalable Web Applications with HPA

Question

How do you architect a production-ready stateless web application deployment in Kubernetes combining Deployments, HPA, PodDisruptionBudgets, and anti-affinity rules for high availability?

expertCluster Architecture, Installation & Configuration45 min+25 XP

Advanced Networking: Network Policies and Service Mesh

Question

Your platform team must implement zero-trust networking for a financial services application. Requirements: all inter-service communication must be mutually authenticated and encrypted, no pod should communicate with any other pod unless explicitly allowed, east-west traffic must be auditable, and the solution must not require application code changes. Design and implement this.

advancedWorkloads & Scheduling5 min+20 XP

GitOps Workflow: Declarative Infrastructure Management with ArgoCD and Flux

Question

How does the GitOps pull-based architecture (using ArgoCD or Flux) differ from traditional push-based CI/CD pipelines, and how does it detect and reconcile cluster state drift automatically?

beginnerCluster Architecture, Installation & Configuration2 min+10 XP

Manual Operations vs. Kubernetes: Problems Automated Orchestration Solves

Question

What specific operational problems arise when managing containers manually across multiple hosts, and how does Kubernetes automate self-healing, scaling, and service discovery?

intermediateWorkloads & Scheduling4 min+15 XP

Sidecar, Ambassador, and Adapter Patterns: Advanced Multi-Container Pod Designs

Question

How do the Sidecar, Ambassador, and Adapter multi-container Pod patterns enhance application functionality, and when should you use each pattern in production?

intermediateWorkloads & Scheduling4 min+15 XP

Sidecar, Ambassador, and Adapter Patterns: Advanced Multi-Container Pod Designs

Question

What are the key architectural differences between Sidecar, Ambassador, and Adapter pod patterns, and how do they extend containerized workloads without modifying primary application code?

beginnerCluster Architecture, Installation & Configuration3 min+10 XP

Containers vs. Virtual Machines: Isolation Mechanisms at the Linux Kernel Level

Question

Explain the architecture, failure modes, and operational best practices for Containers vs. Virtual Machines: Isolation Mechanisms at the Linux Kernel Level in production Kubernetes environments.

expertCluster Architecture, Installation & Configuration52 min+25 XP

Custom Controllers and Operators Development: Architecture & Implementation

Question

Your platform team needs to automate database provisioning. Every time a developer creates a `Database` custom resource, the system should automatically provision a PostgreSQL StatefulSet, a Service, a Secret with credentials, and register the database in your internal service catalog — then clean everything up when the resource is deleted. Build this operator.

intermediateCluster Architecture, Installation & Configuration5 min+15 XP

Debugging Pending Pods: Systematic Troubleshooting for Scheduling Blocks

Question

Explain the architecture, failure modes, and operational best practices for Debugging Pending Pods: Systematic Troubleshooting for Scheduling Blocks in production Kubernetes environments.

advancedServices & Networking6 min+20 XP

NetworkPolicies: Micro-Segmentation and Pod Traffic Filtering with Calico or Cilium

Question

How do Kubernetes NetworkPolicies enforce micro-segmentation and pod traffic isolation, and how do CNI plugins like Calico or Cilium implement these rules at the kernel network layer?

intermediateCluster Architecture, Installation & Configuration5 min+15 XP

CrashLoopBackOff Troubleshooting: Root Cause Analysis for Application Container Crashes

Question

Explain the architecture, failure modes, and operational best practices for CrashLoopBackOff Troubleshooting: Root Cause Analysis for Application Container Crashes in production Kubernetes environments.

beginnerCluster Architecture, Installation & Configuration2 min+10 XP

Docker vs. Kubernetes: Runtime Engines vs. Cluster Orchestrators

Question

Explain the architecture, failure modes, and operational best practices for Docker vs. Kubernetes: Runtime Engines vs. Cluster Orchestrators in production Kubernetes environments.

expertCluster Architecture, Installation & Configuration45 min+25 XP

etcd Performance Optimization: Architecture & Implementation

Question

Your 500-node production cluster is experiencing API server latency spikes. Investigation shows etcd is the bottleneck: `etcd_disk_wal_fsync_duration_seconds` P99 is 150ms (should be <10ms), leader elections are happening frequently, and the etcd database size is approaching 8GB. Walk through your complete etcd performance diagnosis and remediation plan.

advancedCluster Architecture, Installation & Configuration7 min+20 XP

Kubernetes Disaster Recovery: Cluster Backup, etcd Snapshots, and Velero

Question

How do you design a comprehensive disaster recovery strategy for Kubernetes using etcd snapshots for control plane state and Velero for persistent volume backups?

beginnerCluster Architecture, Installation & Configuration5 min+10 XP

Control Plane vs. Worker Nodes: Key Architecture Components of a Kubernetes Cluster

Question

Explain the architecture, failure modes, and operational best practices for Control Plane vs. Worker Nodes: Key Architecture Components of a Kubernetes Cluster in production Kubernetes environments.

expertCluster Architecture, Installation & Configuration52 min+25 XP

Multi-Cluster Strategy for a Geographically Distributed Company: Architecture & Implementation

Question

Your company operates in US-East, EU-West, and APAC. Compliance requires EU data to stay in EU (GDPR), US financial data to stay in US (SOX), and APAC to serve as a DR site for both regions. SLA is 99.95% (< 4.4 hours/year downtime). Design a complete multi-cluster strategy.

intermediateTroubleshooting4 min+15 XP

OOMKilled Prevention: Container Memory Limits, Cgroups, and Linux OOM Killer

Question

What kernel mechanisms trigger an OOMKilled exit status for a container, and how do you configure container memory requests and cgroups limits to prevent out-of-memory container crashes?

advancedCluster Architecture, Installation & Configuration6 min+20 XP

Zero-Downtime Cluster Upgrades: Master Control Plane and Worker Maintenance

Question

What step-by-step workflow guarantees zero downtime when upgrading worker nodes and control plane components using `kubeadm`, `cordon`, and `drain`?

beginnerCluster Architecture, Installation & Configuration3 min+10 XP

etcd Architecture: Distributed Key-Value Store for Kubernetes Cluster State

Question

Explain the architecture, failure modes, and operational best practices for etcd Architecture: Distributed Key-Value Store for Kubernetes Cluster State in production Kubernetes environments.

expertCluster Architecture, Installation & Configuration20 min+25 XP

How Do You Build a Custom Admission Webhook from Scratch?: Architecture & Implementation

Question

How do you construct and deploy a custom Kubernetes Admission Webhook from scratch, and what TLS certificate requirements must be satisfied for the API server to communicate with it securely?

intermediateServices & Networking5 min+15 XP

Kubernetes Ingress Controllers: Layer 7 HTTP Routing and SSL/TLS Termination

Question

How does an Ingress Controller manage Layer 7 HTTP/HTTPS traffic routing and SSL/TLS termination, and how does it differ from a NodePort or LoadBalancer Service?

advancedCluster Architecture, Installation & Configuration25 min+20 XP

Kubernetes Upgrade Strategy: Architecture & Implementation

Question

Your company runs a production Kubernetes cluster on v1.26. The security team has mandated an upgrade to v1.29 due to a CVE. You have 40 nodes, stateful workloads, and a 99.9% uptime SLA. Walk through your complete upgrade strategy.

advancedCluster Architecture, Installation & Configuration30 min+20 XP

CI/CD Pipeline Security Scanning & Compliance: Architecture & Implementation

Question

Your organization must comply with SOC 2 and PCI-DSS. The security team requires that no container image with a Critical or High CVE reaches production, all Kubernetes manifests must comply with the CIS Kubernetes Benchmark, and secrets must never appear in source code or image layers. Design and implement a complete DevSecOps pipeline.

intermediateCluster Architecture, Installation & Configuration4 min+15 XP

CoreDNS Architecture: In-Cluster DNS Resolution and Service Record Lookup

Question

Explain the architecture, failure modes, and operational best practices for CoreDNS Architecture: In-Cluster DNS Resolution and Service Record Lookup in production Kubernetes environments.

beginnerWorkloads & Scheduling4 min+10 XP

Understanding Pods: Why Kubernetes Groups Containers as the Smallest Deployable Unit

Question

Why does Kubernetes use a Pod—rather than a single container—as its smallest deployable unit, and how do containers inside the same Pod share network and storage namespaces?

expertCluster Architecture, Installation & Configuration15 min+25 XP

What Is OPA/Gatekeeper and How Does It Extend Admission Control?: Architecture & Implementation

Question

What is OPA/Gatekeeper, how does it integrate with Kubernetes Validating Admission Webhooks, and how do ConstraintTemplates define declarative cluster governance policies?

beginnerCluster Architecture, Installation & Configuration3 min+10 XP

Control Plane vs. Worker Nodes: Responsibilities and Component Breakdown

Question

Explain the architecture, failure modes, and operational best practices for Control Plane vs. Worker Nodes: Responsibilities and Component Breakdown in production Kubernetes environments.

intermediateStorage5 min+15 XP

Storage Persistence: PersistentVolumes, PersistentVolumeClaims, and StorageClasses

Question

How do PersistentVolumes, PersistentVolumeClaims, and StorageClasses decouple storage consumption from underlying cloud storage infrastructure in Kubernetes?

expertCluster Architecture, Installation & Configuration15 min+25 XP

Scenario: Enforce Image Registry Policy Cluster-Wide

Question

How do you implement an admission policy using OPA/Gatekeeper or Kyverno to enforce that all containers deployed to a cluster originate exclusively from approved internal image registries?

advancedWorkloads & Scheduling22 min+20 XP

Zero-Downtime Deployments: Architecture & Implementation

Question

You manage a critical payment processing API. It handles 10,000 requests/minute with no tolerance for dropped connections. How do you implement zero-downtime deployments?

advancedCluster Architecture, Installation & Configuration27 min+20 XP

Blue/Green and Canary Deployments with Argo Rollouts: Architecture & Implementation

Question

Your e-commerce platform releases features weekly. A bad release last quarter caused 30 minutes of downtime and lost $200K in revenue. Leadership now requires that all releases be validated against 5% of live traffic before full rollout, with automatic rollback if error rates exceed 1%. How do you implement this?

beginnerCluster Architecture, Installation & Configuration4 min+10 XP

Inside kubectl apply: Execution Flow from API Server to Container Runtime

Question

What happens under the hood during a `kubectl apply` request from client-side YAML parsing, OpenAPI validation, authentication/authorization, admission webhooks, to etcd persistence?

intermediateTroubleshooting4 min+15 XP

Resource Requests vs. Limits: CPU/Memory Scheduling and Throttling Policies

Question

What is the operational difference between CPU/memory resource requests and limits, and how does Kubernetes use requests for scheduling while using limits to enforce throttling and OOM eviction?

expertCluster Architecture, Installation & Configuration15 min+25 XP

What Are the Key Levers for etcd Performance Tuning?: Architecture & Implementation

Question

What are the primary performance tuning levers for etcd (such as heartbeat intervals, election timeouts, disk I/O priorities, and DB quota limits) to ensure cluster stability under heavy write loads?

advancedTroubleshooting22 min+20 XP

Cluster Resource Exhaustion: Monitoring and Scaling Strategy

Question

Your cluster is running out of resources. Pods are stuck in `Pending` state, nodes are at 90% CPU, and the on-call engineer is getting paged at 2 AM. What monitoring and scaling strategies do you implement to prevent this and respond automatically?

expertCluster Architecture, Installation & Configuration12 min+25 XP

How Do You Benchmark and Monitor etcd Health in Production?: Architecture & Implementation

Question

How Do You Benchmark and Monitor etcd Health in Production?: Architecture & Implementation?

beginnerWorkloads & Scheduling3 min+10 XP

Kubernetes Namespaces: Logical Cluster Isolation and Resource Scoping

Question

How do Kubernetes Namespaces provide logical cluster isolation and resource scoping, and what are the limitations of namespaces regarding security and network boundary isolation?

intermediateTroubleshooting4 min+15 XP

Kubernetes QoS Classes: Guaranteed, Burstable, and BestEffort Pod Eviction Priorities

Question

How does Kubernetes assign Guaranteed, Burstable, and BestEffort Quality of Service (QoS) classes to Pods, and how does the kernel OOM killer use `oom_score_adj` to evict Pods during resource scarcity?

beginnerCluster Architecture, Installation & Configuration5 min+10 XP

Essential kubectl Commands: Operations and Debugging Cheat Sheet

Question

Explain the architecture, failure modes, and operational best practices for Essential kubectl Commands: Operations and Debugging Cheat Sheet in production Kubernetes environments.

advancedTroubleshooting22 min+20 XP

Exposed Secrets in ConfigMap: Incident Response

Question

A developer accidentally committed a database password and an AWS access key directly into a ConfigMap, which was then applied to the production cluster and pushed to a public GitHub repository. You're the on-call engineer. Walk through your complete incident response plan.

intermediateWorkloads & Scheduling5 min+15 XP

Liveness, Readiness, and Startup Probes: Health Check Configurations

Question

How do Liveness, Readiness, and Startup probes differ in purpose and behavior, and how do incorrect probe configurations cause cascading deployment failures or unnecessary restarts?

advancedCluster Architecture, Installation & Configuration35 min+20 XP

Advanced RBAC Design for Multi-Team Organization: Architecture & Implementation

Question

Your company has three engineering teams: Frontend (deploys React apps), Backend (deploys APIs and workers), and Database (manages PostgreSQL and Redis). Each team has developers, leads, and CI/CD service accounts. Design a complete RBAC system where teams can only access their own namespaces, leads can approve deployments, CI/CD can deploy but not delete, and platform engineers have cluster-wide admin access with audit trails.

beginnerCluster Architecture, Installation & Configuration3 min+10 XP

Imperative vs. Declarative Management: Infrastructure as Code with Kubernetes Manifests

Question

What are the fundamental differences between imperative `kubectl` commands and declarative `kubectl apply` manifest management, and why is declarative management required for Production Infrastructure as Code?

intermediateStorage5 min+15 XP

StatefulSets vs. Deployments: Managing Stateful Applications with Stable Identities

Question

Why are standard Deployments unsuitable for stateful applications like database clusters, and how do StatefulSets provide stable network identities, ordinal indices, and persistent storage bindings?

intermediateCluster Architecture, Installation & Configuration3 min+15 XP

DaemonSets: Running Node-Level Daemon Agents for Logging and Monitoring

Question

Explain the architecture, failure modes, and operational best practices for DaemonSets: Running Node-Level Daemon Agents for Logging and Monitoring in production Kubernetes environments.

beginnerCluster Architecture, Installation & Configuration2 min+10 XP

Dry-Run Validation: Client-Side vs. Server-Side Mutation Testing

Question

Explain the architecture, failure modes, and operational best practices for Dry-Run Validation: Client-Side vs. Server-Side Mutation Testing in production Kubernetes environments.

advancedStorage30 min+20 XP

StatefulSet Design for Database Pods: Architecture & Implementation

DevOps & AI Systems Engineer
Updated April 2026

Prerequisite knowledge: PersistentVolumes, StorageClasses, StatefulSets basics, headless services


Question:

You need to ensure a PostgreSQL database Pod maintains state across cluster updates, node failures, and rolling restarts. Design a production-grade StatefulSet with proper storage, backup, high availability, and operational runbook.

Quick Answer:

Use a StatefulSet with volumeClaimTemplates for stable per-pod PVCs, a headless Service for stable DNS names, podAntiAffinity to spread replicas across nodes, PodDisruptionBudget to prevent simultaneous eviction, init containers for replica initialization, and Velero or pg_basebackup for backups.


Detailed Answer

️ Architecture: Why StatefulSet, Not Deployment

Deployment (WRONG for databases):           StatefulSet (RIGHT for databases):

Pod names: random                           Pod names: stable
  myapp-7d9f8b-xk2pq                         postgres-0
  myapp-7d9f8b-ab3cd    (change on restart)   postgres-1  (stable across restarts)
  myapp-7d9f8b-ef5gh                          postgres-2

Storage: shared or ephemeral               Storage: dedicated per pod
  All pods share same PVC                    postgres-0 → data-postgres-0 PVC
  OR no persistent storage                   postgres-1 → data-postgres-1 PVC
                                             postgres-2 → data-postgres-2 PVC

DNS: load-balanced Service                 DNS: stable per-pod hostname
  postgres.ns.svc.cluster.local              postgres-0.postgres.ns.svc.cluster.local
  (any pod)                                  postgres-1.postgres.ns.svc.cluster.local
                                             (always resolves to same pod)

Startup/shutdown: parallel                 Startup/shutdown: ordered
  All pods start simultaneously              postgres-0 starts first
                                             postgres-1 waits for postgres-0 Ready
                                             postgres-2 waits for postgres-1 Ready

️ Complete Implementation

Step 1: StorageClass for Database-Grade Storage

# storageclass-fast-ssd.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: fast-ssd
  annotations:
    storageclass.kubernetes.io/is-default-class: "false"
provisioner: ebs.csi.aws.com          # AWS EBS CSI driver
parameters:
  type: io2                            # Provisioned IOPS SSD (not gp3 for databases)
  iops: "10000"                        # 10,000 IOPS per volume
  throughput: "500"                    # 500 MB/s throughput
  encrypted: "true"                    # Encrypt at rest
  kmsKeyId: "arn:aws:kms:us-east-1:123456789:key/mrk-xxx"
reclaimPolicy: Retain                  # CRITICAL: Never auto-delete database volumes
allowVolumeExpansion: true             # Allow online expansion
volumeBindingMode: WaitForFirstConsumer # Create PV in same AZ as the Pod
mountOptions:
  - discard                            # Enable TRIM for SSDs

Step 2: Headless Service (Stable DNS)

# headless-service.yaml
apiVersion: v1
kind: Service
metadata:
  name: postgres
  namespace: database-production
  labels:
    app: postgres
spec:
  clusterIP: None      # This makes it headless — DNS returns pod IPs directly
  selector:
    app: postgres
  ports:
    - port: 5432
      targetPort: 5432
      name: postgresql
---
# Regular Service for primary (write) connections
apiVersion: v1
kind: Service
metadata:
  name: postgres-primary
  namespace: database-production
spec:
  selector:
    app: postgres
    role: primary           # Only routes to the primary replica
  ports:
    - port: 5432
      targetPort: 5432
---
# Regular Service for replica (read) connections
apiVersion: v1
kind: Service
metadata:
  name: postgres-replica
  namespace: database-production
spec:
  selector:
    app: postgres
    role: replica           # Routes to read replicas
  ports:
    - port: 5432
      targetPort: 5432

Step 3: Production StatefulSet

# postgres-statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres
  namespace: database-production
spec:
  serviceName: postgres       # Must match headless service name
  replicas: 3
  selector:
    matchLabels:
      app: postgres

  # CRITICAL: Control update behavior
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      partition: 0            # Update all pods (set to 2 to update only postgres-2 first)
                              # Useful for canary: partition: 2 updates only postgres-2

  # Prevent all replicas from being deleted simultaneously
  podManagementPolicy: OrderedReady   # Default: wait for each pod to be ready
                                      # Alternative: Parallel (faster but not safe for DBs)

  template:
    metadata:
      labels:
        app: postgres
    spec:
      # Spread replicas across different nodes and AZs
      affinity:
        podAntiAffinity:
          # Hard rule: NEVER put two postgres pods on same node
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchLabels:
                  app: postgres
              topologyKey: kubernetes.io/hostname
          # Soft rule: prefer different AZs
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                labelSelector:
                  matchLabels:
                    app: postgres
                topologyKey: topology.kubernetes.io/zone

      # Ensure postgres process doesn't run as root
      securityContext:
        runAsUser: 999
        runAsGroup: 999
        fsGroup: 999
        fsGroupChangePolicy: OnRootMismatch   # Faster volume permission setup

      # Init container: configure replication for non-primary pods
      initContainers:
        - name: init-replication
          image: postgres:15-alpine
          command:
            - /bin/sh
            - -c
            - |
              set -e
              # Determine pod ordinal from hostname
              ORDINAL=${HOSTNAME##*-}

              if [ "$ORDINAL" = "0" ]; then
                echo "Pod 0 is primary — no replication init needed"
                exit 0
              fi

              # For replicas (pod 1, 2): clone from primary
              PRIMARY="postgres-0.postgres.database-production.svc.cluster.local"
              PGDATA="/var/lib/postgresql/data/pgdata"

              # Wait for primary to be ready
              until pg_isready -h $PRIMARY -U postgres; do
                echo "Waiting for primary..."
                sleep 2
              done

              # If data directory is empty, clone from primary
              if [ ! -f "$PGDATA/PG_VERSION" ]; then
                echo "Cloning from primary $PRIMARY..."
                pg_basebackup \
                  -h $PRIMARY \
                  -U replicator \
                  -D $PGDATA \
                  -P \
                  -Xs \
                  -R    # -R creates standby.signal and postgresql.auto.conf
                echo "Clone complete"
              else
                echo "Data directory exists, skipping clone"
              fi
          env:
            - name: PGPASSWORD
              valueFrom:
                secretKeyRef:
                  name: postgres-credentials
                  key: replication-password
          volumeMounts:
            - name: data
              mountPath: /var/lib/postgresql/data

      containers:
        - name: postgresql
          image: postgres:15-alpine
          ports:
            - containerPort: 5432
              name: postgresql

          env:
            - name: POSTGRES_USER
              value: postgres
            - name: POSTGRES_DB
              value: production
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: postgres-credentials
                  key: postgres-password
            - name: PGDATA
              value: /var/lib/postgresql/data/pgdata
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            # PostgreSQL replication configuration
            - name: POSTGRES_INITDB_ARGS
              value: "--data-checksums"      # Enable data checksums for corruption detection

          # Custom postgresql.conf via ConfigMap
          args:
            - -c
            - config_file=/etc/postgresql/postgresql.conf

          resources:
            requests:
              cpu: "2"
              memory: "4Gi"
            limits:
              cpu: "4"
              memory: "8Gi"

          readinessProbe:
            exec:
              command:
                - /bin/sh
                - -c
                - pg_isready -U postgres -d production
            initialDelaySeconds: 10
            periodSeconds: 5
            failureThreshold: 6

          livenessProbe:
            exec:
              command:
                - /bin/sh
                - -c
                - pg_isready -U postgres
            initialDelaySeconds: 30
            periodSeconds: 10
            failureThreshold: 3

          lifecycle:
            preStop:
              exec:
                command:
                  - /bin/sh
                  - -c
                  - |
                    # Gracefully stop PostgreSQL before SIGTERM
                    # This ensures WAL is flushed and connections are closed cleanly
                    pg_ctl stop -D $PGDATA -m fast
                    sleep 5

          volumeMounts:
            - name: data
              mountPath: /var/lib/postgresql/data
            - name: postgres-config
              mountPath: /etc/postgresql
              readOnly: true
            - name: postgres-init-scripts
              mountPath: /docker-entrypoint-initdb.d
              readOnly: true

        # Sidecar: Metrics exporter for Prometheus
        - name: postgres-exporter
          image: prometheuscommunity/postgres-exporter:latest
          ports:
            - containerPort: 9187
              name: metrics
          env:
            - name: DATA_SOURCE_NAME
              valueFrom:
                secretKeyRef:
                  name: postgres-credentials
                  key: exporter-dsn
          resources:
            requests:
              cpu: "50m"
              memory: "64Mi"
            limits:
              cpu: "200m"
              memory: "128Mi"

      terminationGracePeriodSeconds: 60

      volumes:
        - name: postgres-config
          configMap:
            name: postgres-config
        - name: postgres-init-scripts
          configMap:
            name: postgres-init-scripts

  # volumeClaimTemplates: Each pod gets its own dedicated PVC
  # These are NEVER deleted when the StatefulSet is deleted (Retain policy)
  volumeClaimTemplates:
    - metadata:
        name: data
        labels:
          app: postgres
        annotations:
          mycompany.com/backup: "true"
      spec:
        accessModes: ["ReadWriteOnce"]   # Single node read-write
        storageClassName: fast-ssd
        resources:
          requests:
            storage: 500Gi

Step 4: PostgreSQL Configuration (Tuned for Production)

# postgres-config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: postgres-config
  namespace: database-production
data:
  postgresql.conf: |
    # Connection settings
    max_connections = 200
    superuser_reserved_connections = 3

    # Memory settings (tune to 25% of pod memory for shared_buffers)
    shared_buffers = 1GB               # 25% of 4Gi memory request
    effective_cache_size = 3GB         # 75% of total RAM
    work_mem = 20MB                    # Per-sort/hash operation
    maintenance_work_mem = 256MB       # For VACUUM, CREATE INDEX

    # WAL settings (critical for replication and crash recovery)
    wal_level = replica                # Enable streaming replication
    max_wal_senders = 5                # Max simultaneous replication connections
    wal_keep_size = 1GB               # Keep 1GB of WAL for replicas
    synchronous_commit = on            # Ensure durability (at cost of latency)
    checkpoint_completion_target = 0.9 # Spread checkpoint I/O over 90% of interval
    max_wal_size = 2GB
    min_wal_size = 256MB

    # Replication
    hot_standby = on                   # Allow reads on standby
    hot_standby_feedback = on          # Prevent query conflicts on standby

    # Logging (for audit and debugging)
    log_destination = 'stderr'
    logging_collector = off            # Let container capture stderr
    log_min_duration_statement = 1000  # Log queries taking >1 second
    log_connections = on
    log_disconnections = on
    log_lock_waits = on
    log_temp_files = 0                 # Log all temp file creation
    log_autovacuum_min_duration = 0    # Log all autovacuum runs

    # Performance
    random_page_cost = 1.1            # SSD: sequential and random costs are similar
    effective_io_concurrency = 200     # SSD: high concurrency is fine
    default_statistics_target = 100

    # Autovacuum tuning (critical for long-running production databases)
    autovacuum_vacuum_scale_factor = 0.05  # Vacuum when 5% of table changes
    autovacuum_analyze_scale_factor = 0.02  # Analyze when 2% changes
    autovacuum_vacuum_cost_delay = 2ms      # Reduce I/O throttling on SSDs

  pg_hba.conf: |
    # TYPE  DATABASE        USER            ADDRESS                 METHOD
    local   all             all                                     trust
    host    all             all             127.0.0.1/32            md5
    host    all             all             ::1/128                 md5
    # Allow replication connections from pod subnet
    host    replication     replicator      10.0.0.0/8              md5
    # Allow application connections from production namespace
    host    all             appuser         10.0.0.0/8              scram-sha-256

Step 5: PodDisruptionBudget

# postgres-pdb.yaml
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: postgres-pdb
  namespace: database-production
spec:
  # Always keep at least 2 out of 3 pods running
  # This means only 1 pod can be disrupted at a time
  minAvailable: 2
  selector:
    matchLabels:
      app: postgres

  # This PDB means:
  # - Node drain: Will only proceed if 2+ postgres pods remain Ready
  # - Cluster upgrade: Worker nodes are drained one at a time (PDB enforced)
  # - kubectl delete pod: Blocked if it would violate PDB

Step 6: Backup Strategy with pg_basebackup + CronJob

# postgres-backup-cronjob.yaml
apiVersion: batch/v1
kind: CronJob
metadata:
  name: postgres-backup
  namespace: database-production
spec:
  schedule: "0 2 * * *"          # Daily at 2 AM UTC
  concurrencyPolicy: Forbid       # Don't run if previous backup still running
  failedJobsHistoryLimit: 3
  successfulJobsHistoryLimit: 7
  jobTemplate:
    spec:
      template:
        spec:
          serviceAccountName: postgres-backup-sa
          restartPolicy: OnFailure
          containers:
            - name: backup
              image: postgres:15-alpine
              command:
                - /bin/sh
                - -c
                - |
                  set -euo pipefail

                  DATE=$(date +%Y%m%d-%H%M%S)
                  BACKUP_FILE="/backup/postgres-backup-$DATE.sql.gz"
                  PRIMARY="postgres-0.postgres.database-production.svc.cluster.local"

                  echo "Starting backup at $DATE"

                  # Full logical backup with pg_dump
                  pg_dump \
                    -h $PRIMARY \
                    -U postgres \
                    -d production \
                    --format=custom \
                    --compress=9 \
                    --no-password \
                    | gzip > $BACKUP_FILE

                  # Verify backup integrity
                  pg_restore --list $BACKUP_FILE > /dev/null
                  echo "Backup integrity verified"

                  # Upload to S3
                  aws s3 cp $BACKUP_FILE \
                    s3://mycompany-db-backups/postgres/$(date +%Y/%m/%d)/postgres-backup-$DATE.sql.gz \
                    --sse aws:kms \
                    --sse-kms-key-id $KMS_KEY_ID

                  echo "Backup uploaded to S3"

                  # Cleanup local file
                  rm -f $BACKUP_FILE

                  # Remove S3 backups older than 30 days
                  aws s3 ls s3://mycompany-db-backups/postgres/ --recursive | \
                    awk '{print $4}' | \
                    while read file; do
                      file_date=$(echo "$file" | grep -oP '\d{8}' | head -1)
                      cutoff=$(date -d "-30 days" +%Y%m%d)
                      if [[ "$file_date" < "$cutoff" ]]; then
                        aws s3 rm "s3://mycompany-db-backups/$file"
                        echo "Removed old backup: $file"
                      fi
                    done

                  echo "Backup complete"

              env:
                - name: PGPASSWORD
                  valueFrom:
                    secretKeyRef:
                      name: postgres-credentials
                      key: postgres-password
                - name: AWS_REGION
                  value: us-east-1
                - name: KMS_KEY_ID
                  valueFrom:
                    secretKeyRef:
                      name: postgres-credentials
                      key: backup-kms-key-id

              resources:
                requests:
                  cpu: "500m"
                  memory: "512Mi"
                limits:
                  cpu: "1"
                  memory: "1Gi"

Step 7: Operational Runbook — Common StatefulSet Operations

#!/bin/bash
# postgres-runbook.sh — Common operational procedures

# =============================================================
# PROCEDURE 1: Rolling restart (e.g., after config change)
# =============================================================
rolling_restart() {
  echo "Starting rolling restart of postgres StatefulSet..."

  # StatefulSet rolling restart (goes in reverse order: 2, 1, 0)
  kubectl rollout restart statefulset/postgres -n database-production

  # Watch the rollout
  kubectl rollout status statefulset/postgres -n database-production --timeout=10m

  echo "Rolling restart complete"
}

# =============================================================
# PROCEDURE 2: Manual failover (promote replica to primary)
# =============================================================
manual_failover() {
  TARGET_REPLICA=${1:-"postgres-1"}
  echo "Promoting $TARGET_REPLICA to primary..."

  # Connect to the target replica and promote it
  kubectl exec -n database-production $TARGET_REPLICA -- \
    pg_ctl promote -D /var/lib/postgresql/data/pgdata

  # Update the primary Service selector to point to new primary
  # (In a real setup, use Patroni or pg_auto_failover for automatic failover)
  ORDINAL="${TARGET_REPLICA##*-}"
  kubectl patch service postgres-primary -n database-production \
    -p "{\"spec\":{\"selector\":{\"app\":\"postgres\",\"statefulset.kubernetes.io/pod-name\":\"$TARGET_REPLICA\"}}}"

  echo "Failover complete. New primary: $TARGET_REPLICA"
}

# =============================================================
# PROCEDURE 3: Expand PVC storage (online, no downtime)
# =============================================================
expand_storage() {
  NEW_SIZE=${1:-"1Ti"}
  echo "Expanding all postgres PVCs to $NEW_SIZE..."

  # Patch each PVC (StatefulSet doesn't manage PVC updates directly)
  for i in 0 1 2; do
    kubectl patch pvc data-postgres-$i \
      -n database-production \
      -p "{\"spec\":{\"resources\":{\"requests\":{\"storage\":\"$NEW_SIZE\"}}}}"
    echo "Patched data-postgres-$i"
  done

  # Trigger pod restart so PostgreSQL picks up new filesystem size
  # (Usually not needed — filesystem auto-expands on EBS)
  echo "PVC expansion triggered. Check PVC status:"
  kubectl get pvc -n database-production -l app=postgres
}

# =============================================================
# PROCEDURE 4: Restore from backup to a new database
# =============================================================
restore_from_backup() {
  BACKUP_FILE=$1
  TARGET_DB=${2:-"production_restore"}

  echo "Restoring from $BACKUP_FILE to database $TARGET_DB..."

  # Copy backup from S3 to a restore pod
  kubectl run restore-pod \
    --image=postgres:15-alpine \
    --restart=Never \
    --rm -it \
    --env="PGPASSWORD=$PGPASSWORD" \
    --command -- \
    /bin/sh -c "
      # Download from S3
      aws s3 cp s3://mycompany-db-backups/postgres/$BACKUP_FILE /tmp/backup.sql.gz

      # Create target database
      createdb -h postgres-0.postgres.database-production.svc.cluster.local \
        -U postgres $TARGET_DB

      # Restore
      gunzip -c /tmp/backup.sql.gz | \
        pg_restore \
          -h postgres-0.postgres.database-production.svc.cluster.local \
          -U postgres \
          -d $TARGET_DB \
          --no-owner \
          --role=postgres

      echo 'Restore complete'
    "
}

# =============================================================
# PROCEDURE 5: Check replication lag
# =============================================================
check_replication_lag() {
  echo "Checking replication status on primary..."

  kubectl exec -n database-production postgres-0 -- \
    psql -U postgres -c "
      SELECT
        client_addr,
        application_name,
        state,
        sent_lsn,
        write_lsn,
        flush_lsn,
        replay_lsn,
        (sent_lsn - replay_lsn) AS replication_lag_bytes,
        write_lag,
        flush_lag,
        replay_lag
      FROM pg_stat_replication
      ORDER BY replay_lag DESC;
    "
}

# Main menu
case "${1:-help}" in
  restart)    rolling_restart ;;
  failover)   manual_failover "$2" ;;
  expand)     expand_storage "$2" ;;
  restore)    restore_from_backup "$2" "$3" ;;
  lag)        check_replication_lag ;;
  *)
    echo "Usage: $0 {restart|failover|expand|restore|lag}"
    echo "  restart              - Rolling restart of all pods"
    echo "  failover <pod-name>  - Promote replica to primary"
    echo "  expand <size>        - Expand PVCs (e.g., expand 1Ti)"
    echo "  restore <file> <db>  - Restore from S3 backup"
    echo "  lag                  - Check replication lag"
    ;;
esac

️ Trade-offs: StatefulSet vs Managed Database

ApproachControlOperational BurdenCostHA ComplexityBest For
StatefulSet + manualFullVery HighLowHighLearning, cost-sensitive
StatefulSet + PatroniFullHighLow-MediumMediumOn-premise, full control
Database Operator (CNPG)HighMediumMediumLowCloud-native PostgreSQL
Managed DB (RDS/CloudSQL)LowVery LowHighNoneMost production use cases

Honest recommendation: For most teams, a managed database service (RDS, CloudSQL, Azure Database) is the right choice for production. Running stateful databases on Kubernetes adds significant operational complexity. Use Kubernetes-based databases only when you have specific requirements around portability, cost, or control — and use a mature operator like CloudNativePG (CNPG) rather than managing the StatefulSet yourself.


️ Common Mistakes & Misconceptions

  • "Deleting a StatefulSet deletes its PVCs." — By default, PVCs created via volumeClaimTemplates are not deleted when the StatefulSet is deleted. This is intentional (data safety), but means you must manually clean up PVCs after decommissioning.
  • "I can use ReadWriteMany for database storage." — Most databases including PostgreSQL use exclusive file locking that requires ReadWriteOnce. ReadWriteMany (NFS/EFS) introduces I/O overhead and locking complexity that can corrupt database files.
  • "Rolling updates work the same as Deployments." — StatefulSet rolling updates go in reverse ordinal order (highest to lowest: 2 → 1 → 0) and wait for each pod to be Ready before proceeding. The partition field lets you do canary updates.
  • "A headless Service load-balances traffic." — A headless Service (clusterIP: None) does not load-balance. It returns all pod IPs via DNS. Your application must implement its own connection logic to choose primary vs replica.

Key Takeaway

StatefulSets give you the primitives for running stateful workloads — stable network identity, stable storage, and ordered operations — but they are not a database management system. Production database operations (failover, backup verification, replication monitoring, connection pooling) require either a mature operator or a managed service. The volumeClaimTemplates with reclaimPolicy: Retain is the most critical configuration — it ensures your data survives pod and StatefulSet deletion.


Self-Assessment Checklist

  • Can you explain why StatefulSet pod names are stable but Deployment pod names are not?
  • Can you describe what a headless Service does differently from a regular ClusterIP Service?
  • Can you explain the partition field in StatefulSet updateStrategy and when you'd use it?
  • Can you describe why reclaimPolicy: Retain is critical for database PVCs?
  • Can you explain the difference between podManagementPolicy: OrderedReady and Parallel?
  • Can you write the DNS name pattern for a specific StatefulSet pod?

📊 Complete Study Guide Index

Use this index to jump directly to topics you want to study or review.


🗂️ Topic Index

TopicQuestionsDifficulty
Cluster UpgradesQ45Advanced
CI/CD Security & ComplianceQ46Advanced
Zero-Downtime DeploymentsQ47Advanced
Blue/Green & Canary (Argo Rollouts)Q48Advanced
Autoscaling (HPA/VPA/KEDA/CA)Q49Advanced
Secret Exposure Incident ResponseQ50Advanced
Distributed DebuggingQ251Expert
Zero-Trust NetworkingQ252Expert
Custom Operators & ControllersQ253Expert
etcd Performance OptimizationQ260Expert
Multi-Cluster StrategyS1Expert
RBAC Design for Multi-Team OrgsS2Advanced
StatefulSet Database DesignS3Advanced

🎯 Learning Path Recommendations

Path A: Security-Focused Engineer

Q46 (CI/CD Security) → Q50 (Secret Incident Response) →
Q252 (Zero-Trust Networking) → S2 (RBAC Design) →
Q46 revisit (OPA Gatekeeper deep dive)

Path B: Platform/SRE Engineer

Q45 (Cluster Upgrades) → Q49 (Autoscaling) →
Q260 (etcd Optimization) → S1 (Multi-Cluster) →
Q251 (Distributed Debugging)

Path C: Application-Focused DevOps

Q47 (Zero-Downtime Deployments) → Q48 (Argo Rollouts) →
S3 (StatefulSet Design) → Q253 (Custom Operators) →
Q251 (Distributed Debugging)
Q45 → Q46 → Q47 → Q48 → Q49 → Q50 →
S2 → S3 → Q251 → Q252 → Q253 → Q260 → S1

✅ Mastery Tracking Sheet

Copy this into your notes and check off as you go:

ADVANCED LEVEL — Production Readiness
☐ Q45  Kubernetes upgrade strategy (safe, multi-version)
☐ Q46  CI/CD security scanning and compliance pipeline
☐ Q47  Zero-downtime deployments (probes, preStop, PDB)
☐ Q48  Blue/Green and Canary with Argo Rollouts
☐ Q49  Cluster resource exhaustion: monitoring and scaling
☐ Q50  Secret exposure incident response

EXPERT LEVEL — Edge Cases & Optimization
☐ Q251 Debugging in highly distributed environments
☐ Q252 Zero-trust networking with NetworkPolicy + Istio
☐ Q253 Custom controllers and operators (Go/controller-runtime)
☐ Q260 etcd performance optimization and tuning

SCENARIO-BASED
☐ S1   Multi-cluster strategy for geo-distributed company
☐ S2   RBAC design for multi-team organization
☐ S3   StatefulSet design for production databases

🧠 Quick Revision Cheat Sheet

The most critical facts to remember across all questions:

Upgrades

  • Never skip minor versions — always N-1 hop sequential upgrades
  • Backup etcd before every upgrade hop
  • Control plane first, workers second — always
  • kubeadm upgrade apply on first control plane, kubeadm upgrade node on subsequent ones

Zero-Downtime Deployments

  • maxUnavailable: 0 + readiness probes together = zero-downtime guarantee
  • preStop sleep (5s) bridges kube-proxy iptables propagation lag
  • terminationGracePeriodSeconds must be > preStop duration + app shutdown time
  • Liveness ≠ Readiness — never use deep health checks for liveness

Autoscaling

  • HPA requires resource requests to calculate utilization percentage
  • VPA + HPA on CPU = conflict — use custom metrics with HPA if VPA is active
  • Cluster Autoscaler adds nodes in 2–5 min — design for this lag
  • KEDA for event/queue-driven scaling — more expressive than HPA

Security

  • Kubernetes Secrets = base64, NOT encrypted — enable EncryptionConfiguration
  • Rotate credentials before investigating — assume breach immediately
  • NetworkPolicy requires a supporting CNI (Calico, Cilium) — Flannel does not enforce
  • STRICT mTLS in Istio must be explicitly set — PERMISSIVE is the default

etcd

  • WAL fsync P99 > 10ms = disk I/O problem — move to NVMe
  • Compaction marks data reclaimable — defragmentation actually frees space
  • Never defragment all members simultaneously — do one at a time
  • etcd quota exceeded = cluster read-only — alert at 75%, page at 95%

StatefulSets

  • Headless Service (clusterIP: None) returns pod IPs via DNS, no load balancing
  • volumeClaimTemplates PVCs survive StatefulSet deletion — manual cleanup needed
  • Rolling updates go reverse ordinal order: N → 1 → 0
  • partition: N = only pods with ordinal ≥ N get updated (canary pattern)

RBAC

  • Role is namespace-scoped, ClusterRole is cluster-scoped
  • ClusterRole + RoleBinding = namespace-scoped access (useful pattern)
  • ClusterRole + ClusterRoleBinding = cluster-wide access
  • Never use cluster-admin for CI/CD service accounts

Operators

  • Reconcilers must be idempotent — called repeatedly, must handle existing state
  • Owner references = in-cluster garbage collection
  • Finalizers = external resource cleanup before deletion
  • Never regenerate passwords on reconcile — breaks existing connections

Multi-Cluster

  • Plan non-overlapping pod CIDRs from day one
  • GeoDNS TTL of 60s = ~60s failover lag — combine with health checks
  • Hot standby ≠ cold restore — 99.95% SLA requires pre-warmed DR site
  • Thanos / Victoria Metrics for cross-cluster metrics aggregation

TopicResource
Kubernetes InternalsKubernetes in Action — Marko Lukša (Manning)
etcdetcd.io documentation + Designing Distributed Systems — Burns
Istioistio.io documentation + Istio in Action — Posta, Maloku
Operator Developmentkubebuilder.io book + operator-sdk.io guides
Production SRESite Reliability Engineering — Google (free online)
SecurityCIS Kubernetes Benchmark + NSA/CISA K8s Hardening Guide
Argo Rolloutsargoproj.github.io/argo-rollouts
Prometheusprometheus.io + Prometheus: Up & Running — Brazil
GitOpsopengitops.dev + GitOps and Kubernetes — Yuen, Evenson
NetworkingKubernetes Networking — Hausenblas, Schimanski

💡 How to Use This Guide Most Effectively

> 1. First pass: Read question only, attempt your own answer from memory (timed) > 2. Score yourself: Compare to the quick answer — did you hit the key points? > 3. Deep dive: Read the full answer for concepts you missed or got wrong > 4. Apply it: Spin up a local cluster (kind/minikube) and implement the examples > 5. Teach it: Explain the concept to a colleague or rubber duck — the ultimate test > 6. Revisit: Return to questions you marked wrong after 1 week (spaced repetition)

The goal is not to memorize these answers — it is to internalize the reasoning patterns so you can construct correct answers to questions you've never seen before. This completes the full Advanced-to-Expert Kubernetes Q&A Study Guide. Here's a summary of everything that's been covered across all sections:


📦 What's Included in This Complete Guide

SectionQuestions CoveredKey Themes
Advanced ProductionQ45–Q50Upgrades, DevSecOps, Zero-Downtime, Autoscaling, Incident Response
Expert Edge CasesQ251–Q253, Q260Debugging, Zero-Trust, Operators, etcd
Scenario-BasedS1–S3Multi-Cluster, RBAC, StatefulSets
Index + PathsAllLearning paths, mastery tracker, cheat sheet

🚀 Suggested Next Steps

Since you're a DevOps engineer learning progressively, here's what I'd recommend practicing hands-on to reinforce this material:

  1. Spin up a local multi-node cluster with kind and practice the etcd backup/restore procedure — muscle memory matters during incidents
  2. Build the Database Operator from Q253 — nothing cements controller-runtime concepts faster than running your own reconciler
  3. Deploy Argo Rollouts with a real Prometheus AnalysisTemplate — seeing automated rollback in action is very compelling
  4. Run kube-bench against your cluster — the findings will immediately show you where your gaps are

Would you like me to continue with any specific question range (e.g., Q54–Q100 on networking, storage, or scheduling), or go deeper on any topic covered here?# Kubernetes Q&A: Continued Deep Dive (Q54–Q100)

Continuing the progressive learning sequence — networking, storage, scheduling, and advanced production topics.


🔵 ADVANCED LEVEL — Networking Deep Dive (Q54–Q65)


beginnerCluster Architecture, Installation & Configuration3 min+10 XP

Anatomy of a Kubernetes Manifest: The Four Essential Structure Fields

Question

Explain the architecture, failure modes, and operational best practices for Anatomy of a Kubernetes Manifest: The Four Essential Structure Fields in production Kubernetes environments.

advancedServices & Networking35 min+20 XP

Istio Traffic Management and Circuit Breaking: Architecture & Implementation

Question

Your payment service is experiencing cascading failures. When the downstream fraud-detection service becomes slow, payment service threads pile up waiting for responses, eventually exhausting the connection pool and causing payment service itself to fail. Implement circuit breaking, retry logic, timeout policies, and traffic mirroring using Istio to make this system resilient without changing application code.

intermediateCluster Architecture, Installation & Configuration6 min+15 XP

Kubernetes RBAC: Implementing Roles, ClusterRoles, and Bindings for Granular Security

Question

How do Role, ClusterRole, RoleBinding, and ClusterRoleBinding resources interact to enforce least-privilege authorization across namespaces and cluster-wide resources?

advancedWorkloads & Scheduling30 min+20 XP

Advanced Pod Scheduling: Affinity, Taints, and Topology

Question

You have a cluster with three node types: GPU nodes (expensive), high-memory nodes, and standard nodes. ML training jobs must run only on GPU nodes, memory-intensive analytics must prefer high-memory nodes, and web frontends must be spread across standard nodes in different AZs. Also, the GPU nodes should not accept any non-ML workloads. Implement this scheduling strategy.

beginnerWorkloads & Scheduling3 min+10 XP

Labels vs. Annotations: Resource Selectors vs. Operational Metadata

Question

What is the structural and functional difference between Labels and Annotations in Kubernetes, and why should operational metadata never be used in label selectors?

intermediateCluster Architecture, Installation & Configuration4 min+15 XP

ServiceAccounts vs. User Accounts: Identity, Token Auth, and Pod Authorization

Question

What are the key architectural differences between ServiceAccounts and User Accounts in Kubernetes, and how does token projection work for Pod service account authentication?

beginnerWorkloads & Scheduling4 min+10 XP

Pod Lifecycle States: Phase Transitions from Pending to Running and Termination

Question

What are the exact phase transitions a Pod undergoes from Pending to Running or Failed, and what conditions cause a Pod to remain stuck in Pending or CrashLoopBackOff?

advancedCluster Architecture, Installation & Configuration8 min+20 XP

What is the Kubernetes API Extension Model?: Architecture & Implementation

Question

How does the Kubernetes API extension model work using Custom Resource Definitions (CRDs) and custom controllers, and how does API aggregation differ from CRD registration?

advancedCluster Architecture, Installation & Configuration10 min+20 XP

How Do Validating vs. Mutating Admission Webhooks Differ?

Question

How do Mutating and Validating Admission Webhooks differ in execution order and purpose during an API server request, and how do you prevent webhooks from blocking cluster operations if they fail?

beginnerWorkloads & Scheduling3 min+10 XP

Init Containers: Pre-initialization, Dependency Waiting, and Setup Execution

Question

How do Init Containers execute sequentially before main application containers start, and how can they be used for dependency waiting, schema migrations, and secure credential setup?

beginnerCluster Architecture, Installation & Configuration3 min+10 XP

Deployments vs. ReplicaSets: Declarative Scaling and Pod Template Management

Question

Explain the architecture, failure modes, and operational best practices for Deployments vs. ReplicaSets: Declarative Scaling and Pod Template Management in production Kubernetes environments.

advancedCluster Architecture, Installation & Configuration8 min+20 XP

How Does etcd Store Kubernetes State Internally?: Architecture & Implementation

Question

How does etcd store Kubernetes cluster state internally using key-value MVCC (Multi-Version Concurrency Control), and how does the API server handle bbolt database compaction and revision watch streams?

beginnerWorkloads & Scheduling4 min+10 XP

Kubernetes Deployment Spec: Pod Templates, Replicas, and Rollout Controls

Question

What key fields inside a Deployment specification control replica count, update strategy, and pod revision history, and how does a Deployment controller manage underlying ReplicaSets?

beginnerWorkloads & Scheduling4 min+10 XP

Rolling Update Strategy: Zero-Downtime Deployment Control with maxSurge and maxUnavailable

Question

How do `maxSurge` and `maxUnavailable` parameters control rolling update rollouts, and how do you configure them to guarantee zero-downtime deployments under heavy traffic?

beginnerServices & Networking4 min+10 XP

Kubernetes Services: Stable Networking and Service Discovery for Transient Pods

Question

How do Kubernetes Services provide stable IP addresses and DNS endpoints for transient Pods, and how does kube-proxy update iptables/IPVS rules when Pod endpoints change?

beginnerServices & Networking4 min+10 XP

ClusterIP vs. NodePort vs. LoadBalancer vs. ExternalName: Service Type Selection

Question

What are the functional differences and use cases among ClusterIP, NodePort, LoadBalancer, and ExternalName service types, and how does packet routing work for each?

beginnerCluster Architecture, Installation & Configuration3 min+10 XP

ConfigMaps: Decoupling Application Configuration from Container Images

Question

Explain the architecture, failure modes, and operational best practices for ConfigMaps: Decoupling Application Configuration from Container Images in production Kubernetes environments.

beginnerStorage4 min+10 XP

Kubernetes Secrets vs. ConfigMaps: Sensitive Data Storage and Base64 Limitations

Question

What are the technical differences between Secrets and ConfigMaps, why is Base64 encoding insufficient for secret security, and how should sensitive data be encrypted at rest in etcd?

beginnerWorkloads & Scheduling3 min+10 XP

Kubernetes Self-Healing Mechanics: Automatic Restarts and Pod Rescheduling

Question

How does the Kubelet enforce self-healing mechanics through container restart policies and health probes, and how does the control plane reschedule Pods when a node dies?