阿里巴巴开源镜像站-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文章来源:https://www.toymoban.com/news/detail-465941.html
安装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集群
文章来源地址https://www.toymoban.com/news/detail-465941.html
安装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
到了这里,关于二进制安装K8S的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!