K8s Objects
Objects
Objects are sort of like blueprints. They provide detailed instructions to Kubernetes on how the applications must be set up and managed.
They are 11 different types of Kubernetes objects.
Pods
Pods are the fundamental building blocks of the Kubernetes system. They are used to deploy, scale, and manage containerized applications in a cluster.
A Pod can host a single container or a group of containers that need to "sit closer together".
One important characteristic of Pods is that they are ephemeral in nature.
This means that they are not guaranteed to have a long-term lifespan. They can be created, destroyed, and recreated at any time if required.
Deployments
Deployment object is used to manage the lifecycle of one or more identical Pods. A Deployment allows you to declaratively manage the desired state of your application, such as the number of replicas, the image to use for the Pods, and the resources required.
When you create a Deployment, you provide a Pod template, which defines the configuration of the Pods that the Deployment will manage.
It's important to note that Deployment objects are used to manage stateless applications. Stateless applications are those that do not maintain any persistent data or state.
ReplicaSets
In Kubernetes, Deployments don’t manage Pods directly. That’s the job of the ReplicaSet object.
When you create a Deployment in Kubernetes, a ReplicaSet is created automatically.
The ReplicaSet ensures that the desired number of replicas (copies) are running at all times by creating or deleting Pods as needed.
StatefulSets
A StatefulSet is a Kubernetes object that is used to manage stateful applications. The word "state" means any stored data that the application or component needs to do its work. This state is typically stored in a persistent storage backend, such as a disk, or a database.
The StatefulSet ensures that each Pod is uniquely identified by a number, starting at zero.
DaemonSets
A DaemonSet ensures that a copy of a Pod is running across all, or a subset of nodes in a Kubernetes cluster.
DaemonSets are useful for running system-level services, such as logging or monitoring agents, that need to run on every node in a cluster.
DaemonSets are managed by a reconciliation loop. A reconciliation loop is a mechanism that continuously checks and compares the desired state of a resource with the current state.
Persistent Volume
PersistentVolume represents a piece of storage that you can attach to your Pod(s).
The reason it's called "persistent" is because it's not tied to the life cycle of your Pod. In other words, even if your Pod gets deleted, the Persistent Volume will survive.
there are a lot of different types of storage that you can attach using a Persistent Volume, like local disks, network storage, and cloud storage.
Service
A Kubernetes Service is a way to access a group of Pods that provide the same functionality. It creates a single, consistent point of entry for clients to access the service, regardless of the location of the Pods.
To make it easier for clients to access the web application, you can create a Kubernetes Service that has a stable IP address.
One of the key benefits of using a Service is that it provides a stable endpoint that doesn't change even if the underlying Pods are recreated or replaced.
ConfigMap & Secrets
ConfigMaps and Secrets are two very important objects that allow you to configure the apps that run in your Pods.
ConfigMaps are used to store non-sensitive configuration values.
Secrets, on the other hand, are meant to hold sensitive configuration values.
ConfigMaps and Secrets can be injected into Pods with the help of environment variables, command-line arguments, or configuration files included in the volumes attached to those Pods.
Job
A job object is used to run specific tasks that have the following properties:
They are short-lived.
They need to be executed once.
But most importantly, Kubernetes has to make sure that the task has been executed correctly and finished its job.
Last updated