在Kubernetes中创建Pod时出错 [英] Error while creating pods in Kubernetes

查看:536
本文介绍了在Kubernetes中创建Pod时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照此处的说明在Kubernetes服务器中安装了Kubernetes.我正在尝试使用示例中列出的kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --hostport=8000 --port=8080创建容器.但是,当我执行kubectl get pod时,我得到的容器状态为pending.我进一步做了kubectl describe pod进行调试,然后看到以下消息:

I have installed Kubernetes in Ubuntu server using instructions here. I am trying to create pods using kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --hostport=8000 --port=8080 as listed in the example. However, when I do kubectl get pod I get the status of the container as pending. I further did kubectl describe pod for debugging and I see the message:

FailedScheduling pod (hello-minikube-3383150820-1r4f7) failed to fit in any node fit failure on node (minikubevm): PodFitsHostPorts.

我进一步尝试通过kubectl delete pod hello-minikube-3383150820-1r4f7删除此Pod,但是当我进一步执行kubectl get pod时,我看到了另一个尚未创建的带有前缀"hello-minikube-3383150820-"的Pod.有谁知道如何解决这个问题?预先谢谢你.

I am further trying to delete this pod by kubectl delete pod hello-minikube-3383150820-1r4f7 but when I further do kubectl get pod I see another pod with prefix "hello-minikube-3383150820-" that I havent created. Does anyone know how to fix this problem? Thank you in advance.

推荐答案

PodFitsHostPorts谓词失败,因为使用端口8000的节点上还有其他内容.您可以通过运行kubectl describe svc来查找其含义.

The PodFitsHostPorts predicate is failing because you have something else on your nodes using port 8000. You might be able to find what it is by running kubectl describe svc.

kubectl run创建一个deployment对象(您可以使用kubectl describe deployments看到它),以确保始终保持要运行的Pod副本的预期数量(在本例中为1).删除容器时,部署控制器会自动为您创建另一个.如果要删除部署及其持续创建的Pod,可以运行kubectl delete deployments hello-minikube.

kubectl run creates a deployment object (you can see it with kubectl describe deployments) which makes sure that you always keep the intended number of replicas of the pod running (in this case 1). When you delete the pod, the deployment controller automatically creates another for you. If you want to delete the deployment and the pods it keeps creating, you can run kubectl delete deployments hello-minikube.

这篇关于在Kubernetes中创建Pod时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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