What is the difference between a pod and a deployment?

后端 未结 8 545
一向
一向 2020-11-30 16:56

I have been creating pods with type:deployment but I see that some documentation uses type:pod, more specifically the documentation for multi-conta

8条回答
  •  死守一世寂寞
    2020-11-30 17:14

    I want to add some informations from Kubernetes In Action book, so you can see all picture and connect relation between Kubernetes resources like Pod, Deployment and ReplicationController(ReplicaSet)

    Pods

    are the basic deployable unit in Kubernetes. But in real-world use cases, you want your deployments to stay up and running automatically and remain healthy without any manual intervention. For this the recommended approach is to use a Deployment, which under the hood create a ReplicaSet.

    A ReplicaSet, as the name implies, is a set of replicas (Pods) maintained with their Revision history.

    (ReplicaSet extends an older object called ReplicationController -- which is exactly the same but without the Revision history.)

    A ReplicaSet constantly monitors the list of running pods and makes sure the running number of pods matching a certain specification always matches the desired number.

    Removing a pod from the scope of the ReplicationController comes in handy
    when you want to perform actions on a specific pod. For example, you might 
    have a bug that causes your pod to start behaving badly after a specific amount 
    of time or a specific event.
    

    A Deployment

    is a higher-level resource meant for deploying applications and updating them declaratively.

    When you create a Deployment, a ReplicaSet resource is created underneath (eventually more of them). ReplicaSets replicate and manage pods, as well. When using a Deployment, the actual pods are created and managed by the Deployment’s ReplicaSets, not by the Deployment directly

    Let’s think about what has happened. By changing the pod template in your Deployment resource, you’ve updated your app to a newer version—by changing a single field!

    Finally, Roll back a Deployment either to the previous revision or to any earlier revision so easy with Deployment resource.

    These images are from Kubernetes In Action book, too.

提交回复
热议问题