华为鲲鹏ARM架构部署rancher及其服务
华为鲲鹏ARM架构部署 rancher及其服务
环境准备
安装docker
鲲鹏docker部署 www.huaweicloud/kunpeng/software/docker.html
centos-extra仓库必须处于“enabled”状态。这是操作系统默认配置,如果你已经设置成“disabled”,则需要重新设置。相关命令如下:
查询仓库状态:yum repolist all
例如:yum repolist all|grep "CentOS-7 - Extras"
设置为“enabled”状态:yum-config-manager --enable
例如: yum-config-manager --enable "CentOS-7 - Extras - mirrors.huaweicloud"
设置为“disabled”状态:yum-config-manager --disable
例如:yum-config-manager --disable "CentOS-7 - Extras - mirrors.huaweicloud"
CentOS操作系统
安装步骤
安装依赖包
执⾏以下命令安装依赖包。
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
执⾏安装
⽅式⼀:使⽤软件仓库安装
1. ⽼版本的docker的命名为“docker”或 “docker-engine”,如果安装了这些版本,需要先卸载掉。
保存在“/var/lib/docker/”中的内容,包括图⽚、磁盘和⽹络配置等都会保留下来。
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate
2. 配置软件仓库。
sudo yum-config-manager --add-repo download.docker/linux/po
3. 安装docker-ce。
这个命令总是会安装最新版本的docker-ce,如果需要安装指定版本的可以参考下⾯的操作:
sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
⽅式⼆:下载软件包进⾏安装
1. 通过download.docker/linux/centos/7/aarch64/stable/Packages/,下载指定版本的软件包。
2. 执⾏命令安装软件包及依赖。“package.rpm”为下载的软件包。
sudo yum install /path/to/package.rpm
启动软件
1. 启动Docker。
sudo systemctl start docker
设置⽇志⼤⼩
cat > /etc/docker/daemon.json << EOF
{
"registry-mirrors": ["089da2c63700258f0fbfc01626787020.huaweicloud"],
"log-driver":"json-file",
"log-opts":{
"max-size": "50m",
"max-file": "1"
}
}
EOF
重启docker
systemctl daemon-reload && systemctl restart docker && systemctl status docker
使⽤⼀个hello-world镜像验证Docker是否正常。
sudo docker run hello-world
回显内容如下:
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
3b4173355427: Pull complete
Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8 Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
\1. The Docker client contacted the Docker daemon.
\2. The Docker daemon pulled the “hello-world” image from the Docker Hub.
(arm64v8)
\3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
\4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
hub.docker/
安装docker-compose
鲲鹏dockers-compose安装 support.huaweicloud/prtg-kunpengmm/dockercompose_01_0001.html 安装步骤
获取软件包
获取“Docker Compose-1.22.0”安装包。
cd /usr/local/src
git clone github/ubiquiti/docker-compose-aarch64.git
华为linux系统下载安装
1. 进⼊docker-compose源⽂件⽬录。
cd /usr/local/src/docker-compose-aarch64
2. 配置Dockerfile。
vi Dockerfile
注释掉RUN [ “cross-build-start” ],即在之前加⼊‘#’后保存退出。
# Dockerfile to build docker-compose for aarch64
FROM arm64v8/python:3.6.5-stretch
# Add env
ENV LANG C.UTF-8
# Enable cross-build for aarch64
COPY ./vendor/qemu-bin /usr/bin/
#RUN [ "cross-build-start" ]
3. 安装docker-compose。
cd /usr/local/src/docker-compose-aarch64
docker build . -t docker-compose-aarch64-builder
运⾏和验证
1. 运⾏docker-compose容器。
docker run docker-compose-aarch64-builder
docker run docker-compose-aarch64-builder
2. 到⽣成的“docker-compose”可执⾏程序。
find / -name "docker-compose-Linux-aarch64"
[root@ecs-teukh-1 docker-compose-aarch64]# find / -name "docker-compose-Linux-aarch64"
/var/lib/docker/overlay2/1d8081e2d4b5958a1eccbaf76e949219c260d89236315b48cf0bfa95e076c1da/diff/build/dockercompose/docker-compose-Li nux-aarch64
/
var/lib/docker/overlay2/1d8081e2d4b5958a1eccbaf76e949219c260d89236315b48cf0bfa95e076c1da/diff/build/docker-compose-Linux-aarch64 /va r/lib/docker/volumes/9d6624e6fc53d37221774fed9c64cf1a4ce64319a221e1069c70b4c88df7be40/_data/docker-compose-Linux-aarch64
可以看到有三个⽬录存放了⽣成的“docker-compose-Linux-aarch64”可执⾏程序。
3. 进⼊任意⼀个⽬录。
cd /var/lib/docker/overlay2/1d8081e2d4b5958a1eccbaf76e949219c260d89236315b48cf0bfa95e076c1da/diff/build/dockercompose/
./docker-compose-Linux-aarch64 --version
[root@ecs-teukh-1 build]# ./docker-compose-Linux-aarch64 --version
docker-compose version 1.22.0, build e20d808e
4、任意⼀个⽬录做⼀个软链接
ln -s /var/lib/docker/volumes/81fc208240d41b4b5fee44713d9328246bf46d9d6dd1cf689eda1704fac43ee3/_data/docker-compose-Linux-aarch64 /u sr/local/bin/docker-compose
显⽰类似上述,表明docker-compose安装成功。
安装Rancher
华为安装rancher流程 bbs.huaweicloud/forum/thread-44773-1-1.html
安装步骤
运⾏下⾯的l
version: '2'
services:
magic-rancher:
image: rancher/rancher:v2.3.3-linux-arm64
container_name: magic-rancher
hostname: magic-rancher
restart: unless-stopped
ports:
- "8080:80"
- "8443:443"
volumes:
- /home/rancher/data:/var/lib/rancher/
- /home/rancher/auditlog:/var/log/auditlog
environment:
CATTLE_SYSTEM_CATALOG: bundled
AUDIT_LEVEL: 3
docker-compose up -d
NFS安装
安装
yum install -y nfs-common nfs-utils rpcbind
分配权限
mkdir /home/magic/nfsdata && chown -R nfsnobody:nfsnobody /home/magic/nfsdata && chmod 766 -R /home/magic/nfsdata 配置挂载
touch /etc/exports
cat > /etc/exports << EOF
/home/magic/nfsdata *(rw,no_root_squash,no_all_squash,sync)
EOF
启动
systemctl start rpcbind && systemctl start nfs && systemctl enable rpcbind && systemctl enable nfs
检查
showmount -e [ip]
# 返回结果,如下
# [root@rancher-server magic]
# showmount -e 192.168.0.92
# Export list for 192.168.0.92:
# /home/magic/nfsdata *
登录访问,设置密码
访问 192.168.0.92:8080
或者
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论