本文介绍了如何删除孤立的 Kubernetes Pod的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过 Docker 运行 Kubernetes.按照教程,我使用 kubectl run nginx --image=nginx --port=80 启动了一个 Nginx POD.然而,这似乎创建了孤立的 POD(没有复制控制器).kubectl get rc 不返回任何内容并且 kubectl describe pod nginx-198147104-kqudh 显示 Replication Controllers: none(kubectl version "v1.2.0+5cb86ee" 显示 Controllers: ReplicaSet/nginx-198147104 但将其缩放为 0 只会导致创建一个新的 Nginx pod,并且无法删除.

I'm running Kubernetes via Docker. Following the tutorial I launched an Nginx POD using kubectl run nginx --image=nginx --port=80. However this seems to create orphaned PODs (without a replication controller). kubectl get rc doesn't return anything and kubectl describe pod nginx-198147104-kqudh shows Replication Controllers: none (kubectl version "v1.2.0+5cb86ee" shows Controllers: ReplicaSet/nginx-198147104 but scaling it to 0 just causes a new Nginx pod to be created, and it can't be deleted).

我希望能够从 Docker 中删除 Kubernetes 管理的 Nginx 容器.我没有太多运气知道如何删除孤立的 pod(没有重新创建它......).

I would like to be able to delete the Kubernetes managed Nginx container from Docker. I haven't had much luck find out how to delete an orphan pod (without it being recreated...).

客户端版本:version.Info{Major:"1", Minor:"0", GitVersion:"v1.0.4", GitCommit:"65d28d5fd12345592405714c81cd03b9c41d41d9", GitTreeState:"clean"}BR>服务器版本:version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.0", GitCommit:"5cb86ee022267586db386f62781338b0483733b3", GitTreeState:"clean"}

Client Version: version.Info{Major:"1", Minor:"0", GitVersion:"v1.0.4", GitCommit:"65d28d5fd12345592405714c81cd03b9c41d41d9", GitTreeState:"clean"}
Server Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.0", GitCommit:"5cb86ee022267586db386f62781338b0483733b3", GitTreeState:"clean"}

推荐答案

在 v1.2 Kubernetes 中,我们使用 ReplicaSet(一种较新的 ReplicationController 形式).鉴于您有一个 ReplicaSet,您必须使用 v1.2 客户端来创建它.但它并不止于此.1.2 实际上为您创建的是一个 Deployment,它本身管理 ReplicaSets.

With v1.2 Kubernetes we use ReplicaSet (a newer form of ReplicationController). Given that you have a ReplicaSet, you must have used a v1.2 client to create it. But it doesn't stop there. What 1.2 actually creates for you is a Deployment which itself manages ReplicaSets.

所以你需要知道的是kubectl scale deploymentkubectl delete deployment.

So what you need to know is kubectl scale deployment or kubectl delete deployment.

你在关注哪个教程?

这篇关于如何删除孤立的 Kubernetes Pod的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 22:12