Huawei kunpeng server installed K3S + Rancher
Huawei Server Kunpeng
Huawei Kunpeng server adopts ARMv8 CPU architecture developed by Huawei and provides Windows and multiple Linux systems. As a server, I have always used Centos system (can anyone really use Ubuntu for production environment? Won’t you? Really?) . CentOS 7.6 64bit with ARM Read my previous post
Install the docker
Use ali Cloud warehouse installation or directly use script installation
Repos. D/centos-base. Repo /etc/yom.repos. D/centos-base http://mirrors.aliyun.com/repo/Centos-altarch-7.repo - O/etc/yum. Repos. D/CentOS - Base. '# installation docker curl - fsSL https://get.docker.com | bash -s docker --mirror Aliyun sudo systemctl start docker sudo systemctl enable dockerCopy the code
Notice the Centos – altarch ali cloud warehouse address – this is the storehouse of arm64 https://get.docker.com script may not be able to download Can be replaced by https://get.daocloud.io/docker
Configuration mirror accelerator
You can use Aliyun. Huawei Cloud and DaoCloud use the same method to change registry-mirrors to the corresponding acceleration address
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["http://f1361db2.m.daocloud.io"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
Copy the code
Change a configuration
K3s check-config displays that user_namespace is disabled
grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)"
Copy the code
Takes effect after restart
Install the K3S script
export K3S_NODE_NAME=iot001
export INSTALL_K3S_EXEC="--docker --write-kubeconfig ~/.kube/config --write-kubeconfig-mode 666"
curl -sfL https://docs.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -
Copy the code
K3S_NODE_NAME specifies the system name itself, causing incompatibilities such as hyphens
Install an NFS client
Yum -y install nfs-utils systemctl start NFS && systemctl enable NFSCopy the code
Install the rancher
#rancher docker run -d -v /data/docker/rancher-server/var/lib/rancher/:/var/lib/rancher/ --restart=unless-stopped --name Rancher-server -p 9443:443 Rancher/Rancher :v2.4.2-linux-arm64 echo https://$(curl http://ip.cip.cc/):9443Copy the code
Rancher import k3s
See my previous article
Problems arising
- Docker, K3S, and Rancher all support ARM64, but rancher’s monitoring and app Store images are largely arm64-free
- Applications compressed with UPX will not run on arm64, nor will they run in Docker. It can be compressed with upX 3.96 (2020-01-23).
- Incompatibility: Redis,redis image supports ARM64, but CentOS page size 64KB, mainstream Linux page size 4KB, and then crashed during startup (CentOS down whoop). Solution: Pull Redis warehouse from kunpeng CentOS system to reconstruct the image (select Hong Kong machine to construct the specific reason we understand, if you need the compiled image, please send me a private message)
conclusion
- Kunpeng servers use a homegrown ARM64 CPU, but few applications have arm64 versions now that the x86 market is dominant. If you want to migrate to Kunpeng server for production tasks, you must make sure that the software you rely on has arm64 version
- At this stage, it is not recommended to use k3S + Rancher for business deployment in Kunpeng server, but k3S + customized configuration file can be used for business deployment alone. We recommend rancher to further optimize the ARM architecture and use it when the number of ARM architecture mirrors reaches a certain level in the application market
- Good golang solution