Kubernetes叢集的詳細部署
阿新 • • 發佈:2018-12-11
一、叢集機器
linux-node1:192.168.56.11 ---master
部署的服務:
etcd
kube-apiserver
kube-controller-manager
kube-scheduler
linux-node2:192.168.56.12 ---node
部署的服務:
kubelet
kube-proxy
docker
linux-node3:192.168.56.13 ---node
部署的服務:
kubelet
kube-proxy
docker
二、環境準備
1、設定主機名 hostnamectl set-hostname linux-node1 hostnamectl set-hostname linux-node2 hostnamectl set-hostname linux-node3 ---------- 2、繫結主機host cat > /etc/hosts <<EOF 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.56.11 linux-node1 192.168.56.12 linux-node2 192.168.56.13 linux-node3 EOF 3、關閉防火牆和selinux systemctl disable firewalld systemctl stop firewalld #關閉selinux sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/sysconfig/selinux sed -i "s/SELINUXTYPE=targeted/SELINUXTYPE=disabled/g" /etc/sysconfig/selinux 4、其他配置 yum install -y ntpdate wget lrzsz vim net-tools #加入crontab 1 * * * * /usr/sbin/ntpdate ntp1.aliyun.com >/dev/null 2>&1 #vim /etc/profile 高亮顯示 export PS1="\[\e]0;\a\]\n\[\e[1;32m\]\[\e[1;33m\]\H\[\e[1;35m\]<\$(date +\"%Y-%m-%d %T\")> \[\e[32m\]\w\[\e[0m\]\n\u>\\$ " #設定時區 cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #SSH登入慢 sed -i "s/#UseDNS yes/UseDNS no/" /etc/ssh/sshd_config sed -i "s/GSSAPIAuthentication yes/GSSAPIAuthentication no/" /etc/ssh/sshd_config systemctl restart sshd.service
三、正式安裝
1.安裝Docker
第一步:使用國內Docker源
cd /etc/yum.repos.d/
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
第二步:Docker安裝
yum install -y docker-ce
第三步:啟動後臺程序
systemctl start docker
2.準備部署目錄
mkdir -p /opt/kubernetes/{cfg,bin,ssl,log}
3.準備軟體包