ssh -p 9000 root@127.0.0.1
192.168.56.101 master-node 192.168.56.102 work-node1 192.168.56.103 work-node2
由于kubeadm 默认从官网k8s.grc.io下载所需镜像,国内无法访问,因此需要通过–image-repository指定阿里云镜像仓库地址。
kubeadm init --kubernetes-version=1.18.0
--apiserver-advertise-address=192.168.56.101
--image-repository registry.aliyuncs.com/google_containers
--service-cidr=10.10.0.0/16 --pod-network-cidr=192.168.0.0/16
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: https://kubernetes.io/docs/concepts/cluster-administration/addons/
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 192.168.56.101:6443 --token oxbgj6.ucnfimi2ncnq2w8g
--discovery-token-ca-cert-hash sha256:559382fa6170629e0f069bac59d69b41993bf729dcd0a52d3c5ba6f2df72cb77
网络组建使用calico 性能比 flannel 好一点, 头信息更小。
安装过程比较慢,要等一下
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
问题
k8s network: stat /var/lib/calico/nodename: no such file or directory
这些处理好之后我发现还是出现network: stat /var/lib/calico/nodename: no such file or directory 这个错误,这个时候就发现了
是calico 配置残留的问题,然后找到相关的calico 文件删除掉问题就解决了
需要删除 /var/lib/calico 这个目录 和 /etc/cni/net.d/ 这个目录下的calico 文件就行了
删除以后删除原有pod
问题
子节点报
The connection to the server localhost:8080 was refused - did you specify the right host or port?
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/ 官网
https://blog.csdn.net/hanbing6174/article/details/90092800
https://www.kubernetes.org.cn/7189.html
https://blog.csdn.net/fire_work/article/details/106193304
https://www.cnblogs.com/ssgeek/p/13194687.html
https://edgedef.com/2018/06/16/build-k8s-cluster-via-kubeadm-on-vbox-vms/
来源:oschina
链接:https://my.oschina.net/solate/blog/4486827