Part2 :- Kubernetes Workload Objects

Part2 :- Kubernetes Workload Objects

In this post we will take a look at Workload Objects.

In Part 1?: We learnt What Kubernetes is and its physical infrastructure which a cluster of Control plane nodes and worker nodes

In Part 2: We will look at Workload objects and how it helps deploy and manage apps.



So at the highest level Kubernetes is an orchestrator of microservice apps.

Kubernetes provides several workload objects to define how applications run in a cluster. Each serves a specific purpose, ranging from stateless microservices to stateful databases and scheduled tasks.

Let’s go over each workload object in a greater detail.

1. Pod????

A Pod is the smallest and simplest deployable unit in Kubernetes. It represents a single instance of a running process in the cluster.

Key Features:

  • Can contain one or more containers that share storage, networking, and configuration.
  • Has a unique IP address within the cluster.
  • Containers in the same pod can communicate using localhost.
  • Managed by higher-level controllers like Deployments or StatefulSets.

Use Cases:

? Running a single application container (e.g., a simple web server). ? Running multiple containers that need to share resources (e.g., a web server and a sidecar for logging).

2. Deployment ??

A Deployment is a higher-level controller that manages the lifecycle of stateless applications by handling scaling, rolling updates, and rollbacks.

Key Features:

  • Uses a ReplicaSet to maintain a desired number of pod replicas.
  • Supports rolling updates and rollbacks in case of failures.
  • Ensures self-healing by restarting failed pods.

Use Cases:

? Running stateless applications (e.g., REST APIs, web services). ? Continuous deployment and rolling updates without downtime.

3. ReplicaSet ??

A ReplicaSet ensures that a specified number of identical pod replicas are running at all times.

Key Features:

  • Maintains a stable set of replicated pods.
  • Used internally by Deployments (not commonly managed directly).
  • If a pod crashes, the ReplicaSet replaces it.

Use Cases:

? Ensuring a fixed number of pod replicas are always running. ? Used in Deployments to manage pod scaling.

4. StatefulSet ??

A StatefulSet is used for applications that require persistent storage, unique network identities, and ordered deployments.

Key Features:

  • Pods have stable and unique network identities (e.g.,my-app 0, my-app 1)
  • Supports ordered pod creation and scaling (useful for databases).
  • Uses PersistentVolumeClaims (PVCs) to retain data across restarts.

Use Cases:

? Running databases (e.g., MySQL, PostgreSQL, MongoDB).

5. DaemonSet ???

A DaemonSet ensures that a specific pod runs on every node in the cluster.

Key Features:

  • Automatically deploys a pod to all nodes in the cluster.
  • Ensures pods run on new nodes when they join the cluster.
  • Used for monitoring, logging, and networking services.

Use Cases:

? Running node-level monitoring agents (e.g., Prometheus Node Exporter). ? Running logging daemons (e.g., Fluentd, Filebeat). ? Running network services (e.g., CNI plugins).

6. Job??

A Job is used for running one-time or short-lived batch tasks in Kubernetes.

Key Features:

  • Runs a pod to completion (unlike Deployments that keep pods running).
  • Retries failed tasks until completion.
  • Used for tasks like data processing or database migrations.

Use Cases:

? Data processing tasks (e.g., ETL jobs). ? Running a script once (e.g., database schema migrations).

7. CronJob??

A CronJob runs jobs at scheduled intervals, similar to a Linux cron job.

Key Features:

  • Uses cron expressions for scheduling (e.g., /5 *).
  • Ensures jobs run at specific times.
  • Useful for automated maintenance tasks.

Use Cases:

? Scheduled database backups. ? Sending periodic emails. ? Cleanup tasks (e.g., deleting old logs).

In conclusion, Workload objects allow you to deploy and manage apps. Depending on the use case and workloads you pick and choose various workloads objects.

Stay tuned in the next article we will go over Services in Kubernetes, What Services is, its types and use cases.


Madhuri Sharma

DevOps Lead @Telus Digital || 10K @LinkedIn || AWS || K8s || CICD || Terraform || DevOps || Service Mesh-Istio || Prometheus && Grafanna

3 周

Thanks Ajay Pandey Sir

回复
Ajay Pandey

Solution Architect @Telus Digital-|AWS| System Design| Solution Architecture |DevOps & Cloud | Kubernetes| CI/CD| Terraform| GCP| HA| Scalability| Reliability| Security | Cost Optimization | Disaster Recovery

3 周

Great Stuff Madhuri Sharma. Liked the diagram. One thing to call out Kubernetes is all about running and orchestrating containers and those containers run inside a Pod so you cannot deploy containers directly on kubernetes. It has to be wrapped inside a Pod becoz Pod is the smallest unit of deployment and scaling in K8s. Excited about how you unfold Services in Part 3. Keep going ! TELUS Digital

回复

要查看或添加评论,请登录

Madhuri Sharma的更多文章

  • Service Mesh?—?Istio

    Service Mesh?—?Istio

    In this Article we will take a look at what Services Mesh and what it offers. So let’s begin understanding first what…

    2 条评论
  • Kubernetes Service

    Kubernetes Service

    Part 3: Kubernetes Service In this article we will take a look at Kubernetes Service. Let’s go over it.

    3 条评论
  • Kubernetes :-Container Orchestration

    Kubernetes :-Container Orchestration

    Have you ever wondered what Kubernetes is, what it does and why it has become so popular nowadays. If the answer is NO…

    2 条评论
  • Containers vs Virtual Machines

    Containers vs Virtual Machines

    Have you ever been into a situation and find it difficult to differentiate between Containers & Virtual Machines. If…

    2 条评论

社区洞察

其他会员也浏览了