Kubernetes集群组件:
- etcd 一个高可用的K/V键值对存储和服务发现系统
- flannel 实现夸主机的容器网络的通信
- kube-apiserver 提供kubernetes集群的API调用
- kube-controller-manager 确保集群服务
- kube-scheduler 调度容器,分配到Node
- kubelet 在Node节点上按照配置文件中定义的容器规格启动容器
- kube-proxy 提供网络代理服务
集群示意图
Kubernetes工作模式server-client
Kubenetes Master提供集中化管理Minions
部署1台Kubernetes Master节点和2台Minion节点
image.png
1 时间同步
2 主机名解析
3 禁用selinux、防火墙
4 主机、角色
192.168.75.111 node1.fgq.com master
192.168.75.112 node2.fgq.com
192.168.75.113 node3.fgq.com
------------------------------------------------------------------------------
MASTER安装配置
master-node1
yum info etcd
yum info kubernetes-master
yum -y install kubernetes-master etcd
vim /etc/etcd/etcd.conf
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
vim /etc/kubernetes/apiserver
KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
KUBE_API_PORT="--port=8080"
KUBELET_PORT="--kubelet-port=10250"
启动etcd、kube-apiserver、kube-controller-manager、kube-scheduler等服务,并设置开机启动
for SERVICE in etcd kube-apiserver kube-controller-manager kube-scheduler;do systemctl restart $SERVICE;systemctl enable $SERVICE;systemctl status $SERVICE;done
在etcd中定义flannel网络
etcdctl mk /atomic.io/network/config '{"Network":"172.17.0.0/16"}'
------------------------------------------------------------------------------
MINION安装配置
node2-3
yum info flannel kubernetes-node
yum -y install flannel kubernetes-node
vim /etc/sysconfig/flanneld
FLANNEL_ETCD_ENDPOINTS="http://192.168.75.111:2379"
vim /etc/kubernetes/config
KUBE_MASTER="--master=http://192.168.75.111:8080"
node2
vim /etc/kubernetes/kubelet
KUBELET_ADDRESS="--address=0.0.0.0"
KUBELET_PORT="--port=10250"
KUBELET_HOSTNAME="--hostname-override=192.168.75.112"
KUBELET_API_SERVER="--api-servers=http://192.168.75.111:8080"
node3
vim /etc/kubernetes/kubelet
KUBELET_ADDRESS="--address=0.0.0.0"
KUBELET_PORT="--port=10250"
KUBELET_HOSTNAME="--hostname-override=192.168.75.113"
KUBELET_API_SERVER="--api-servers=http://192.168.75.111:8080"
node2-3
启动kube-proxy,kubelet,docker,flanneld等服务,并设置开机启动
for SERVICE in kube-proxy kubelet docker flanneld;do systemctl restart $SERVICE;systemctl enable $SERVICE;systemctl status $SERVICE;done
网友评论