Master Kubernetes Basics: Understanding Pods, Nodes, and Cluster Resources
This article provides a concise, practical guide to Kubernetes fundamentals, covering pod creation, the essential compute‑network‑storage resources, cluster components, native objects like Deployments and StatefulSets, and the trade‑offs of standardization, elasticity, and extensibility.
Understanding Pods: Half of Kubernetes Mastery
Kubernetes abstracts compute, network, and storage resources into a standard API service, and most operations are REST API calls via kubectl, UI, or pipelines.
Although Kubernetes has many native resources, focusing on Pods—the fundamental unit—helps grasp the platform quickly.
Example Nginx Pod YAML:
<code>apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: web
image: nginx
ports:
- name: web
containerPort: 80
protocol: TCP</code>Create the Pod with detailed logs:
<code>kubectl create pod -f nginx.yaml -v8
kubectl get pod -v8</code>After creation, the Pod acquires additional fields such as scheduling, kubelet management, IP allocation, volume mounts, and more, reflecting its lifecycle.
Pod lifecycle fields include phase, hostIP, podIP, conditions, etc.
The three essential resources for a container are compute (CPU/Mem/GPU), network (PodIP via CNI), and storage (volumes via CSI).
Updating a Pod is limited to a few fields like image; deleting a Pod triggers termination and resource cleanup.
For detailed Pod lifecycle, see the official Kubernetes documentation.
Kubernetes Cluster Perspective: Compute, Network, Storage
Nodes represent compute resources, PersistentVolumes provide block storage, and StorageClasses automate PV creation.
Service networking includes ClusterIP (L4), Ingress/GatewayAPI/ServiceMesh (L7), and NetworkPolicy for access control.
ClusterIP uses kube-proxy and iptables (or ipvs) to route traffic; Headless Services rely on DNS.
LoadBalancer and NodePort expose services externally, with externalTrafficPolicy influencing traffic handling.
Example iptables rules for services are shown.
L7 traffic is handled by Ingress controllers or Service Meshes, enabling advanced features like encryption and fault injection.
Native Resources: Wrappers Around Pods
Deployments wrap ReplicaSets, which manage Pods; Jobs and CronJobs wrap Pods for batch processing; StatefulSets manage stateful Pods with ordered updates.
Auxiliary resources include Ingress, Service, ConfigMap, Secret, and resource‑quota controls.
Reconsidering Kubernetes
Kubernetes components (kubelet, kube-proxy, CSI, API server, controller manager, scheduler) expose a unified REST API backed by etcd, turning the cluster into a cloud operating system.
Standardization brings complexity, elasticity introduces volatility, and extensibility can lead to varying quality of third‑party tools.
Efficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.