Kubernetes 1.4 集群搭建(2)

➜ ~ kubeadm init --api-advertise-addresses=192.168.1.107 <master/tokens> generated token: "42354d.e1fb733ed0c9a932" <master/pki> created keys and certificates in "/etc/kubernetes/pki" <util/kubeconfig> created "/etc/kubernetes/kubelet.conf" <util/kubeconfig> created "/etc/kubernetes/admin.conf" <master/apiclient> created API client configuration <master/apiclient> created API client, waiting for the control plane to become ready <master/apiclient> all control plane components are healthy after 18.921781 seconds <master/apiclient> waiting for at least one node to register and become ready <master/apiclient> first node is ready after 2.014976 seconds <master/discovery> created essential addon: kube-discovery, waiting for it to become ready <master/discovery> kube-discovery is ready after 3.505092 seconds <master/addons> created essential addon: kube-proxy <master/addons> created essential addon: kube-dns Kubernetes master initialised successfully! You can now join any number of machines by running the following on each node: kubeadm join --token 42354d.e1fb733ed0c9a932 192.168.1.107

然后在子节点上使用 join 命令加入集群即可

kubeadm join --token 42354d.e1fb733ed0c9a932 192.168.1.107

最后稍等片刻在 master 上 get nodes 即可查看,如果想让 master 也运行 pod,只需在 master 上运行 kubectl taint nodes --all dedicated- 即可

➜ ~ kubectl get nodes NAME STATUS AGE master Ready 1m node1 Ready 1m node2 Ready 1m

2.5、创建 Pod 网络

创建好集群后,为了能让容器进行跨主机通讯还要部署 Pod 网络,这里使用官方推荐的 weave 方式,也可以采用 flannel,以下为 weave 示例

# 在 master 上执行 kubectl apply -f https://git.io/weave-kube

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/e2a31b6acdd22087c6eb7e674f406e5c.html