简体   繁体   English

我使用kubernetes中的对象创建了Pod,但Pod的状态为“待处理”

[英]I created pods using objects in kubernetes but the pods have status “Pending”

I created pods using kubectl create -f file.yaml . 我使用kubectl create -f file.yaml Deployment successfully gets created but the status of the pods show Pending . 部署已成功创建,但Pod的状态显示为Pending I also have docker image available on my local repository for which I am creating the pod. 我在要为其创建Pod的本地存储库中也有docker映像。 I am not sure what the issue is. 我不确定是什么问题。

The yaml file is as follows. yaml文件如下。

yaml文件

Kubernetes version that I am running is 1.1.6. 我正在运行的Kubernetes版本是1.1.6。

Just from that information I cannot deduce what is wrong. 单凭这些信息,我无法推断出什么地方出了问题。 What I can write is how to help you address such issues. 我能写的是如何帮助您解决此类问题。 kubectl describe pod __name_of_your_pod__ kubectl describe delpoyment nginx_deployment What I think has happend you might have no cpu resources, no nodes or taints. kubectl describe pod __name_of_your_pod__ kubectl describe delpoyment nginx_deployment我认为发生了什么事,您可能没有cpu资源,节点或污点。

BTW 1.1.6 k8s is pretty old. BTW 1.1.6 k8s很老了。 Think about an upgrade. 考虑升级。

Run the following command to get the pods 运行以下命令以获取吊舱

kubectl get pods --all-namespaces

to find more info, run: 要查找更多信息,请运行:

kubectl describe po <you-pod-name>

you should be able to get more info from that output. 您应该能够从该输出中获取更多信息。 Mostly 1) image is still pulled 2) resources crunch or docker not running 通常是1)图像仍被拉出2)资源紧缩或docker未运行

but the error/info message should take you forward. 但错误/信息消息应带您前进。

You should be able to get more info from the pod logs. 您应该能够从Pod日志中获取更多信息。 For example ... 例如 ...

kubectl logs --tail=100 nginx-deployment

More information in the kubectl docs kubectl文档中的更多信息

Alternatively, you can open a console session, and troubleshoot from within the container itself. 或者,您可以打开控制台会话,然后从容器本身进行故障排除。

kubectl get pods   # To get actual pod name
kubectl exec -it <POD_NAME>    

Another thing you can try is running your container outside of Kubernetes(using docker run -p 80:80 nginx-deployment ) just to ensure that your app is running correctly, and responding etc. 您可以尝试的另一件事是在Kubernetes外部运行容器(使用docker docker run -p 80:80 nginx-deployment )只是为了确保您的应用程序正确运行,并进行响应等。

You can also try running kubectl describe nodes . 您也可以尝试运行kubectl describe nodes This might give you more info to troubleshoot with. 这可能会为您提供更多信息以进行故障排除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM