【问题标题】:Can not find out the leader over HTTP in "Simple leader election with Kubernetes"在“使用 Kubernetes 进行简单领导者选举”中无法通过 HTTP 找出领导者
【发布时间】:2019-09-12 08:44:34
【问题描述】:

我目前正在根据这个link做一些测试

在这一步之前一切正常: http://localhost:8001/api/v1/proxy/namespaces/default/pods/(leader-pod-name):4040/

访问此链接时收到错误消息:

kind    "Status"
apiVersion  "v1"
metadata    {}
status  "Failure"
message "pods \"leader-elector-5f456c7b49-4rdd6:4040\" not found"
reason  "NotFound"
details 
name    "leader-elector-5f456c7b49-4rdd6:4040"
kind    "pods"
code    404

格式有问题吗?

注意:当我访问 pod(通过 kubectl exec -it ...)并使用“curl localhost:4040”时,我可以获得 pod 领导者

【问题讨论】:

  • 运行 kubectl get pods 以检查您的 pod 是否运行。

标签: kubernetes


【解决方案1】:

只需使用此 URL:http://localhost:8001/api/v1/namespaces/default/pods/<leader-pod-name>:4040/proxy 即可通过 Kubernetes API 访问目标 Pod 上的代理端口。查找有用的教程here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-08
    • 1970-01-01
    • 2020-04-24
    • 2012-08-01
    • 1970-01-01
    • 2012-05-08
    • 2018-05-29
    • 1970-01-01
    相关资源
    最近更新 更多