In the previous post we have covered the basic understanding of K8s, here we will look into the following
- Kubernetes basic terms and it’s definitions
- Kubernetes architecture and components
Kubernetes terms and it’s definitions
To begin understanding how to use K8s, we must understand the objects in the API. Basic K8s objects and several higher-level abstractions are known as controllers. These are the building block of your application lifecycle.
Basic objects include:
- Pod. A group of one or more containers.
- Service. An abstraction that defines a logical set of pods as well as the policy for accessing them.
- Volume. An abstraction that lets us persist data. (This is necessary because containers are ephemeral — meaning data is deleted when the container is deleted.)
- Namespace. A segment of the cluster dedicated to a certain purpose, for example a certain project or team of devs.
Controllers, or higher-level abstractions, include:
- ReplicaSet (RS). Ensures the desired amount of pod is what’s running.
- Deployment. Offers declarative updates for pods an RS.
- StatefulSet. A workload API object that manages stateful applications, such as databases.
- DaemonSet. Ensures that all or some worker nodes run a copy of a pod. This is useful for daemon applications like Fluentd, Prometheus.
- Job. Creates one or more pods, runs a certain task(s) to completion, then deletes the pod(s).
A specific part of a previously monolithic application. A traditional micro-service based architecture would have multiple services making up one, or more, end products. Micro services are typically shared between applications and makes the task of Continuous Integration and Continuous Delivery easier to manage.
Typically a docker container image — an executable image containing everything you need to run your application; application code, libraries, a runtime, environment variables and configuration files. At runtime, a container image becomes a container which runs everything that is packaged into that image.
A single or group of containers that share storage and network with a Kubernetes configuration, telling those containers how to behave. Pods share IP and port address space and can communicate with each other over localhost networking. Each pod is assigned an IP address on which it can be accessed by other pods within a cluster. Applications within a pod have access to shared volumes — helpful for when you need data to persist beyond the lifetime of a pod.
Namespaces are a way to create multiple virtual Kubernetes clusters within a single cluster. Namespaces are normally used for wide scale deployments where there are many users, teams and projects.
A Kubernetes replica set ensures that the specified number of pods in a replica set are running at all times. If one pod dies or crashes, the replica set configuration will ensure a new one is created in its place. You would normally use a Deployment to manage this in place of a Replica Set.
A way to define the desired state of pods or a replica set. Deployments are used to define HA policies to your containers by defining policies around how many of each container must be running at any one time.
Coupling of a set of pods to a policy by which to access them. Services are used to expose containerised applications to origins from outside the cluster.
A (normally) Virtual host(s) on which containers/pods are run.
Kubernetes architecture and components
A K8s cluster is made of a master node, which exposes the API, schedules deployments, and generally manages the cluster. Multiple worker nodes can be responsible for container runtime, like Docker or rkt, along with an agent that communicates with the master.
These master components comprise a master node:
- Kube-apiserver. Exposes the API.
- Etcd. Key value stores all cluster data. (Can be run on the same server as a master node or on a dedicated cluster.)
- Kube-scheduler. Schedules new pods on worker nodes.
- Kube-controller-manager. Runs the controllers.
- Kubelet. Agent that ensures containers in a pod are running.
- Kube-proxy. Keeps network rules and perform forwarding.
- Container runtime. Runs containers.
Stay tuned for our hands-on training session where we’ll dive into Kubernetes using minikube! You’ll learn how to deploy and manage containerized applications in a live environment. This session is perfect for those who want to gain a deeper understanding of how Kubernetes works and how to use it in real-world scenarios. Don’t miss out on this opportunity to gain valuable skills and knowledge!