Home  K8s   Deployment ...

Deployment and Pod kinds in k8s manifest file

In Kubernetes, "kind" refers to the type of resource being defined in a manifest file. The kind field specifies the type of object you are describing. Kinds Deployment and Pod, serve different purposes and have different use cases. Here are the differences:

Kind: Pod

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

Characteristics:

Example YAML:

apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  containers:
  - name: my-container
    image: nginx
    ports:
    - containerPort: 80

Use Case:

Kind: Deployment

A Deployment is a higher-level abstraction that manages a set of identical Pods (replica sets) to ensure the desired number of Pods are running and up-to-date.

Characteristics:

Example YAML:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: my-container
        image: nginx
        ports:
        - containerPort: 80

Use Case:

Key Differences:

FeaturePodDeployment
PurposeSingle instance of a running processManages multiple instances of Pods (replicas)
Self-HealingNoYes
UpdatesManualRolling updates, rollbacks
ScalabilityLimited, not inherently scalableEasily scalable by changing the replicas field
LifecycleEphemeral, manually managedEnsures the desired state, automatically manages Pods
Use CaseSimple, single-instance applications or scriptsScalable, highly available, and upgradable applications
Published on: Jul 03, 2024, 06:22 AM  
 

Comments

Add your comment