当前位置:   article > 正文

鲲鹏+麒麟v10安装KubeShpere(含k8s)_麒麟v10安装kubesphere

麒麟v10安装kubesphere

1.安装docker

1.1 下载docker离线包

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

进入aarch64目录,下载需要的docker版本

下载后上传至服务器解压

  1. tar -xvf docker-20.10.7.tgz
  2. # 将 docker 文件移动到 /usr/bin 目录下
  3. cp -p docker/* /usr/bin

1.2 编写docker.service

vim docker.service

内容如下:

  1. [Unit]
  2. Description=Docker Application Container Engine
  3. Documentation=https://docs.docker.com
  4. After=network-online.target firewalld.service
  5. Wants=network-online.target
  6. [Service]
  7. Type=notify
  8. # the default is not to use systemd for cgroups because the delegate issues still
  9. # exists and systemd currently does not support the cgroup feature set required
  10. # for containers run by docker
  11. ExecStart=/usr/bin/dockerd
  12. ExecReload=/bin/kill -s HUP $MAINPID
  13. # Having non-zero Limit*s causes performance problems due to accounting overhead
  14. # in the kernel. We recommend using cgroups to do container-local accounting.
  15. LimitNOFILE=infinity
  16. LimitNPROC=infinity
  17. LimitCORE=infinity
  18. # Uncomment TasksMax if your systemd version supports it.
  19. # Only systemd 226 and above support this version.
  20. #TasksMax=infinity
  21. TimeoutStartSec=0
  22. # set delegate yes so that systemd does not reset the cgroups of docker containers
  23. Delegate=yes
  24. # kill only the docker process, not all processes in the cgroup
  25. KillMode=process
  26. # restart the docker process if it exits prematurely
  27. Restart=on-failure
  28. StartLimitBurst=3
  29. StartLimitInterval=60s
  30. [Install]
  31. WantedBy=multi-user.target

添加到系统服务

  1. # 将 docker.service 移到 /etc/systemd/system/ 目录
  2. cp docker.service /etc/systemd/system/
  3. # 设置 docker.service 文件权限
  4. chmod +x /etc/systemd/system/docker.service
  5. # 重新加载配置文件
  6. systemctl daemon-reload
  7. # 启动docker
  8. systemctl start docker
  9. # 设置 docker 开机自启
  10. systemctl enable docker.service

1.3 验证docker的安装

2.安装KubeShpere

参考:三步搞定 ARM64 离线部署 Kubernetes + KubeSphere

2.1 下载离线包

curl -Ok https://kubesphere-installer.pek3b.qingstor.com/offline/v3.0.0/kubesphere-core-v3.0.0-offline-linux-arm64.tar.gz

2.2 创建配置文件

./kk create config

生产后修改配置文件内容

  1. apiVersion: kubekey.kubesphere.io/v1alpha1
  2. kind: Cluster
  3. metadata:
  4. name: sample
  5. spec:
  6. hosts:
  7. # 注意指定节点 arch 为 arm64
  8. - {name: node1, address: 192.168.0.163, internalAddress: 192.168.0.163, password: 123456, arch: arm64}
  9. roleGroups:
  10. etcd:
  11. - node1
  12. master:
  13. - node1
  14. worker:
  15. - node1
  16. controlPlaneEndpoint:
  17. domain: lb.kubesphere.local
  18. address: ""
  19. port: 6443
  20. kubernetes:
  21. version: v1.17.9
  22. imageRepo: kubesphere
  23. clusterName: cluster.local
  24. network:
  25. plugin: calico
  26. kubePodsCIDR: 10.233.64.0/18
  27. kubeServiceCIDR: 10.233.0.0/18
  28. registry:
  29. registryMirrors: []
  30. insecureRegistries: []
  31. privateRegistry: dockerhub.kubekey.local #添加此行
  32. addons: []

2.3 导入registry

解压后进入kubesphere-core-v3.0.0-offline-linux-arm64/kubesphere-images-v3.0.0目录

执行导入

docker load < registry.tar

创建测试用自签名镜像仓库:

./kk init os -f config-example.yaml --add-images-repo

注意:由 kk 启动的镜像仓库端口为443,请确保所有机器均可访问当前机器443端口

2.4 导入镜像

进入kubesphere-all-v3.0.0-offline-linux-arm64/kubesphere-images-v3.0.0 使用 offline-installation-tool.sh 将镜像导入之前准备的仓库中:

  1. # 脚本后镜像仓库地址请填写真实仓库地址
  2. ./offline-installation-tool.sh -l images-list-v3.0.0.txt -d kubesphere-images -r dockerhub.kubekey.local

2.5 执行安装

  1. # 以上准备工作完成且再次检查配置文件无误后,执行安装。
  2. ./kk create cluster -f config-sample.yaml --with-kubesphere

2.6 查看日志&验证

kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f

如果使用的云服务器,记得开放安全组30880端口

3.遇到的问题

  • 查看安装日志时提示:standard_init_linux.go:228: exec user process caused: exec format error

原因:config-sample.yaml中未添加 registry. dockerhub.kubekey.local 导致k8s安装过程中使用了x86架构的ks-install镜像。修改配置文件后,重新执行安装即可。

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号