Kubernetes is built around a small set of composable resource types. Understanding how they fit together is the difference between βrunning random YAML filesβ and actually designing systems. This lesson is a tour, organized by what each resource is for.
Cluster, Node, Namespace
π’
Cluster
The whole Kubernetes installation. One control plane, many worker nodes.
π»
Node
A machine (VM or physical). Runs kubelet, kube-proxy, container runtime. Can host many pods.
π·οΈ
Namespace
Virtual cluster within a cluster. Isolation boundary for resources, RBAC, network policies.
Most resources are namespaced β they live inside a namespace. A few are cluster-scoped (Nodes, ClusterRoles, PersistentVolumes, StorageClasses).
Workload Resources
The βwhat is runningβ layer.
π¦
Pod
One or more co-located containers with shared network and storage. Smallest unit. Usually managed by higher-level resources, not created directly.
π―
Deployment
For stateless services. Manages a ReplicaSet. Rolling updates, rollback, scaling. Default workload type for most services.
π
ReplicaSet
Maintains N replicas of a Pod. Usually created by Deployment, not directly.
πΎ
StatefulSet
For stateful workloads (databases, brokers). Stable identity, ordered deployment, persistent volume per pod.
π€
DaemonSet
One pod per node (or matching node selector). For log collectors, monitoring agents, CSI drivers, network plugins.
β°
Job / CronJob
Run-to-completion workloads. Job for one-off; CronJob for scheduled (cron syntax).
Choosing the right workload type
Deployment
Stateless, swappable
Web servers, API services, workers without local state. Can scale freely; pods are interchangeable.
StatefulSet
Stateful, identity-bound
Databases, brokers, anything where pod identity or ordering matters. Pod gets a stable hostname, stable storage. Ordered scaling.
Service and Networking
Pods are ephemeral; their IPs change. Services provide stable endpoints.
π
Service
Virtual IP and DNS name targeting a set of Pods (selected by label). Types: ClusterIP, NodePort, LoadBalancer, ExternalName.
π·οΈ
Endpoints / EndpointSlice
The actual list of Pod IPs backing a Service. Updated by the endpoints controller. EndpointSlice is the modern, scalable form.
π
Ingress
HTTP/HTTPS L7 routing β path-based, host-based, TLS termination. Backed by an Ingress controller (nginx, Traefik, AWS ALB, etc.).
πͺ
Gateway API
Modern replacement for Ingress. More expressive, role-oriented (Gateway, HTTPRoute, GRPCRoute). Will eventually replace Ingress in most clusters.
π‘οΈ
NetworkPolicy
Firewall rules between pods. Restricts pod-to-pod traffic. Without them, all pods can talk to all pods.
πΈοΈ
Service mesh resources
Istio VirtualService, DestinationRule. Linkerd ServerAuthorization. CRDs that layer over the standard resources.
Configuration and Secrets
π
ConfigMap
Non-sensitive key-value config. Mounted as files or env vars in pods. Feature flags, public URLs, log levels.
π
Secret
Sensitive data. Base64-encoded; encrypted at rest if etcd encryption is configured. DB passwords, API keys, TLS certs.
For production secrets, integrate with a real secret manager (AWS Secrets Manager, Vault, GCP Secret Manager) via the External Secrets Operator.
Storage
π
Volume
Storage attached to a Pod. Lifetime tied to the pod. Many types β emptyDir, hostPath, configMap, etc.
ποΈ
PersistentVolume (PV)
Cluster-level storage resource. Backed by EBS, NFS, etc. Lifecycle independent of any pod.
π«
PersistentVolumeClaim (PVC)
A pod's request for storage. Binds to an available PV (or triggers dynamic provisioning).
βοΈ
StorageClass
Template for dynamic PV provisioning. "gp3-encrypted-iops3000" β a class your StatefulSets ask for.
Identity and Access
π€
ServiceAccount
Identity for processes running in pods. By default each pod gets the namespace's default ServiceAccount. Use distinct ones for least-privilege.
π
Role / ClusterRole
Permissions definitions. Role is namespace-scoped; ClusterRole is cluster-wide. Verbs (get/list/create/update/delete) on resources.
π
RoleBinding / ClusterRoleBinding
Attach a Role to a User, Group, or ServiceAccount. The "X can do Y in namespace Z" mapping.
Declares a new resource type. K8s starts validating and storing instances of the new type the same way it does built-in types.
π€
Operator
A controller that manages CRDs. Encodes domain knowledge β how to operate a Postgres cluster, a Kafka cluster, a backup schedule.
π
OperatorHub
Catalog of community operators. Don't write your own for common systems β there's usually a battle-tested one.
A Realistic Composition
What a typical SaaS service looks like in K8s:
Namespace: app-prod Deployment: api-server βββ 3 Pods Γ (api-server container + sidecar log-collector) βββ envFrom: ConfigMap "api-config" + Secret "api-secrets" βββ ServiceAccount: api-server-sa βββ RoleBinding to Role "read-configs" Service: api-server (ClusterIP) βββ targets pods with label app=api-server Ingress: api-public βββ routes /v1/* to Service api-server HorizontalPodAutoscaler: api-server-hpa βββ scales api-server Deployment 3-20 replicas based on CPU ResourceQuota: app-prod-quota βββ limits namespace to 50 CPUs, 100Gi memory NetworkPolicy: api-server-policy βββ allows ingress only from ingress controller; egress only to DB StatefulSet: postgres βββ 3 Pods, each with 100Gi PVC from gp3-encrypted StorageClass βββ Headless Service for stable DNS ExternalSecret: db-creds βββ pulls from AWS Secrets Manager into Secret "postgres-creds"
This is what a βrealβ production service looks like. Lots of resources composing β but each one has a single, focused responsibility.