简体   繁体   English

kubernetes pod创建中

[英]kubernetes pod creation pending

I am using the fabric8.io java client for kubernetes to create and manage containers. 我正在使用fabric8.io Java客户端进行kubernetes创建和管理容器。 Although when a pod is created I get the following status 虽然在创建广告连播后,我会获得以下状态

{
  "kind": "Pod",
  "apiVersion": "v1",
  "metadata": {
    "name": "podName",
    "generateName": "podName-",
    "namespace": "podNameSpace",
    "selfLink": "",
    "uid": "d3d07626-825f-11e5-96f2-005056976c6f",
    "resourceVersion": "3158514",
    "creationTimestamp": "2015-11-03T19:19:39Z",
    "labels": {
      "name": ""
    },
    "annotations": {
      ""
    }
  },
  "spec": {
    "containers": [
      {
        "name": "",
        "image": "",
        "resources": {},
        "terminationMessagePath": "/dev/termination-log",
        "imagePullPolicy": "IfNotPresent"
      }
    ],
    "restartPolicy": "Always",
    "dnsPolicy": "ClusterFirst"
  },
  "status": {
    "phase": "Pending"
  }

When I try to read the logs for this pod using curl -X GET masterUrl/namespaces/namespace/pods/podName it doesnt return anything. 当我尝试使用curl -X GET masterUrl/namespaces/namespace/pods/podName读取此pod的日志时,它不返回任何内容。 How can I see the logs to see why the status is pending? 我如何查看日志以查看状态为何处于待处理状态?

You can get events from /api/v1/events and filter for items in that list with an involvedObject which matches the Pod (eg same uid). 您可以从/ api / v1 / events中获取事件,并使用与Pod相匹配的relatedObject(例如,相同的uid)过滤该列表中的项目。

Then sort the events by most recent lastTimestamp. 然后按最新的lastTimestamp对事件进行排序。 The reason, message, and source fields of the latest event should give you a hint about what is going on. 最新事件的原因,消息和源字段应为您提供提示有关发生的情况。

That's how it do it if I needed to do it from a java client. 如果我需要从Java客户端执行此操作,则将执行此操作。

If you just need to debug the current problem, it might be faster to just do kubectl describe pod podName , which also shows recent events for the pod. 如果您只需要调试当前问题, kubectl describe pod podName执行kubectl describe pod podName可能会更快,该操作还显示了pod的最近事件。

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

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