The issue opens pre-filled with this page title and URL.
Kubernetes does not simply start containers: it runs applications on a set of machines. You do not start a container directly on a server. You declare a desired state to the cluster, and Kubernetes takes care of reaching it. This lesson gives you the six words you need to follow the rest of the module: cluster, Node, Namespace, Pod, Deployment and Service. It follows an application from the Deployment that maintains it to the Service that makes it reachable, without deploying anything yet.
No cluster is needed to read this lesson. The commands and their outputs are given so that you can see what these objects look like. They only read the state of the cluster, they create nothing. You will be able to replay them once kubectl is installed, in the
next lesson,
and your
first cluster
created. The outputs come from the single-node kind cluster named monapp, the one the "First cluster" lesson has you create. Port numbers and the random suffixes of names will differ on your machine.
Prerequisites
No knowledge of Kubernetes is assumed. All you need to know is what a container is: an application packaged with what it needs to run, started from an image.
What you will learn
Name the basic objects (cluster, Node, Namespace, Pod, Deployment, Service)
and say what each one is for in one sentence.
Tell a Node from a Pod, and a Pod from a Deployment.
Follow on a diagram how Deployment, Pods, Nodes and Service fit together.
Predict which object recreates a deleted Pod and which object keeps a stable
address to reach it.
Why learn this vocabulary first?
The official documentation and tutorials use these six words all the time,
without ever redefining them. Without them, a command such as
kubectl get deployments -A or an error message about a Pod means nothing.
Knowing them now saves you time for the whole rest of the course.
What is the nature of each concept?
The table places the six notions at a glance. Read the "Nature" column to see
that they are not objects of the same kind: a machine, a logical grouping, a
controller, a network address.
Concept
Nature
Role
Cluster
Set
Groups all the resources
Node
Machine
Runs the workloads
Namespace
Logical organization
Isolates and sorts objects
Pod
Unit of execution
Runs the containers
Deployment
Controller
Maintains and updates Pods
Service
Network abstraction
Provides stable access
Swipe to see more
The Cluster: your Kubernetes infrastructure
A cluster is a set of machines that work together to run your applications. It is made of two types of machines:
Type
Role
Control plane
Brain of the cluster: decides where to place Pods, watches the state
Worker nodes
Muscles of the cluster: actually run the containers
Swipe to see more
You interact with the cluster through kubectl, the command-line tool.
Check the connection to the cluster
kubectlcluster-info
Result
Kubernetes control plane is running at https://127.0.0.1:45427
CoreDNS is running at https://127.0.0.1:45427/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
This command confirms that your machine can communicate with the control
plane. The port varies from one cluster to another: only the answer matters.
The Nodes: the servers of your cluster
A Node is a machine, physical or virtual, that is part of the cluster. Each Node can run several Pods. A Node is therefore a server, whereas a Pod, seen below, is a program running on a server.
Look first at the ROLES column: monapp-control-plane has the control-plane
role. This learning cluster has only one node, which plays both the control
plane and the worker. On a multi-node cluster, the workers show <none>: this
means they carry no particular role, not that they are misconfigured.
Then watch the STATUS column. A Ready Node is operational and can receive Pods. A NotReady signals a problem, most often the network, exhausted resources or a stopped kubelet (the agent that runs Pods on each Node). Right after a cluster is created, NotReady is normal for a few seconds, while the network comes up.
The Namespaces: organizing the cluster
A Namespace is a named scope that logically isolates resources. Before creating Pods, you need to know where to put them.
List the Namespaces
kubectlgetnamespaces
Result
NAME STATUS AGE
default Active 22s
kube-node-lease Active 22s
kube-public Active 22s
kube-system Active 22s
local-path-storage Active 17s
The table says what each of these Namespaces, created by default, is for.
Namespace
Usage
default
Your applications if you specify nothing
kube-system
Internal Kubernetes components
kube-public
Resources readable by everyone
kube-node-lease
Internal management of Node heartbeats
local-path-storage
Added by kind to provide local storage
Swipe to see more
In production, create one Namespace per application or per team. Beyond tidiness, this split sets the scope for resource quotas and access rights. Without it, these policies would apply to the whole cluster or to nothing.
The Pods: the basic unit
A Pod is the smallest unit that Kubernetes deploys, and it runs your containers. In most cases, it contains a single application container. Several containers in the same Pod share the same IP address and can share volumes.
The -A option asks for the Pods of all Namespaces at once. Each line is a Pod. The READY column shows the number of containers
ready out of the total: 1/1 means one container ready out of one.
Look at the names: Kubernetes runs itself with its own Pods.
etcd, kube-apiserver, kube-scheduler and kube-controller-manager are
the components of the control plane. No Deployment (the object that maintains
your applications, presented below) manages them. The kubelet of the Node
starts them itself, from files placed on that Node. You have nothing to do with
them today: the lesson
The control plane,
in the "Cluster architecture" module, details the role of each one.
In production, never create a standalone Pod. A Pod created directly with kubectl run is watched by no controller: if its Node goes down or if it is deleted, it disappears for good, and nothing recreates it. A container that crashes, on the other hand, is restarted in place, within the same Pod, by the kubelet of the node: that is not the job of a Deployment. For any lasting application, go through a Deployment. Standalone Pods remain useful to learn, test or diagnose.
The Deployment: the controller that keeps your applications running
A Deployment is the most common controller for running an application. It does not just create Pods: it maintains the right number of copies (the replicas), recreates those that disappear and drives rolling updates. The difference from a standalone Pod fits in one sentence: a Pod runs, a Deployment makes sure there are always the right number of them.
The READY column shows ready-Pods/desired-Pods. CoreDNS shows 2/2: two replicas requested, two in service. It is the Deployment that maintains this count, not you.
The Service: stable network access
A Service provides a stable access point to a group of Pods. Pods are ephemeral: a recreated Pod gets a new IP address. So you do not contact them directly, you go through the Service, which keeps a stable address and spreads the traffic between them.
Problem
The Service's answer
A recreated Pod changes IP address
The Service keeps a fixed IP
Several Pods do the same job
The Service spreads the traffic (load balancing)
An application needs a DNS name
The Service exposes a stable name
Swipe to see more
List all the Services
kubectlgetservices-A
Result
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
Two types of Services are worth knowing. The ClusterIP type, the default one, is only reachable from inside the cluster. The LoadBalancer type is reachable from outside through a dedicated address.
A new cluster only has ClusterIP Services, as above. The LoadBalancer type assumes that someone provides the address: a cloud provider in production, a component to install locally. You will create Services in the lesson on the first deployment.
How do these objects fit together?
The diagram follows a typical scenario. Look first at the two zones, the control plane that decides and the worker nodes that host the demo Namespace. Then follow the arrows: the web Deployment maintains three Pods, and the web Service sends traffic to them.
I create a Namespacedemo to organize my resources.
I declare a Deploymentweb with 3 replicas.
The Deployment creates 3 Pods that run on the worker nodes.
I create a Serviceweb that targets these Pods.
The other applications call the Service, not the Pods directly.
This declarative model is the key to Kubernetes: you describe the desired state, the cluster makes sure it is reached.
Can you predict what happens?
This small exercise checks that the diagram is clear, before moving on to practice. On the diagram, mentally delete the web-abc12 Pod. Which object creates a new one, and why? It is the web Deployment: it compares the three declared replicas to the two remaining Pods and recreates one. Behind the scenes, the Deployment hands this counting over to a ReplicaSet that it creates itself, which the lesson Kubernetes architecture details. The new Pod gets another IP address, but the applications that call the web Service do not notice, since the Service keeps the same address.
Remember how the roles are shared: the Deployment keeps the right number of Pods, the Service keeps a stable address to reach them, and the Node only hosts. If a Node goes down, it is still the Deployment that recreates the lost Pods on another Node.
What can you ignore for now?
You will come across other components as you go. To get started, focus on the objects you handle directly. The table says when each of the others becomes useful in the course.
Its role in Worker Nodes, then advanced networking
CNI (Calico, Cilium...)
Advanced networking
Admission controllers
Advanced security
Swipe to see more
Start with Pod, Deployment and Service. These three objects are enough to deploy the vast majority of applications, and everything else hangs off them: ConfigMaps and Secrets feed the Pod, the Ingress sits in front of the Service, and more specialized controllers replace the Deployment in specific cases.
Key takeaways
Concept
One-sentence definition
Cluster
Set of machines that run Kubernetes
Node
One machine of the cluster
Namespace
Logical isolation to organize resources
Pod
Minimal unit that runs one or more containers
Deployment
Controller that maintains and updates Pods
Service
Stable network access point to a group of Pods
Swipe to see more
Four fundamental ideas stand out:
You do not deploy your application directly on a Node, you declare it to the cluster.
You deploy Pods, generally through a Deployment.
You go through a Service to reach your Pods.
The cluster spreads all of this across the available machines.
The read commands of this lesson, to replay on your cluster:
The basic commands
kubectlcluster-info# Check the connection
kubectlgetnodes# List the machines
kubectlgetnamespaces# List the namespaces
kubectlgetpods-A# List all the Pods
kubectlgetdeployments-A# List all the Deployments
kubectlgetservices-A# List all the Services
Knowledge check
Eight questions to check that each object has found its place: who runs, who recreates, who keeps the stable address, and what sets a Node apart from a Pod.
Knowledge check
Check what you have learned with this interactive quiz
8 questions
8 min
70% to pass
How it works
The timer starts when you click Start
Multiple choice, true/false and short answer questions
You can move between questions
Detailed results are shown at the end
Starts the quiz and the timer
⏱️--:--
0 / 8
Review
(0/0)
--:--
0%
0Correct
0To review
0:00Time
-Level
Score by domain
A domain groups several guides and gets several questions, so its score is more reliable than a per-topic score, which often rests on a single question.
Summary
Strengths
No topic passed at 80% on at least two questions yet.