Kubernetes:获取pod日志时,kubectl返回404找不到的内容

时间:2016-05-10 12:33:44

标签: kubernetes

我正在尝试从我的pod中获取日志,但由于kubectl describe pod运行良好,docker logs运行良好,但由于某些原因它无效。我在单个节点上手动安装了Kubernetes 1.2.3 Debian 8 x64

  $ kubectl logs -f web-backend-alzc1 --namespace=my-namespace --v=6
  round_trippers.go:286] GET http://localhost:8080/api 200 OK in 0 milliseconds
  round_trippers.go:286] GET http://localhost:8080/apis 200 OK in 0 milliseconds
  round_trippers.go:286] GET http://localhost:8080/api/v1/namespaces/my-namespace/pods/web-backend-alzc1 200 OK in 1 milliseconds
  round_trippers.go:286] GET http://localhost:8080/api 200 OK in 0 milliseconds
  round_trippers.go:286] GET http://localhost:8080/apis 200 OK in 0 milliseconds
  round_trippers.go:286] GET http://localhost:8080/api/v1/namespaces/my-namespace/pods/web-backend-alzc1/log?follow=true 404 Not Found in 1 milliseconds
  helpers.go:172] server response object: [{
    "metadata": {},
    "status": "Failure",
    "message": "the server could not find the requested resource ( pods/log web-backend-alzc1)",
    "reason": "NotFound",
    "details": {
      "name": "web-backend-alzc1",
      "kind": "pods/log"
    },
    "code": 404
  }]
  helpers.go:107] Error from server: the server could not find the requested resource ( pods/log web-backend-alzc1)

我是否应该在RC方案中描述为此pod启用日志?

我试图重新创建RC并查看journalctl,我看到这些消息:

  hyperkube[443]: I0510 12:14:13.754922     443 hairpin.go:51] Unable to find pair interface, setting up all interfaces: exec: "ethtool": executable file not found in $PATH
  hyperkube[443]: I0510 12:14:13.756866     443 provider.go:91] Refreshing cache for provider: *credentialprovider.defaultDockerConfigProvider
  hyperkube[435]: W0510 12:14:38.835863     435 request.go:344] Field selector: v1 - serviceaccounts - metadata.name - default: need to check if this is versioned correctly.

1 个答案:

答案 0 :(得分:1)

这是由--enable-debugging-handlers标志设置为false引起的,这会阻止kubelet附加到容器并获取日志。重新启动没有此标志的kubelet(默认为true)应修复它。