银河麒麟鲲鹏aarch64架构安装docker和K8s

鲲鹏云服务器上安装docker-云社区-华为云 (huaweicloud.com)

[root@master ~]# cat /etc/os-release 
NAME="Kylin Linux Advanced Server"
VERSION="V10 (Tercel)"
ID="kylin"
VERSION_ID="V10"
PRETTY_NAME="Kylin Linux Advanced Server V10 (Tercel)"
ANSI_COLOR="0;31"
[root@master ~]# 

这里我下载的版本是docker-18.09.3.tag

wget -c https://download.docker.com/linux/static/stable/aarch64/docker-18.09.3.tgz

docker 安装包地址:https://download.docker.com/linux/static/stable

  • 解压,然后将docker目录下文件拷贝到/usr/bin里
tar -xf docker-18.09.3.tgz
mv docker/* /usr/bin/
  • 配置system服务
  • 在github对应分支的contrib/init/systemd/ 下面,提供了对应的docker.service以及docker.socket文件,可以直接拷贝到本地文件使用:

银河麒麟鲲鹏aarch64架构安装docker和K8s_第1张图片
对应链接:https://github.com/docker/engine/tree/19.03/contrib/init/systemd
新建编辑docker.service文件,将https://github.com/docker/engine/edit/19.03/contrib/init/systemd/docker.service这个链接内容拷贝并保存:

vi /lib/systemd/system/docker.service
###
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service
Wants=network-online.target
Requires=docker.socket

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd://
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target
###

新建编辑docker.socket文件,将https://github.com/docker/engine/blob/19.03/contrib/init/systemd/docker.socket这个链接内容拷贝并保存:

vi /lib/systemd/system/docker.socket
###
[Unit]
Description=Docker Socket for the API
PartOf=docker.service

[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker

[Install]
WantedBy=sockets.target
###
  • 新建docker用户和组
groupadd docker 
useradd docker -g docker 
  • 启动docker服务
systemctl daemon-reload
systemtl start docker 
  • 查看docker版本
docker version

银河麒麟鲲鹏aarch64架构安装docker和K8s_第2张图片

在银河麒麟操作系统安装k8s又让我老烦了,在网上各种查询网络源,最后还是在华为云上找到了解决办法
网址链接:https://bbs.huaweicloud.com/forum/forum.php?mod=viewthread&tid=84043&ordertype=2&page=1

注意:这里需要注意docker和K8s的版本兼容问题,这里我的k8s版本1.18.2的

添加网络源
vi /etc/yum.repos.d/kubernetes.repo 

[kubernetes]

name=Kubernetes Repo 

baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-aarch64/ 

gpgcheck=0 

gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg

enabled=1
  • 安装k8s
 yum install -y kubelet-1.18.2 kubeadm-1.18.2 kubectl-1.18.2
 systemctl enable kubelet && sudo systemctl start kubelet

初始化k8s添加集群

这里的v1.18.2是k8s安装的版本,这里我的版本是1.18.2,10.15.15.187这里是要初始化的主节点IP地址

sudo kubeadm init --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.18.2 --apiserver-advertise-address 10.15.15.187 --pod-network-cidr=10.244.0.0/16 --token-ttl 0

初始化完成之后会有node状态为NotReady需要下载网络插件就好了

下载calico网络插件
wget https://kuboard.cn/install-script/calico/calico-3.13.1.yaml
运行插件
kubectl apply -f calico-3.13.1.yaml

最后稍微等待一下,node状态就会变为Ready,如果始终没有Ready使用kubectl查看一下网络插件的pod状态和原因

查看所有pod的命令
kubectl -n kube-system get pod
kubectl get pod --all-namespaces

你可能感兴趣的:(架构,docker,容器)