if in production a pod has volume attached as permanent volume,if i recreate the pod then the data in volume is affected?
That depends on what kind of volume it is. If it is emptyDir the
volume will go away when the pod moves to a new machine. If it is
some networked block or filesystem, it should be fine.
if the pod is deleted then control plane will recreate this pod?
the best method to restart a pod?
If the pod is deleted it is deleted. A Deployment or replicaSet or DaemonSet or Stateful set is what would bring it back.
i like to know what is the best way to restart a pod.
kubectl rollout restart, for me it is the best way to restart an application but it doesn’t work with a single pod. You can delete the pod and it should be recreated by your controller as Tim said before.
kubectl rollout restart will restart the pod but there must be many pods.right?
to restart an container within a pod:
kubectl exec pod_name -c container kill -9 1.right?
We don’t have a generic way to tell a container, imperatively, “restart now”. What are you trying to do?
this is just to understand.if we have flannel then the traffic between container from a pod on a node and a container from a pod from other node will use the flannel that is on top of physical lan.right?
Correct – the pods should be able to communicate with each other cross node as long as the networking driver (in this case flannel) is working correctly.