赞
踩
欲安装docker和k8s版本:
Kubernetes-1.22.10
Docker-20.10
root@firefly:~/k8s# cat /etc/hostname
firefly #唯一的用户名
root@firefly:~/k8s# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#我删掉了奇怪的 127.0.1.1
127.0.0.1 localhost
192.168.31.151 firefly
参考安装网址
第一步、卸载旧版本docker
sudo apt-get remove docker docker-engine docker.io containerd runc
第二步、更新及安装工具软件
1、更新系统里的所有的能更新的软件
sudo apt-get update
2、安装几个工具软件
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
3、增加一个docker的官方GPG key:
gpgkey:是用来验证软件的真伪 ——防伪的
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
4、下载仓库文件,注意修改为arch=arm64
echo \
"deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
第三步、安装docker,注意版本,需要和k8s版本搭配,
1、再次更新系统
sudo apt-get update
2、安装docker-ce软件,需要安装20.10的,其他版本不行
sudo apt-get install docker-ce=5:20.10.* docker-ce-cli=5:20.10.* containerd.io
第四步、测试运行一个docker容器
sudo docker run hello-world
第五步,有一部需要配置,不然后面安装k8s可能会报错
参考如下,参考,具体如下:
vim /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"]
}
重启docker
systemctl restart docker
添加证书
curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
添加apt源
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=1.22.10-00 kubeadm=1.22.10-00 kubectl=1.22.10-00
查看所需镜像
kubeadm config images list --kubernetes-version=v1.22.10
所需镜像如下所示:所需的镜像coredns是有v的
k8s.gcr.io/kube-apiserver:v1.22.10
k8s.gcr.io/kube-controller-manager:v1.22.10
k8s.gcr.io/kube-scheduler:v1.22.10
k8s.gcr.io/kube-proxy:v1.22.10
k8s.gcr.io/pause:3.5
k8s.gcr.io/etcd:3.5.0-0
k8s.gcr.io/coredns/coredns:v1.8.4
拉取国内镜像
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.22.10
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager:v1.22.10
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler:v1.22.10
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy:v1.22.10
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.5
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.5.0-0
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:1.8.4
然后更改名字
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.22.10 k8s.gcr.io/kube-apiserver:v1.22.10
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager:v1.22.10 k8s.gcr.io/kube-controller-manager:v1.22.10
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler:v1.22.10 k8s.gcr.io/kube-scheduler:v1.22.10
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy:v1.22.10 k8s.gcr.io/kube-proxy:v1.22.10
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.5 k8s.gcr.io/pause:3.5
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.5.0-0 k8s.gcr.io/etcd:3.5.0-0
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:1.8.4 k8s.gcr.io/coredns/coredns:v1.8.4
然后初始化,apiserver-advertise-address
可以改为自己的ip地址
kubeadm init --kubernetes-version=v1.22.10 --pod-network-cidr=10.244.0.0/16 --service-cidr=10.96.0.0/12 --ignore-preflight-errors=all --apiserver-advertise-address=192.168.31.151
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
安装网络组件
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
如果无法访问,就先下载下来,然后ssh传到rk3588中
等待几分钟,然后kubectl get node
即可
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。