What is the difference between a pod and a deployment?

后端 未结 8 547
一向
一向 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:15

    Kubernetes has three Object Types you should know about:

    • Pods - runs one or more closely related containers
    • Services - sets up networking in a Kubernetes cluster
    • Deployment - Maintains a set of identical pods, ensuring that they have the correct config and that the right number of them exist.

    Pods:

    • Runs a single set of containers
    • Good for one-off dev purposes
    • Rarely used directly in production

    Deployment:

    • Runs a set of identical pods
    • Monitors the state of each pod, updating as necessary
    • Good for dev
    • Good for production

    And I would agree with other answers, forget about Pods and just use Deployment. Why? Look at the second bullet point, it monitors the state of each pod, updating as necessary.

    So, instead of struggling with error messages such as this one:

    Forbidden: pod updates may not change fields other than spec.containers[*].image

    So just refactor or completely recreate your Pod into a Deployment that creates a pod to do what you need done. With Deployment you can change any piece of configuration you want to and you need not worry about seeing that error message.

提交回复
热议问题