Let`s say i deployed 5 pods(a deployment with 5 replica) and after a while a pod dies.The deployment controller will recreate a new pod?
Yes
You describe a desired state in a Deployment, and the Deployment Controller changes the actual state to the desired state at a controlled rate.
Best regards,
Xavi
If i just create a pod and not a deplyment then if that pod dies will not be created a new pod.This is because no controller control the state of this pod.true?
I would say “yes”, because there is no such thing a a “pod controller”; pods deployed directly are referred in the documentation as naked pods:
Don’t use naked Pods (that is, Pods not bound to a ReplicaSet or Deployment) if you can avoid it. Naked Pods will not be rescheduled in the event of a node failure.
From Configuration Best Practices | Kubernetes
P.S: As the notion of the “pod dying” may be open to interpretation, you may also take a look to Container restart policy:
The
restartPolicy
applies to all containers in the Pod.restartPolicy
only refers to restarts of the containers by the kubelet on the same node. After containers in a Pod exit, the kubelet restarts them with an exponential back-off delay […]
So even if there is no pod-controller, if one or more containers fail for some reason, they will be restarted by the kubelet according to the restartPolicy
defined in the pod spec.
Best regards,
Xavi