Posts

Showing posts with the label pod

Pod scheduling-2: Pod Affinity and Node Affinity

Here in this post we will be exploring in deep dive on the Node Affinity. Node Affinity is more capable alternative to node lables and selector on the Kubernetes cluster. There are three types of affinities in Kubernetes Node affinity Pod affinity Pod anti-affinity Node Affinit y meaning that the pod should only be scheduled on target nodes with specific lables, this is basically what the node selector does for example only schedule the db-pod on the size=large Then, We have Pod affinity for dictates that the pod should only be scheduled on nodes where other specific pods are already running. For example cache pod  scheduled only on nodes where the webserver pods already running. In generic way we could say "Schedule Pod X  ' only on where ' Pod Y". Its like Indian girl marrying boy she stay with him! This way we can reduce the network latency between the two pods which need to communication(think about web pod connects with db pods). Finally, the Pod anti-affinity ...

Understanding the Kubernetes Pods

Image
Kubernetes pod  The Kubernetes pod is going to represent a running process on the Kubernetes cluster. It encapsulates an application container, storage resources, a unique network IP Address. Inside a pod, we can have one or more containers. The containers in a Pod are automatically co-located and co-scheduled on the same physical or virtual machine in the Kubernetes cluster. A Multi container pod is going to be very tightly coupled inside. The containers share access to their memory space. They can be connected to each other using localhost. That is if a web application running on a container can be accessed in a busybox container running in the same pod. Containers in the pod can share storage(volumes) disk space as well. What is a Pod in Kubernetes? A pod is an atomic unit of scheduling in the Kubernetes ecosystem. Pods are ephemeral they live in a short time span. On the master node, the different Controllers are running for monitoring and self-healing of the pods. Containers i...

Kubernetes DaemonSet (ds): Deploy Node-Level Agents Across Kubernetes Cluster

Image
Greetings of the day, dear Cloud Native enthusiasts! Imagine you are managing a Kubernetes cluster with 50 worker nodes and hundreds of microservices. Your applications are running successfully, but your operations team has several questions: Who collects CPU, memory, disk, and network metrics from every worker node? How do you collect container logs from all nodes? How do you deploy a security monitoring agent consistently across the cluster? When a new worker node joins the cluster, how do you ensure that the monitoring agent is installed automatically? What happens when a worker node is replaced during an infrastructure upgrade? You could manually deploy an agent on every node, but that approach quickly becomes difficult to maintain. This is exactly where Kubernetes DaemonSet becomes important. A DaemonSet automates the deployment of node-level services by ensuring that a copy of a specified Pod runs on every eligible node or a selected subset of nodes. ...

Kubernetes ReplicaSets - ReplicationController

Image
We have seen the word 'replicas' in the Docker Swarm services definition time. How to work with ReplicaSet?   What does ReplicaSet do? ReplicaSet will define the group of pods. You can tell how many replicas of pods for your application. The template section will define how many pods and their specification will be defined. Defining ReplicaSet allows you to deploy podand keep it alive as per configuration. How to create ReplicaSet? ReplicaSet relationship with Pod apiVersion: apps/v1 kind: ReplicaSet metadata: name: my-tcat-rs labels: version: "3.0" spec: replicas: 2 selector: matchLabels: project: MyWeb role: frontend template: metadata: labels: project: MyWeb role: frontend env: dev spec: conta...

Kubernetes StatefulSet: Deploy Stateful Applications with Persistent Volumes and NFS

Image
Hello DevOps enthusiasts! Greetings of the day, dear Orchestrators! In this post, we will explore one of the important Kubernetes workload controllers: StatefulSet (sts). We will understand how StatefulSets work, how they differ from Deployments, and how to integrate them with PersistentVolumes (PV) and PersistentVolumeClaims (PVC). Rather than just understanding the theory, we will perform a hands-on experiment by deploying four NGINX replicas, where each replica receives its own persistent storage backed by an NFS server. What is the purpose of a StatefulSet? A Pod is the smallest deployable unit in Kubernetes. Pods are ephemeral: they can be terminated, recreated, or scheduled on different worker nodes. The important distinction is that a Pod's writable container filesystem is not durable storage. If a container is recreated, data written only to its container filesystem can be lost. Consider applications such as: MySQL and PostgreSQL databases MongoDB replica sets Apa...