Kubernetes
293 bites tagged Kubernetes — interview questions with model answers, and 60-second explainers.
Kubernetes ServiceAccounts: Identity for Pods
A ServiceAccount is an ID badge for a Pod, letting it securely talk to the Kubernetes API. It's used when your app needs to list other Pods or read Secrets.
Kustomize: Template-Free Kubernetes Configuration
Kustomize is a patch tool for Kubernetes YAML, letting you manage environment-specific configurations without complex templates. Use it to define a base config and apply overlays for dev, staging, and prod. The footgun is treating it like a templating engine.
Immutable Secrets & ConfigMaps: Write-Once Configuration
Treat your Kubernetes configuration like a container image: create it once, then create a new version to update it. The `immutable` flag enforces this "write-once" pattern for Secrets and ConfigMaps, reducing API server load and preventing accidental updates.
The Kubernetes Downward API: Pod Self-Awareness
The Downward API gives a container self-awareness, injecting Pod metadata like its name or IP address as environment variables or files. Use it so apps can self-configure without calling the main K8s API.
Projected Volumes: Mount Config as Live Files
A projected volume mounts ConfigMaps and Secrets as files inside your Pod, which update automatically when the source object changes. Use this for apps that can hot-reload config, avoiding restarts. The footgun: updates aren't instant; there's a delay.
Kubernetes: Inject ConfigMaps & Secrets as Env Vars
Injecting ConfigMaps and Secrets as environment variables decouples your app from its configuration. Kubernetes passes these key-value pairs into your container at startup, perfect for things like API keys or feature flags.
Kubernetes Secrets: Managing Sensitive Data in Pods
A Kubernetes Secret is a dedicated object for storing sensitive data like API keys, separating them from your application code. It's used to inject database credentials or TLS certificates into pods.
kube-proxy: The Plumber for Kubernetes Services
kube-proxy is the network plumber on each node, making Kubernetes Services work. It translates a Service's virtual IP into routes to real pods using iptables or IPVS. The name is a footgun: it's a Layer 4 packet forwarder, not a Layer 7 application proxy.
Kubernetes NetworkPolicy: A Firewall for Pods
NetworkPolicy is a firewall for pods, locking down traffic in a cluster where everything can talk to everything by default. Use it to isolate services, like preventing a web frontend from directly accessing a database.
Kubernetes LoadBalancer: Your App's Public Entry Point
A Kubernetes LoadBalancer Service automatically provisions a cloud provider's load balancer to expose your app externally. It's the simplest way to get a public IP, but creating one per service is expensive and inflexible. Use an Ingress for more control.
Ingress Controller: Your Cluster's Smart Reverse Proxy
An Ingress Controller is the traffic cop for your Kubernetes cluster, directing external HTTP/S requests to the correct internal services. It exposes multiple services under a single IP, handling host and path routing.
Kubernetes Ingress: The Cluster's Smart Receptionist
Ingress acts as a smart receptionist for your cluster, routing external HTTP/S traffic to internal services based on host or path. This lets you expose many apps with one load balancer.
Kubernetes DNS: How Pods Find Each Other
Kubernetes DNS gives services and pods stable, human-readable names so you don't have to track ephemeral IP addresses. It's how a frontend pod finds a backend service.
ClusterIP Service: Internal-Only Networking
A ClusterIP service is like an unlisted phone number for your pods, providing a stable internal IP for communication *within* the cluster. Use it for backend-to-backend traffic. The footgun is assuming it's reachable from the outside—it's not.
Pod Affinity: Grouping or Separating Your Pods
Pod affinity tells Kubernetes to place pods together for performance or apart for high availability. Use it to co-locate a web server and cache for low latency, or spread database replicas across nodes to prevent a single point of failure.
Pod Disruption Budgets: Stop Upgrades From Killing Your App
A Pod Disruption Budget (PDB) is a contract with Kubernetes to maintain minimum availability. It limits how many pods can be voluntarily terminated at once during node drains or cluster upgrades, preventing self-inflicted outages.
Kubernetes CronJob: Scheduled Tasks in Your Cluster
A Kubernetes CronJob is like a recurring alarm for your cluster. It automatically runs tasks like backups or reports on a schedule, creating a new Job for each run. The main footgun is concurrency: by default, jobs can overlap if one runs too long.
Init Containers: Setup Tasks Before Your Main App Runs
Init containers are setup tasks that run to completion before your main application starts. Use them to wait for dependencies, fetch configs, or run database migrations.
Kubernetes Probes: Liveness, Readiness, and Startup
Kubernetes probes ask your app about its health. Liveness asks 'are you alive?' (restart if not), readiness asks 'can you take work?' (pause traffic if not), and startup protects slow-starting apps. This is key for self-healing and zero-downtime deployments.
Imperative kubectl: Directly Command Your Cluster
Imperative `kubectl` is like giving direct orders to your cluster: 'run this,' 'scale that.' It's great for quick, one-off tasks like debugging a pod or handling an incident.
Recreate Deployment: Downtime for a Clean Slate
The Recreate strategy is like flipping a switch: it shuts down all old pods before starting new ones. This guarantees downtime but is necessary for breaking changes, like a database migration. The footgun is a failed deployment leaves you with no running app.
Kubernetes Jobs: For Tasks That Need to Finish
A Kubernetes Job runs a task to completion, unlike a Deployment which runs forever. Use it for one-off operations like database migrations or batch processing. The footgun is forgetting to set a retry limit, causing failed jobs to loop indefinitely.
Kubernetes Requests and Limits: Your Pod's Resource Contract
Kubernetes Requests and Limits are your pod's resource contract: `requests` guarantee a minimum for scheduling, while `limits` enforce a maximum at runtime. This prevents one greedy app from crashing others.
ReplicaSet: Kubernetes' Pod Thermostat
A ReplicaSet is Kubernetes' thermostat for pods, ensuring a specific number of replicas are always running. It replaces crashed pods or removes excess ones to maintain a stable state.
Get Kubernetes bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.