一、节点规划
使用两台虚拟机搭建K8S集群
归划如下
192.168.0.99 k8s-master
192.168.0.100 k8s-node1
两台主机修改主机名
二、服务规划
三、集群部署
1:master和node节点配置/etc/hosts配置
192.168.0.99 k8s-master
192.168.0.100 k8s-node2
master节点安装
2:安装etcd
yum -y install etcd
配置/etc/etcd/etcd.conf文件
systemctl start etcd
systemctl enable etcd
3:安装master服务
yum -y install kubernetes-master.x86_64
修改配置/etc/kubernetes/apiserver
/etc/kubernetes/config
启动服务
systemctl start kube-scheduler.service/systemctl enable kube-scheduler.service
systemctl start kube-controller-manager.service/systemctl enable kube-controller-manager.service
systemctl start kube-apiserver.service/systemctl enable kube-apiserver.service
安装kubelet
yum -y install kubernetes-node.x86_64
检查master集群状态
kubectl get componentstatus----查看组件状态
master节点安装完成
4:node节点服务安装
yum -y install kubernetes-node.x86_64 ------会自动安装依赖和docker
配置/etc/kubernetes/config(master的和node1不需要重复配置)
/etc/kubernetes/kubelet
systemctl start/enable kubelet.service
systemctl start/enable kube-proxy.service
5:检查node节点状态
ready为健康状态
删除节点操作kubectl delete node nodename