Skip to content
RankCore.AI
← All posts

10 Kubernetes Concepts Explained: A Technical Guide with a Shipping-Port Analogy

· Kubernetes, DevOps, Containers, Cloud Native, SRE

The short video above treats Kubernetes as a shipping port: pods are crates, nodes are ships, the cluster is the fleet, and the control plane is the harbor master. That analogy is a good map. This guide is the study version. It keeps the port picture, then walks each of the ten concepts the way the Kubernetes documentation defines it — with YAML you can apply, kubectl you can type, and a clear note wherever the two-minute reel or its captions oversimplify.

How the harbor actually runs: the control plane

Before the ten objects, it helps to name the components. A cluster is a control plane plus one or more worker nodes. The official component overview lists:

  • kube-apiserver — the HTTP API. Every kubectl call, and every controller, goes through it.
  • etcd — the consistent key-value store for cluster state.
  • kube-scheduler — binds each pending Pod to a Node that can fit it (resources, taints, affinity).
  • kube-controller-manager — runs the reconcilers: Deployment, ReplicaSet, Node, EndpointSlice, HorizontalPodAutoscaler, and others.
  • cloud-controller-manager (optional) — talks to a cloud provider, for example to provision a LoadBalancer.
  • On every node: the kubelet (makes the Pods in the API actually run), a container runtime, and usually kube-proxy, which programs Service networking. Official docs mark kube-proxy as optional; some CNI plugins replace it.

The video says the harbor master "decides which ship carries which pod." That scheduling decision is specifically the scheduler. The rest of the control plane stores desired state, watches it, and continuously makes reality match.

1. Pod: the crate

Officially, a Pod is the smallest deployable unit you create and manage. It is one or more containers that are always co-located, share a network namespace (one IP per address family, one port space, localhost between those containers), and can share volumes. That matches the reel: a crate that holds one or more containers and shares an address.

You almost never create a bare Pod in production. A Deployment, Job, or other controller should own it. A minimal Pod still shows the model:

apiVersion: v1
kind: Pod
metadata:
  name: shop
  labels:
    app: shop
spec:
  containers:
    - name: app
      image: ghcr.io/example/shop:1.0
      ports:
        - containerPort: 8080
kubectl apply -f pod.yaml
kubectl get pods -o wide    # NODE and IP
kubectl describe pod shop

Inside the Pod, a sidecar and the app can talk on localhost. Across Pods they cannot: each Pod gets its own IP on the cluster network, with no NAT between Pods in the usual model.

2. Node: the ship

A Node is a machine that runs Pods. Official wording: "A node may be a virtual or physical machine, depending on the cluster." The spoken line in the video is right — "a machine, physical or virtual." The Instagram and YouTube captions that call it only "a machine (VM)" are too narrow. Bare metal is a normal production choice.

Each node reports capacity (CPU, memory, maybe GPU) and runs the kubelet, a runtime, and usually kube-proxy. The scheduler places a Pod only if the sum of resource requests on that node still fits. Useful commands:

kubectl get nodes
kubectl describe node <name>
kubectl cordon <name>     # stop scheduling new Pods
kubectl drain <name> --ignore-daemonsets --delete-emptydir-data

A learning cluster can be a single node. Production fleets spread nodes across failure domains so one ship going down does not take the harbor with it.

3. Cluster: the fleet and the harbor master

The cluster is the whole system: every Node plus the control plane that stores and reconciles desired state. "Which ship carries which pod" is the scheduler's bind, but controllers also replace evicted Pods, keep ReplicaSets at the right count, and publish EndpointSlices when Pods become ready.

kubectl cluster-info
kubectl get --raw /healthz
kubectl get componentstatuses   # legacy; prefer component health endpoints

There is no single "Cluster" object you apply. You get a cluster from kubeadm, kind, or a managed service. What you do apply are API objects the control plane then watches. CoreDNS (or an equivalent cluster DNS add-on) is what makes names like shop.prod.svc.cluster.local resolve; without it, Services still have ClusterIPs, but the friendly names in the reel do not work.

4. Namespace: separate docks

