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

1.安装docker

1.1 下载docker离线包

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

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

下载后上传至服务器解压

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

1.2 编写docker.service

vim docker.service

内容如下:

docker.service
  
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target

[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
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
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.service 移到 /etc/systemd/system/ 目录
cp docker.service /etc/systemd/system/
# 设置 docker.service 文件权限
chmod +x /etc/systemd/system/docker.service

# 重新加载配置文件
systemctl daemon-reload

# 启动docker
systemctl start docker

# 设置 docker 开机自启
systemctl enable docker.service

1.3 验证docker的安装

2.安装KubeShpere

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

生产后修改配置文件内容

apiVersion: kubekey.kubesphere.io/v1alpha1
kind: Cluster
metadata:
  name: sample
spec:
  hosts:
  # 注意指定节点 arch 为 arm64
  - {name: node1, address: 192.168.0.163, internalAddress: 192.168.0.163, password: 123456, arch: arm64}
  roleGroups:
    etcd:
    - node1
    master: 
    - node1
    worker:
    - node1
  controlPlaneEndpoint:
    domain: lb.kubesphere.local
    address: ""
    port: 6443
  kubernetes:
    version: v1.17.9
    imageRepo: kubesphere
    clusterName: cluster.local
  network:
    plugin: calico
    kubePodsCIDR: 10.233.64.0/18
    kubeServiceCIDR: 10.233.0.0/18
  registry:
    registryMirrors: []
    insecureRegistries: []
    privateRegistry: dockerhub.kubekey.local #添加此行
  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 将镜像导入之前准备的仓库中:

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

2.5 执行安装

# 以上准备工作完成且再次检查配置文件无误后,执行安装。
./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.遇到的问题

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

展开阅读全文

页面更新:2024-02-19

标签:麒麟   离线   鲲鹏   端口   仓库   机器   地址   服务器   文件   目录   内容   日志

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号

Top