【问题标题】:Kubernetes: kubectl returns 404 not found when fetch pod logsKubernetes:获取 pod 日志时 kubectl 返回 404 not found
【发布时间】:2016-05-11 15:34:25
【问题描述】:

我正在尝试从我的 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.

【问题讨论】:

  • 你是如何启动你的节点的?具体来说,您是否将 --enable-debugging-handlers 标志设置为 false?
  • 这是一个普通的EC2节点,我下载了hyperkube和kubectl的二进制文件,通过systemd启动了kubelet、proxy、controller、scheduler和apiserver。这个解决方案已经在不同的机器上运行了几个月,只是我以前从未尝试过记录
  • 对不起,我的意思是你用什么命令来启动 kubelet? (您是否禁用了--enable-debugging-handlers 标志?)
  • 哇!我已经在没有这个标志的情况下重新启动了 kubelet,它现在可以工作了!谢谢!

标签: kubernetes


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2016-03-16
    • 1970-01-01
    • 2021-12-27
    • 2021-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-11
    相关资源
    最近更新 更多