A Namespace is a scope for names. shop in dev and shop in prod do not collide. Namespaces are not nested. Cluster-scoped objects — Nodes, PersistentVolumes, StorageClasses — live outside them. Every cluster starts with default, kube-system, and usually kube-public and kube-node-lease; put application workloads in your own namespaces, not in kube-system.

kubectl create namespace dev
kubectl apply -f shop.yaml -n dev
kubectl get deploy,svc,pods -n staging

Nuance on "without bumping into each other": a Namespace prevents name collisions and lets you attach ResourceQuotas, Limits, Roles, and NetworkPolicies. It is not a security or network boundary by itself. Official multi-tenancy guidance is explicit: by default every Pod can reach every other Pod, traffic is unencrypted, and isolation requires RBAC (least privilege, usually RoleBindings inside the namespace) plus a CNI that enforces NetworkPolicy. Dev and prod on one cluster without those controls can still see each other.

5. Deployment: the shipping manifest

A Deployment declares a desired Pod template and replica count. It does not create those Pods directly. It creates a ReplicaSet, and the ReplicaSet keeps that many matching Pods alive. If a Pod sinks, the ReplicaSet launches a replacement. You should not usually edit the ReplicaSet by hand.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: shop
spec:
  replicas: 3
  selector:
    matchLabels:
      app: shop
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  template:
    metadata:
      labels:
        app: shop
    spec:
      containers:
        - name: app
          image: ghcr.io/example/shop:1.0
          ports:
            - containerPort: 8080
          resources:
            requests:
              cpu: "100m"
              memory: "128Mi"
kubectl apply -f deploy.yaml
kubectl set image deployment/shop app=ghcr.io/example/shop:2.0
kubectl rollout status deployment/shop
kubectl get rs
kubectl rollout undo deployment/shop

The default strategy is RollingUpdate, with maxUnavailable and maxSurge both defaulting to 25% (unavailable rounds down, surge rounds up). The video says a new version "swaps them one at a time so the port never closes." For three replicas, the defaults often look like one-at-a-time (25% of 3 rounds down to 0 unavailable and up to 1 extra, so the official walkthrough creates a fourth Pod, then replaces the old ones). With more replicas, several Pods can change at once. Recreate is the other strategy: it kills all old Pods first and does cause downtime. Readiness probes (section 9) are what keep a rolling update from sending traffic to a v2 Pod that is not ready yet.

6. Service: the port's fixed address

Pods are mortal; their IPs change. A Service gives a stable virtual IP and DNS name (shop.default.svc.cluster.local) and load-balances to matching backends. Kubernetes keeps EndpointSlice objects for the ready Pods. kube-proxy, or a CNI that replaces it, programs the data path.

Common spec.type values:

  • ClusterIP (default) — reachable inside the cluster only.
  • NodePort — also opens a port on every node.
  • LoadBalancer — asks the cloud (or an equivalent) for an external address.
  • ExternalName — a DNS CNAME, not a proxy.
apiVersion: v1
kind: Service
metadata:
  name: shop
spec:
  type: ClusterIP
  selector:
    app: shop
  ports:
    - port: 80
      targetPort: 8080
kubectl get svc,endpointslices
kubectl describe svc shop

The reel is right that the Service is a stable name over changing Pod IPs, and that it should spread traffic across healthy Pods — in practice, Pods that pass readiness (and are not being terminated). A Service is not, by itself, a public website. ClusterIP never leaves the cluster; Ingress, Gateway, NodePort, or LoadBalancer is how you expose it.

7. Ingress: the harbor gate

Ingress maps HTTP(S) hosts and paths to Services: shop.example.com to the shop, /api to the API, often with TLS termination. Important official notes the video has no time for:

  • An Ingress object does nothing until an Ingress controller (NGINX, Traefik, a cloud controller, and so on) is running and watching IngressClass.
  • The Ingress API is frozen. The Kubernetes project recommends the Gateway API as its successor. Ingress remains generally available and is not being removed, but it will not grow new features. New designs should prefer Gateway, GatewayClass, and HTTPRoute.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: shop
