程序下载
ectd:
calico:
k8s
----------------------------------------------------------------------------------------------------------------------------
官方yaml文件
calico:
kube-dns
----------------------------------------------------------------------------------------------------------------------------
参考:
----------------------------------------------------------------------------------------------------------------------------
分布:
192.168.1.15 k8s-master-1 :
kube-apiserver
kube-controller-manager
kube-scheduler
kube-proxy
kubelet
calico
etcd
192.168.1.16 k8s-master-2
kube-apiserver
kube-controller-manager
kube-scheduler
kube-proxy
kubelet
calico
etcd
192.168.1.18 k8s-master-3
kube-apiserver
kube-controller-manager
kube-scheduler
kube-proxy
kubelet
calico
etcd
----------------------------------------------------------------------------------------------------------------------------
程序版本
etcd:3.3.1
----------------------------------------------------------------------------------------------------------------------------
执行主机:192.168.1.15and16and18
systemctl stop firewalld

systemctl disable firewalld

setenforce 0

sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config

echo "
> 192.168.1.15 k8s-master-1
> 192.168.1.16 k8s-master-2
> 192.168.1.18 k8s-master-3" >>/etc/hosts

ssh-keygen -t rsa

cat ~/.ssh/id_rsa.pub | ssh k8s-master-1 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh k8s-master-2 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh k8s-master-3 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

yum install docker vim wget gcc -y
----------------------------------------------------------------------------------------------------------------------------
执行主机:192.168.1.15and16and18
mkdir /root/cfssl
cd ~/cfssl
chmod +x cfssl_linux-amd64
sudo mv cfssl_linux-amd64 /usr/local/bin/cfssl
chmod +x cfssljson_linux-amd64
sudo mv cfssljson_linux-amd64 /usr/local/bin/cfssljson
chmod +x cfssl-certinfo_linux-amd64
sudo mv cfssl-certinfo_linux-amd64 /usr/local/bin/cfssl-certinfo

export PATH=/usr/local/bin:$PATH

增加内核参数
cat <<EOF > /etc/sysctl.d/k8s.conf
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF

modprobe br_netfilter
sysctl -p /etc/sysctl.d/k8s.conf


创建二进制程序目录结构
mkdir -p /root/kubernetes/server/bin/{node,master,etcd}
创建服务归类文件夹
mkdir -p /root/kubernetes/server/bin/{node-service,master-service,etcd-service,ssl}
----------------------------------------------------------------------------------------------------------------------------
执行主机:192.168.1.15and16and18
上传k8s程序包,解压

将程序拷贝到各自目录
cp /kubernetes/server/bin/kubelet /root/kubernetes/server/bin/node/
cp /kubernetes/server/bin/kube-* /root/kubernetes/server/bin/master/
cp /kubernetes/server/bin/kubectl /root/kubernetes/server/bin/master/
将etcd二进制文件放到/root/kubernetes/server/bin/etcd/

下发二进制命令到可执行目录
rsync -avzP /root/kubernetes/server/bin/node/ /usr/local/bin/
rsync -avzP /root/kubernetes/server/bin/master/ /usr/local/bin/
rsync -avzP /root/kubernetes/server/bin/etcd/ /usr/local/bin/
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