Objects
You write the spec, and Kubernetes fills in the status
Every object has apiVersion, kind, metadata and spec. Kubernetes adds status.
Everything in Kubernetes is an object, and every object has the same shape. A P I version and kind say what it is. Metadata gives it a name. Spec is the part you write: what you want. Here, three replicas. Status is the part Kubernetes writes: what actually exists. Here, two are ready. And a controller keeps working until the status matches the spec. That is the declarative model: you state what should be true, never how to get there.
Objects · Going deeper
The kinds of object
Kinds that run, connect, configure, store, divide, control and extend.
Components
Every component talks to the API server, and to nothing else
The API server is the only door, and the only thing that talks to etcd.
Now the parts of a cluster. In the centre is the A P I server. Every request enters here. You reach it with kubectl. Etcd stores the state of the whole cluster, and only the A P I server talks to it. The scheduler picks a node for each new pod. The controller manager runs the control loops. The cloud controller manager talks to the cloud provider. Those are the control plane. On every worker node, the kubelet runs the pods and kube-proxy routes the traffic.
Components · Going deeper
Eight components, one job each
Scheduler decides where. Kubelet makes it run. Controllers decide how many.
Check yourself
Which component belongs at the "?"
Workloads
Choose the controller by what the pods need
Deployment for stateless copies, StatefulSet for identity, DaemonSet per node, Job and CronJob for finite work.
You rarely create pods directly. You pick a controller, and it creates them. A Deployment runs identical copies that can be replaced freely: a web service. A StatefulSet gives each pod a stable name and its own disk: a database. A DaemonSet runs exactly one pod on every node: a logging agent. A Job runs a task to the end, then stops. And a CronJob starts a Job on a schedule.
Workloads · Going deeper
Deployments, ReplicaSets and rolling updates
A Deployment owns ReplicaSets, and an update shifts pods from old to new.
Pods
A pod is containers that share one address and one fate
A pod shares one IP address and its volumes among its containers.
So what is a pod? A pod has one network address, and usually one main container. It can hold a second, a sidecar, such as a helper that ships logs. The two reach each other on localhost. They can share a volume. Init containers run first, one at a time, each to completion. The pod is the smallest thing Kubernetes runs. It is placed on one node as a unit, and it is disposable: a replacement gets a new address.
Pods · Going deeper
Pod phases and probes
Pending, Running, Succeeded, Failed, Unknown.
Check yourself
A fourth node joins the cluster and gets the same pod at once. Which controller is this?
Labels
Objects find each other by label, not by name
A label marks an object. A selector finds every object with that label.
One last idea holds the others together. Here are four pods. Three carry the label app equals web. One carries app equals d b. The Deployment has a selector: app equals web. That is how it knows which pods are its own. The Service has the same selector, so it sends traffic to the same three. The database pod matches neither, so neither one sees it. Nothing stores a list of pod names. Replace a pod, and the new one is found by its label.
Labels · Going deeper · 1 of 2
Names, namespaces, labels, annotations
Labels select. Annotations only describe.
Labels · Going deeper · 2 of 2
Clue words for core concepts
Each component and controller by its one job.
Check yourself
A team lists what its pods need as shown. Which controller fits?
Lesson complete
You finished “Kubernetes core concepts”
Answer the questions along the way to see your score here.