Difference pod and deployment

1k views Asked by At

I'm struggling to understand the difference between Deployments and Pods in Kubernetes.

A Deployment provides declarative updates for Pods and ReplicaSets.

Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.

It seems like kind:Pod can be used interchangeably kind: Deployment and deployments allow for Replica (which is pretty much the point of Kubernetes). Why would you ever use a Pod?

Can someone:

  • Explain the essential difference between Pods/Deployments +
  • Describe a use case where pods are preferable over deployments?
1

There are 1 answers

1
pb100 On BEST ANSWER

In short:

With Pods

  1. if it dies it dies. Period.
  2. you can define only one copy of particular pod. If you need to have X copies you have to define in YAML file(s) X pods
  3. usually you will never see pods created directly in production environments. Too unreliable. Why ? because of 1.

With Deployment

  1. you define desired state of a pod. If pod dies (for whatever reason) then deployment creates new pod.
  2. and more generic: you can define that you want to have X running replicas of the same pod. If one or more of them die(s) the Deployment creates new to match X