DevOps line
Kubernetes
Sadia files a card for three trays, the office keeps them up, and one window number meets the street door.
Stops explain each step. The film plays the whole ride.
- Filing
- Waiting
- Ready
- Fallen
She files the card
Sadia files a card that says keep three trays. The office stores the card, and no tray is standing yet.
Next stop: The office writes three
All stops
The everyday version
A greenhouse. The card is the written count, the tray is the pots that share a water line, the window is one pickup number, and the street door needs a watcher.
- Sadiais the Planner
She writes the card that says how many trays to keep.
- The officeis the Control plane
Harun files the card and keeps the real count matched to it.
- Chhayais the Node
She runs one shelf and starts the pots on the tray placed there.
- The trayis the Pod
Pots that share one water line. A fallen tray is replaced, not carried to another shelf.
- The windowis the Service
One number that calls a ready tray. People do not chase a tray that may be gone.
- Irfanis the Ingress
He watches the street door and sends people to the window. A sign alone stays shut.
Interview questions
Say the short answer first. Go deeper only if they ask.
What is a Pod, a ReplicaSet, and a Deployment?
A Pod runs one or more containers that share a network and storage. A ReplicaSet keeps a count of Pods. A Deployment owns the ReplicaSet and the rollout.
You rarely create a bare Pod. Creating a Deployment creates a ReplicaSet, and that ReplicaSet creates the Pods. Do not manage a ReplicaSet that a Deployment owns. A rollout starts only when the Pod template changes. Scaling changes the count and does not create a revision. The rolling update defaults are maxUnavailable 25% and maxSurge 25%. Undo restores the previous Pod template, and revisionHistoryLimit keeps 10 old ReplicaSets by default. Once an old ReplicaSet is deleted, that revision cannot be rolled back. The label selector is immutable after creation.
“A Pod is a container.”
What is the control plane, and what is a node?
The control plane decides and stores the card. A node runs the trays. The kubelet on the node starts containers.
The control plane is the API server, etcd, the scheduler, and the controller manager. The cloud controller manager is optional. etcd stores the cluster data. It does not run containers. On a node, the kubelet starts containers through a container runtime, which is not one fixed program. kube-proxy is optional. DNS is an addon, not a control-plane component.
“etcd runs the containers.”
Why have a Service if the Pod already has an address?
A Pod address dies with that Pod. A Service is one stable address that selects Pods by labels and lists the ready ones.
The default type is ClusterIP, reachable inside the cluster. NodePort uses a port on each node, by default in the range 30000 to 32767. LoadBalancer needs a cloud provider or another integration. Kubernetes does not itself provide that balancer. ExternalName is a DNS alias and does not proxy. A headless Service uses ClusterIP None. The EndpointSlice controller keeps the ready addresses. The older Endpoints API is deprecated. Clients inside the cluster use the Service, not a Pod address.
“Connect straight to the Pod address.”
How is an Ingress different from a Service?
A Service exposes Pods. An Ingress is the outside web gate onto Services, and it does nothing until a controller is installed.
Ingress is not a type of Service. It has been stable since 1.19, the API is frozen, and there is no plan to remove it. Rules match a host and a path to a Service and a port. pathType is required. Kubernetes recommends the Gateway API for new work. That API is an extension, not a requirement for this ride. A Service can also be published with a LoadBalancer where a provider supplies one. Ingress does not expose arbitrary protocols.
“Ingress is a type of Service, and the object works with no controller.”
What do liveness, readiness, and a startup probe do?
Liveness restarts a stuck container. Readiness takes a Pod off the Service list without a restart. A startup probe holds the other two until the app has started.
The kubelet runs the probes. A failed readiness probe makes the EndpointSlice controller remove that Pod address from matching Services. A failed liveness probe restarts the container after its failure tolerance. A failed startup probe kills the container, and the restart policy applies. Pod restartPolicy defaults to Always. A Deployment allows only Always. CrashLoopBackOff is the waiting status while restarts back off from 10 seconds to a cap of 300 seconds. It is not a restart policy. A busy line that changes the written count is a different stop.
“Liveness and readiness are the same check.”
Cheat-sheet
Commands you will actually type.
kubectl apply -f deploy.yamlSend the card. The cluster stores the desired count.
kubectl get pods -o wideList the trays and which shelf each one is on.
kubectl describe pod webShow events for one tray when it will not start.
kubectl logs webRead what that tray printed.
kubectl rollout undo deployment/webReturn the previous tray template. Scaling is not a rollout.
kubectl scale deployment/web --replicas=5Change the written count. This does not start a rollout.