共计 2341 个字符,预计需要花费 6 分钟才能阅读完成。
kubeadm 装置 k8s-1.18.18
资源筹备
角色 | 主机名 | ip | 零碎 |
---|---|---|---|
node | m8s-master01 | 192.168.219.162 | CentOS 7.9.2009 |
node | m8s-node02 | 192.168.219.165 | CentOS 7.9.2009 |
一、初始化资源
参考:https://segmentfault.com/a/11…
二、增加 node 节点
1、在 master 上生成新的 token
[root@k8s-master01 ~]# kubeadm token create --print-join-command --ttl=0
阐明:
–ttl= 0 代表工夫永不过期,不加此参数默认 24 小时过期
输入如下:
W0611 03:08:31.246969 63170 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
kubeadm join 192.168.219.160:6443 --token hkpvr9.bsfj9a6i7612vd59 --discovery-token-ca-cert-hash sha256:a8d537ee5d1a17e73ba94996744ccefd0d2f58f3871f29708e9c5642a28157b7
2、退出 node 节点
node 节点操作:
[root@k8s-node02 ~]# kubeadm join 192.168.219.160:6443 --token hkpvr9.bsfj9a6i7612vd59 --discovery-token-ca-cert-hash sha256:a8d537ee5d1a17e73ba94996744ccefd0d2f58f3871f29708e9c5642a28157b7
输入如下:
W0611 03:11:48.274867 3087 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set.
[preflight] Running pre-flight checks
[WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
[kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.18" ConfigMap in the kube-system namespace
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.
Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
阐明:
kubernetes node 节点退出容器 [ERROR FileContent–proc-sys-net-ipv4-ip_forward]: /proc/sys/net/ipv4/ip_forward contents are not set to 1
解决:
[root@k8s-node02 ~]# sysctl -w net.ipv4.ip_forward=1
3、验证
在 master 节点上执行
[root@k8s-master01 ~]# kubectl get node
输入如下:
NAME STATUS ROLES AGE VERSION
k8s-master01 Ready master 28h v1.18.18
k8s-node01 Ready <none> 28h v1.18.18
k8s-node02 Ready <none> 27m v1.18.18
三、增加 master 节点
1、在 master 上生成用于新 master 退出的证书
[root@k8s-master01 ~]# kubeadm init phase upload-certs --experimental-upload-certs
正文完
发表至: kubernetes
2021-06-11