二进制安装K8S
阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区 (aliyun.com)阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区 (aliyun.com)
·
阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区 (aliyun.com)https://developer.aliyun.com/mirror/所有节点yum源更换为 ,按照aliyun给的容器里面的kubenetes源和docker源,当然最好把之前的centos源也换成aliyun的
所有节点安装docker
yum install -y docker
systemctl enable docker --now
安装etcd
yum install -y etcd
vim /etc/etcd/etcd.conf
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
第6行 监听地址为0.0.0.0
ETCD_ADVERTISE_CLIENT_URLS="http://etcd1:2379"
第21行 写自己的ip地址或hosts解析的域名
systemctl start etcd
启动etcd
ss -lntp | grep 2379
查看etcd端口是否启动成功
健康检查etcdctl -C http://10.0.0.11:2379 cluster-health
安装kubernetes-master
master节点安装kubernetes
yum install -y kubernetes-master
vim /etc/kubernetes/apiserver
8 KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
11 KUBE_API_PORT="--port=8080"
14 KUBELET_PORT="--kubelet-port=10250"
17 KUBE_ETCD_SERVERS="--etcd-servers=http://101.132.245.91:2379"
23 KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle ,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota "
vim /etc/kubernetes/config
22 KUBE_MASTER="--master=http://master:8080"
systemctl enable kube-apiserver --now
systemctl enable kube-controller-manager --now
systemctl enable kube-scheduler --now
Node节点安装kubernetes
yum install -y kubernetes-node
vim /etc/kubernetes/config
22 KUBE_MASTER="--master=http://master:8080"
指定master地址
vim /etc/kubernetes/kubelet
5 KUBELET_ADDRESS="--address=0.0.0.0"
8 KUBELET_PORT="--port=10250"
11 KUBELET_HOSTNAME="--hostname-override=node1"
14 KUBELET_API_SERVER="--api-servers=http://1.1.1.1:8080"
#apiserver的通信地址写master的ip
systemctl enable kubelet --now
systemctl enable kube-proxy --now
验证k8s集群
安装flanneld
所有节点 安装
yum install -y flannel
sed -i 's#http://127.0.0.1:2379#http://101.132.245.91:2379#g' /etc/sysconfig/flanneld
master节点
etcdctl mk /atomic.io/network/config '{ "Network": "172.16.0.0/16" }'
systemctl enable flanneld --now
systemctl enable kube-apiserver --now
systemctl enable kube-controller-manager --now
systemctl enable kube-scheduler --now
node节点
systemctl enable flanneld --now
systemctl enable docker --now
systemctl enable kubelet --now
systemctl enable kube-proxy --now
node之间的容器互通
iptables -P FORWARD ACCEPT
更多推荐
已为社区贡献11条内容
所有评论(0)