尝试按照指南(http://kubernetes.io/v1.1/docs/getting-started-guides/docker-multinode.html#master-node)配置一个主节点 脚本master.sh运行成功,但api服务器无法启动。 软件版本:
K8S_VERSION=1.1.3
ETCD_VERSION=2.2.1
FLANNEL_VERSION=0.5.5
操作系统版本:
VERSION="2015.09"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2015.09"
PRETTY_NAME="Amazon Linux AMI 2015.09"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2015.09:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Docker:1.7.1
内核版本:
Linux ip-172-0-11-22 4.1.10-17.31.amzn1.x86_64 #1 SMP Sat Oct 24 01:31:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
kubelet的日志消息:
I0113 15:44:42.517777 7987 server.go:770] Started kubelet
E0113 15:44:42.517812 7987 kubelet.go:756] Image garbage collection failed: unable to find data for container /
E0113 15:44:42.518437 7987 event.go:197] 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)
I0113 15:44:42.518460 7987 server.go:89] Starting to listen read-only on 0.0.0.0:10255
I0113 15:44:42.518885 7987 server.go:72] Starting to listen on 0.0.0.0:10250
I0113 15:44:42.524222 7987 kubelet.go:777] Running in container "/kubelet"
I0113 15:44:42.696510 7987 factory.go:239] Registering Docker factory
I0113 15:44:42.698516 7987 factory.go:93] Registering Raw factory
I0113 15:44:42.698837 7987 kubelet.go:2300] Recording NodeHasSufficientDisk event message for node localhost
I0113 15:44:42.698862 7987 kubelet.go:2300] Recording NodeReady event message for node localhost
I0113 15:44:42.698871 7987 kubelet.go:869] Attempting to register node localhost
I0113 15:44:42.699523 7987 kubelet.go:872] Unable to register localhost with the apiserver: Post http://localhost:8080/api/v1/nodes: dial tcp 127.0.0.1:8080: connection refused
I0113 15:44:42.829361 7987 manager.go:1006] Started watching for new ooms in manager
I0113 15:44:42.830001 7987 oomparser.go:183] oomparser using systemd
I0113 15:44:42.842667 7987 manager.go:250] Starting recovery of all containers
I0113 15:44:42.868829 7987 manager.go:255] Recovery completed
I0113 15:44:42.880876 7987 container_manager_linux.go:215] Configure resource-only container /docker-daemon with memory limit: 2903034265
I0113 15:44:42.880910 7987 manager.go:104] Starting to sync pod status with apiserver
I0113 15:44:42.880963 7987 kubelet.go:1960] Starting kubelet main sync loop.
I0113 15:44:42.881004 7987 kubelet.go:2012] SyncLoop (ADD): "k8s-master-localhost_default"
E0113 15:44:42.881457 7987 kubelet.go:1915] error getting node: node 'localhost' is not in cache
E0113 15:44:42.884752 7987 kubelet.go:1356] Failed creating a mirror pod "k8s-master-localhost_default": Post http://localhost:8080/api/v1/namespaces/default/pods: dial tcp 127.0.0.1:8080: connection refused
E0113 15:44:42.884780 7987 kubelet.go:1361] Mirror pod not available
I0113 15:44:42.884839 7987 manager.go:1707] Need to restart pod infra container for "k8s-master-localhost_default" because it is not found
W0113 15:44:42.885688 7987 manager.go:108] Failed to updated pod status: error updating status for pod "k8s-master-localhost_default": Get http://localhost:8080/api/v1/namespaces/default/pods/k8s-master-localhost: dial tcp 127.0.0.1:8080: connection refused
I0113 15:44:42.900665 7987 kubelet.go:2300] Recording NodeHasSufficientDisk event message for node localhost
I0113 15:44:42.900693 7987 kubelet.go:2300] Recording NodeReady event message for node localhost
I0113 15:44:42.900751 7987 kubelet.go:869] Attempting to register node localhost
I0113 15:44:42.901194 7987 kubelet.go:872] Unable to register localhost with the apiserver: Post http://localhost:8080/api/v1/nodes: dial tcp 127.0.0.1:8080: connection refused
I0113 15:44:42.977270 7987 provider.go:91] Refreshing cache for provider: *credentialprovider.defaultDockerConfigProvider
I0113 15:44:42.977458 7987 docker.go:159] Pulling image gcr.io/google_containers/pause:0.8.0 without credentials
I0113 15:44:43.302487 7987 kubelet.go:2300] Recording NodeHasSufficientDisk event message for node localhost
I0113 15:44:43.302552 7987 kubelet.go:2300] Recording NodeReady event message for node localhost
答案 0 :(得分:1)
首先,我会升级到更新的Docker版本。
但我认为问题与你的kubelet配置有关。
参数--hostname-override允许您覆盖主机名。 我不是100%肯定,但我认为您的节点必须可以通过kube-api服务器上的主机名访问。如果api-server在另一个节点上,则localhost将不起作用。
有关详细信息,请参阅:http://kubernetes.io/v1.1/docs/admin/kubelet.html