重新启动容器中的容器 [英] Restart container within pod

查看:108
本文介绍了重新启动容器中的容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个装有2个容器的豆荚test-1495806908-xn5jn.我想重新启动其中一个名为container-test的计算机.是否可以重新启动容器中的单个容器,以及如何重启?如果没有,如何重新启动Pod?

I have a pod test-1495806908-xn5jn with 2 containers. I'd like to restart one of them called container-test. Is it possible to restart a single container within a pod and how? If not, how do I restart the pod?

广告连播是使用deployment.yaml创建的,

The pod was created using a deployment.yaml with:

kubectl create -f deployment.yaml

推荐答案

是否可以重新启动单个容器

Is it possible to restart a single container

不能通过kubectl,尽管您可以根据集群的设置进行欺骗"和docker kill the-sha-goes-here,这将导致kubelet重新启动失败的"容器(当然,假设Pod的重新启动策略说那是应该做的)

Not through kubectl, although depending on the setup of your cluster you can "cheat" and docker kill the-sha-goes-here, which will cause kubelet to restart the "failed" container (assuming, of course, the restart policy for the Pod says that is what it should do)

我如何重新启动广告连播

how do I restart the pod

这取决于Pod的创建方式,但是根据您提供的Pod名称,它似乎在ReplicaSet的监督之下,因此您只需kubectl delete pod test-1495806908-xn5jn,kubernetes就会在其位置创建一个新的Pod.新的Pod将具有不同的名称,因此不要期望kubectl get pods再次返回test-1495806908-xn5jn)

That depends on how the Pod was created, but based on the Pod name you provided, it appears to be under the oversight of a ReplicaSet, so you can just kubectl delete pod test-1495806908-xn5jn and kubernetes will create a new one in its place (the new Pod will have a different name, so do not expect kubectl get pods to return test-1495806908-xn5jn ever again)

这篇关于重新启动容器中的容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