分如下几个topic步骤:
各个节点的基本配置
master节点的构建
worker节点的构建
安装dashboard
安装ingress
常见命令
docker镜像惹的祸
各个节点的基本配置(以下命令每个节点都要执行:Master, Work1, Work2)
IP自己变化下,根据实际情况
systemctl stop firewalld && systemctl disable firewalld cat >>/etc/hosts<<EOF 10.8.1.1 k8s-master1 api.k8s.cn 10.8.1.2 k8s-slave1 10.8.1.3 k8s-slave2 EOF # 新建 iptable 配置修改文件 cat <<EOF > net.iptables.k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 EOF #关闭 swap 分区 sudo swapoff -a #防止开机自动挂载 swap 分区,注释掉配置 sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab #关闭 SELinux sudo setenforce 0 #防止开机启动开启,修改 SELINUX 配置 sudo sed -i s'/SELINUX=enforcing/SELINUX=disabled'/g /etc/selinux/config 配置 iptables sudo mv net.iptables.k8s.conf /etc/sysctl.d/ && sudo sysctl --system #yum增加阿里云针对kubernetes镜像 cat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg EOF yum update #安装 wget sudo yum install -y wget #安装docker yum install docker.x86_64 -y #安装k8s工具 yum install -y kubelet kubeadm kubectl #重启服务 systemctl enable kubelet && systemctl start kubelet