预制条件:
CentOS7,2GB RAM,2 CPU,Unique Host name and MAC address and proeuct_uuit, swap disabled
需要能直接访问外网,或者通过proxy访问外网(通过proxy需要treak来处理相应的proxy)
参考网站: https://kubernetes.io/docs/setup/independent/install-kubeadm/
每个机器要有不同的hostname,修改hostname
* 使用窗口界面,在安装centos的时候,打开Network设置,在这里设置
* 使用shell
* echo "192-168-1-189.node" > /etc/hostname
* echo "127.0.0.1 192-168-1-189.node" >> /etc/hosts
* sysctl kernel.hostname=192-168-1-189.node
所有的机器以root账户运行
* 为每个机器安装docker
* yum install -y docker
* 配置docker的group (可选?在我的实践中并没有进行这个配置,但是并没有出现问题)
cat << EOF > /etc/docker/daemon.json
{
“exec-opts”: [“native.cgroupdriver=systemd”]
}
EOF
systemctl enable docker && systemctl start docker
安装 kubeadm, kubelet 和 kubectl
- kubeadm the command to bootstrap the cluster
- kubelet the component that run on all of the machines in your cluster and does things like starting pods and containters
- kubectl the command line util to talk to your cluster
- 配置Kubernetes repo,为了能使用yum来安装kubenetes
cat < /etc/yum.repos.d/kubernetes.repo [kubernetes]
name=Kubernetes