标签:状态 nbsp 创建 flannel 重启 component systemctl post set
yum源配置:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum update
etcd部署:
yum -y install etcd
修改etcd配置:
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_NAME="etcd-master"
ETCD_ADVERTISE_CLIENT_URLS="http://etcd-master:2379"
systemctl start etcd.service
systemctl enable etcd.service
kubernetes-master部署:
yum -y install kubernetes-master
修改master节点kubernetes-master配置:
apiserver:
KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
KUBE_API_PORT="--port=8080"
KUBELET_PORT="--kubelet-port=10250"
KUBE_ETCD_SERVERS="--etcd-servers=http://etcd-master:2379"
config配置:
KUBE_MASTER="--master=http://kube-master:8080"
启动apiserver、controller-manager、scheduler
systemctl start kube-apiserver.service
systemctl start kube-controller-manager.service
systemctl start kube-scheduler.service
systemctl enable kube-apiserver.service
systemctl enable kube-controller-manager.service
systemctl enable kube-scheduler.service
差看集群状态:
kubectl get componentstatus
kube-node节点部署:
yum -y install kubernetes-node
修改各节点kubelet配置文件:
KUBELET_ADDRESS="--address=192.168.56.201"
KUBELET_HOSTNAME="--hostname-override=kube-node01"
KUBELET_API_SERVER="--api-servers=http://kube-master:8080"
启动node节点:
systemctl start kubelet
systemctl enable kubelet
在master节点上查看各节点状态:
kubectl get nodes
网络插件flannel部署:
yum -y install flannel
配置flannel:
vim /etc/sysconfig/flanneld
FLANNEL_ETCD_ENDPOINTS="http://kube-master:2379"
设置网络信息:
etcdctl set /atomic.io/network/config ‘{ "Network": "172.16.0.0/16" }‘
启动flanneld:
systemctl start flanneld
systemctl enable flanneld
这时需要去重启各节点的docker服务是docker虚拟化出来的网卡信息与flanneld创建的网卡信息一致:
systemctl restart docker
同样配置其他两个node节点的flanneld并启动
此时创建容器还无法使不同网段之间的容器相互通信,还需要修改iptables的FORWARD规则为ACCEPT
iptables -P FORWARD ACCEPT
并将此操作加入到docker服务启动文件里:
ExecStartPost=/usr/bin/iptables -P FORWARD ACCEPT
并使其生效:
systectl daemon-reload
标签:状态 nbsp 创建 flannel 重启 component systemctl post set
原文地址:https://www.cnblogs.com/pitmaner/p/11443582.html