根据在Container中本地运行Kubernetes的官方文档here - 我已仔细按照所有步骤操作,当我输入connection refused
时,我仍然收到消息kubectl get nodes
。
docker ps
显示 api-server 未运行,docker logs kubelet
确实会变化:
[kubelet.go:1137] Unable to register 127.0.0.1 with the apiserver: Post http://localhost:8080/api/v1/nodes: dial tcp 127.0.0.1:8080: connection refused.
过了一会儿,docker logs kubelet
E0711 16:07:06.814735 33792 event.go:202] Unable to write event: 'Post http://localhost:8080/api/v1/namespaces/default/events: dial tcp 127.0.0.1:8080: connection refused' (may retry after sleeping)
显然,我并不是唯一遇到这个问题的人。
更新:
几个小时后,docker logs kubelet
E0712 08:28:03.528010 33792 pod_workers.go:138] Error syncing pod 4c6ab43ac4ee970e1f563d76ab3d3ec9, skipping: [failed to "StartContainer" for "controller-manager" with CrashLoopBackOff: "Back-off 5m0s restarting failed container=controller-manager pod=k8s-master-127.0.0.1_default(4c6ab43ac4ee970e1f563d76ab3d3ec9)"
, failed to "StartContainer" for "apiserver" with CrashLoopBackOff: "Back-off 5m0s restarting failed container=apiserver pod=k8s-master-127.0.0.1_default(4c6ab43ac4ee970e1f563d76ab3d3ec9)"
, failed to "StartContainer" for "setup" with CrashLoopBackOff: "Back-off 5m0s restarting failed container=setup pod=k8s-master-127.0.0.1_default(4c6ab43ac4ee970e1f563d76ab3d3ec9)"
]
答案 0 :(得分:1)
The easiest way to run Kubernetes locally now is Minikube, though I'd expect the local docker method to still be functional.
Does docker ps -a
show any crashed kube-apiserver containers that might have any clues in their logs?