kubeadm 安装 k8s

安装kubeadm,国内镜像源

https://www.orchome.com/10036

Debian / Ubuntu

apt-get update && apt-get install -y apt-transport-https
curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add - 
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF  
apt-get update
apt-get install -y kubelet kubeadm kubectl

## 另外,你也可以指定版本安装
## apt-get install kubectl=1.19.3-00 kubelet=1.19.3-00 kubeadm=1.19.3-00

CentOS / RHEL / Fedora

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
setenforce 0
yum install -y kubelet kubeadm kubectl
systemctl enable kubelet && systemctl start kubelet
 
 
安装docker
yum install -y docker
 
配置docker工作目录到数据盘
rm -rf /var/lib/docker
mkdir /data/docker
ln -s /data/docker /var/lib/docker
 
开机自启动docker
systemctl enable docker.service
 
开始初始化安装
kubeadm init
 
[preflight] This might take a minute or two, depending on the speed of your internet connection
等待中
 
centos7 查看docker 系统日志
journalctl -u docker.service
 
此时看到报错:
May 08 18:04:07 HHY-k8s-1 dockerd-current[13978]: time="2021-05-08T18:04:07.527294422+08:00" level=warning msg="Error getting v2 registry: Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded
May 08 18:26:23 HHY-k8s-1 dockerd-current[13978]: time="2021-05-08T18:26:23.839516697+08:00" level=error msg="Attempting next endpoint for pull after error: Get https://k8s.gcr.io/v1/_ping: dial tcp 74.125.23.82:443: i/o timeout"
 
kubeadm init \
--kubernetes-version=v1.13.1 \
--pod-network-cidr=10.244.0.0/16 \
--service-cidr=10.96.0.0/12 \
--image-repository registry.aliyuncs.com/google_containers \
--apiserver-advertise-address=0.0.0.0 \
--ignore-preflight-errors=Swap
 
 
posted @ 2021-05-08 17:50  薛晓东  阅读(260)  评论(0编辑  收藏  举报