ZBLOG

I want to restart the pod not the container

To restart a pod in Kubernetes, you can use the kubectl rollout command with the restart option. This will trigger a rolling update for the specified deployment or statefulset, causing all pods to be recreated with their latest configurations.

Here’s an example command to restart a deployment:

kubectl rollout restart deployment/<deployment-name>

And here’s an example command to restart a statefulset:

kubectl rollout restart statefulset/<statefulset-name>

Note that this method of restarting a pod will cause some downtime for your application as each pod is terminated and recreated. To minimize this disruption, you can use Kubernetes’ built-in rolling update strategy, which gradually replaces old pods with new ones instead of doing it all at once. To use this strategy, specify appropriate values for the maxSurge and maxUnavailable fields in your deployment or statefulset configuration.

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=4711

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?