K8S集群搭建(一)

一、节点规划
使用两台虚拟机搭建K8S集群
归划如下
192.168.0.99 k8s-master
192.168.0.100 k8s-node1
两台主机修改主机名

二、服务规划


image.png

三、集群部署
1:master和node节点配置/etc/hosts配置
192.168.0.99 k8s-master
192.168.0.100 k8s-node2


image.png

master节点安装
2:安装etcd
yum -y install etcd


image.png

配置/etc/etcd/etcd.conf文件
systemctl start etcd
systemctl enable etcd
3:安装master服务
yum -y install kubernetes-master.x86_64
image.png

修改配置/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


image.png

安装kubelet
yum -y install kubernetes-node.x86_64
检查master集群状态
kubectl get componentstatus----查看组件状态
image.png

master节点安装完成

4:node节点服务安装
yum -y install kubernetes-node.x86_64 ------会自动安装依赖和docker

配置/etc/kubernetes/config(master的和node1不需要重复配置)
/etc/kubernetes/kubelet


image.png

systemctl start/enable kubelet.service
systemctl start/enable kube-proxy.service

5:检查node节点状态
ready为健康状态


image.png

删除节点操作kubectl delete node nodename

你可能感兴趣的:(K8S集群搭建(一))