spec:
  ingressClassName: nginx
  rules:
    - host: shop.example.com
      http:
        paths:
          - path: /api
            pathType: Prefix
            backend:
              service:
                name: api
                port:
                  number: 80
          - path: /
            pathType: Prefix
            backend:
              service:
                name: shop
                port:
                  number: 80

8. ConfigMap and Secret: instructions, not cargo

A ConfigMap holds non-confidential settings. A Secret is for passwords, tokens, and keys. Both can become environment variables or mounted files, so you change config without rebuilding the image — the "instructions kept separate from the cargo" line is right.

apiVersion: v1
kind: ConfigMap
metadata:
  name: shop-config
data:
  LOG_LEVEL: info
---
apiVersion: v1
kind: Secret
metadata:
  name: shop-db
type: Opaque
stringData:
  password: change-me

stringData is a convenience; the API stores data as base64. Official good-practice docs are blunt: base64 is not encryption, and Secret objects are stored unencrypted in etcd by default. Enable encryption at rest on the API server (--encryption-provider-config) and still use RBAC, so a get secret is not world-readable. Prefer volume mounts over environment variables when you can, and do not check Secret manifests into a public repo.

9. Health checks: liveness, readiness, and startup

The kubelet runs probes against containers: HTTP, TCP, gRPC, or an exec command.

  • livenessProbe — "is this still alive?" Failure means the kubelet restarts the container.
  • readinessProbe — "ready for traffic?" Failure removes the Pod from Service/Gateway backends. The process keeps running.
  • startupProbe — for slow boots. While it is running, liveness and readiness are held back so a slow start is not killed as a deadlock.

The video's "inspections before you sail" is a little tight: probes are not only a pre-flight check. They keep running for the life of the container. Tune initialDelaySeconds, periodSeconds, failureThreshold, and do not use a heavy liveness check that kills a busy but healthy app.

livenessProbe:
  httpGet: { path: /healthz, port: 8080 }
  periodSeconds: 10
readinessProbe:
  httpGet: { path: /ready, port: 8080 }
  periodSeconds: 5
startupProbe:
  httpGet: { path: /healthz, port: 8080 }
  failureThreshold: 30
  periodSeconds: 2

10. Autoscaling: rush hour (HPA)

The reel's "CPU past 70%, replicas from 2 to 5" is a HorizontalPodAutoscaler on a Deployment (or similar scale target). HPA is a control loop (default 15 seconds) in the controller manager. For CPU or memory utilization, two prerequisites are official and easy to miss:

  1. Every container in the target Pods must have a resource request for that metric. If a request is missing, utilization is undefined and HPA will not act on it.
  2. Resource metrics usually come from metrics.k8s.io, provided by metrics-server, which is an add-on, not part of the core control plane.
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: shop
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: shop
  minReplicas: 2
  maxReplicas: 5
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 70
kubectl apply -f hpa.yaml
kubectl get hpa shop
kubectl top pods          # needs metrics-server

"You only pay for what you use" is a cloud-billing hope, not an HPA guarantee. HPA changes Pod replica count. Saving node cost also requires something that adds and removes nodes (cluster autoscaler or a managed node pool). Scaling down has stabilization windows so a brief calm does not flap the replica count.

How a single request uses all ten

Trace https://shop.example.com/api/cart through the port:

  1. The packet hits an Ingress controller (or a Gateway) — the harbor gate — which matches the host and the /api path and forwards to the api Service.
  2. The Service's stable ClusterIP is backed by EndpointSlices listing only ready Pod IPs. kube-proxy (or the CNI) load-balances to one of those addresses.
  3. That Pod is a crate on some Node (ship): a physical or virtual machine whose kubelet started the containers.
  4. The Pod was created by a ReplicaSet, which was created by a Deployment in the prod Namespace (a dock). If you applied the same names in dev, they would not collide, but they could still be reachable unless NetworkPolicy says otherwise.
  5. ConfigMap and Secret values are already in the container as env or files. They are not baked into the image.
  6. If /ready is failing, this Pod is not in the EndpointSlice and would not have received the request. If /healthz starts failing, the kubelet restarts the container.
  7. If many such requests push average CPU above 70% of the requested CPU, HPA raises spec.replicas on the Deployment, a larger ReplicaSet buries more crates on more ships, and the Service starts including their IPs once they are ready. When load falls, HPA scales back toward minReplicas.

