我正在尝试安装具有 2 个节点的 kubernetes 集群(v1.7.2)。并使用 weave 作为 cni。加入另一个节点时,kubeadm 抱怨主机名
[root@ctdpc001572 ~]# kubeadm join --token c5ba8a.6bcb25f017648271 10.41.30.50:6443
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[preflight] Running pre-flight checks
[preflight] WARNING: hostname "" could not be reached
[preflight] WARNING: hostname "" lookup : no such host
[preflight] Some fatal errors occurred:
hostname "" a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
[preflight] If you know what you are doing, you can skip pre-flight checks with `--skip-preflight-checks`
我正在使用centos 7.3
Linux ctdpc001572.ctd.internal.com 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
安装的 yum 包
Loaded plugins: fastestmirror, langpacks, versionlock
Loading mirror speeds from cached hostfile
Installed Packages
kubeadm.x86_64 1.7.2-0 @kubernetes
kubectl.x86_64 1.7.2-0 @kubernetes
kubelet.x86_64 1.7.2-0 @kubernetes
kubernetes-cni.x86_64 0.5.1-0 @kubernetes
Available Packages
kubernetes.x86_64 1.5.2-0.7.git269f928.el7 extras
kubernetes-client.x86_64 1.5.2-0.7.git269f928.el7 extras
kubernetes-master.x86_64 1.5.2-0.7.git269f928.el7 extras
kubernetes-node.x86_64 1.5.2-0.7.git269f928.el7 extras
kubernetes-unit-test.x86_64 1.5.2-0.7.git269f928.el7 extras
脚步:
$ yum install -y docker kubelet kubeadm kubectl kubernetes-cni
$ systemctl enable docker && systemctl start docker
$ systemctl enable kubelet && systemctl start kubelet
$ systemctl stop firewalld; systemctl disable firewalld
$ kubeadm init --apiserver-advertise-address=10.41.30.50
$ mkdir $HOME/.kube
$ cp /etc/kubernetes/admin.conf $HOME/.kube/config
#set IPALLOC_RANGE to 172.40.0.0/16 in https://git.io/weave-kube-1.6
$ kubectl apply -f weave-kube-1.6.yaml
#schedule pods on master
$ kubectl taint nodes --all node-role.kubernetes.io/master-
#disable access control
$ kubectl create clusterrolebinding permissive-binding \
--clusterrole=cluster-admin \
--user=admin \
--user=kubelet \
--group=system:serviceaccounts
# joining other node
$ kubeadm join --token c5ba8a.6bcb25f017648271 10.41.30.50:6443
跑步时
kubeadm join --token c5ba8a.6bcb25f017648271 10.41.30.50:6443 --skip-preflight-checks
我在 weave-kube pod 中看到以下错误:
2017/07/29 16:36:39 error contacting APIServer: Get https://10.96.0.1:443/api/v1/nodes: dial tcp 10.96.0.1:443: i/o timeout; trying with fallback: http://localhost:8080
2017/07/29 16:36:39 Could not get peers: Get http://localhost:8080/api/v1/nodes: dial tcp [::1]:8080: getsockopt: connection refused
Failed to get peers