修改host文件
1 | cat <</etc/hosts>>EOF |
安装docker-ce
1 | sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo |
配置阿里云k8syum仓库
1 | cat <<EOF > /etc/yum.repos.d/kubernetes.repo |
初始化环境,升级内核
1 | systemctl disable --now firewalld NetworkManager |
安装IPVS
1 | yum install ipvsadm ipset sysstat conntrack libseccomp -y |
安装docker补全
1 | yum install -y epel-release bash-completion && cp /usr/share/bash-completion/completions/docker /etc/bash_completion.d/ |
安装k8s组件
1 | yum -y install kubeadm kubelet kubectl |
拉取k8s镜像
1 | kubeadm config images pull --config kubeadm-config.yaml |
kubeadm初始化
1 | kubeadm init --config kubeadm-config.yml |
copy master-1证书到 master-2 master-3
1 | USER=root |
安装calico
1 | curl -s https://zhangguanzhang.github.io/bash/pull.sh | bash -s -- quay.io/calico/node:v3.4.0 |
安装metrics-server
拉取yaml文件
1
2git clone https://github.com/kubernetes-incubator/metrics-server.git
vim deploy/1.8+/metrics-server-deployment.yaml增加 spec.template.spec.containers.command:
1
2
3
4
5command:
- /metrics-server
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP
imagePullPolicy: IfNotPresent ## 修改 imagePullPolicy: IfNotPresent 否咋镜像拉取不到拉取镜像
1
curl -s https://zhangguanzhang.github.io/bash/pull.sh | bash -s -- k8s.gcr.io/metrics-server-amd64:v0.3.1
创建metrics-server
1
kubectl create -f deploy/1.8+/