That is the whole analogy, wired end to end.

A compact lab

Use kind, minikube, or any throwaway cluster — not production.

  1. kubectl create ns lab and apply the Deployment and Service from sections 5 and 6 into that namespace, with resource requests set.
  2. kubectl get pods -o wide and confirm three different Pod IPs, possibly more than one Node.
  3. kubectl delete pod <one> and watch the ReplicaSet create a replacement. The Service name should keep answering (kubectl run curl --rm -it --image=curlimages/curl --restart=Never -n lab -- curl -sS http://shop.lab.svc.cluster.local/).
  4. kubectl set image to a new tag and kubectl rollout status. Watch kubectl get rs so you see the new ReplicaSet surge and the old one drain.
  5. Add liveness and readiness probes, then break /ready (or point it at a missing path) and confirm the Endpoints list shrinks while the container stays up.
  6. Install metrics-server if needed, apply the HPA, and run a short CPU burn to see replicas walk from 2 toward 5. Then stop the burn and wait for the scale-down.

If you can narrate those six steps without the script, you have the reel at working depth.

Recap

ConceptPort pictureWhat to remember
PodCrate, shared IPSmallest unit; containers share a network namespace
NodeShipPhysical or virtual machine; kubelet + runtime
ClusterFleet + harbor masterControl plane + nodes; scheduler is only one part
NamespaceDocksName scope, not isolation by itself
DeploymentManifest, replicas: 3Owns a ReplicaSet; rolling defaults are 25%/25%
ServiceFixed addressClusterIP/NodePort/LoadBalancer + EndpointSlices
IngressHarbor gateHost/path routing; API is frozen; prefer Gateway API
ConfigMap / SecretInstructionsSecrets are base64, not encrypted by default
ProbesInspectionsStartup, liveness (restart), readiness (traffic)
HPARush hourNeeds metrics-server and resource requests

FAQ

Should I create Pods directly? Almost never. Use a Deployment (or Job, StatefulSet, DaemonSet) so a replacement is automatic.

Why is my Service empty? Check labels versus spec.selector, and whether readiness probes are failing. kubectl get endpointslices should list ready addresses.

Why does Ingress stay pending? No controller is implemented, or ingressClassName does not match. Install a controller, or use Gateway API.

Can two teams share a cluster safely with only namespaces? Not safely. Add RBAC, quotas, and NetworkPolicy (and usually more). Treat namespaces as a handle for policy, not as a wall.

Why is HPA stuck at 2? metrics-server missing, no requests.cpu, or the current average is already under the target.

What is the difference between a Deployment and a ReplicaSet? The ReplicaSet is the thing that actually holds the replica count for one Pod template. The Deployment sits above it so you can roll out a new template, pause, and roll back. Official docs recommend not managing ReplicaSets that a Deployment owns.

ClusterIP versus Ingress versus LoadBalancer? ClusterIP is only in-cluster DNS/IP. LoadBalancer asks the infrastructure for an address in front of one Service. Ingress (or Gateway) sits in front of many Services and routes by host and path. They compose: Ingress usually targets ClusterIP Services.

Do Secrets become safe once they are in etcd? Only if you turned on encryption at rest and locked RBAC. Anyone who can kubectl get secret still sees the decoded value. stringData is for your convenience in YAML; it is not a secrecy feature.

Is kube-proxy required? Many clusters still run it. Official docs list it as optional because some networking plugins implement Services themselves. The Service API is still there either way.

What about StatefulSets and DaemonSets? Out of scope for the reel, but important. StatefulSets give stable identity and storage for databases. DaemonSets put one Pod on (almost) every Node, like a log agent. Neither is a drop-in replacement for a Deployment of a stateless web app.

Save this for the next DevOps interview — then read the official pages linked above when a cluster disagrees with the analogy. Follow @rankcore.ai, and read more on blog.rankcore.ai.

Want to go deeper?

Our step-by-step video courses turn these ideas into results.

See courses

Comments

Sign in or create a free account to join the discussion.

No comments yet — be the first.