銀河麒麟作為國家核高基專項的重要成果,國防版憑借其卓越的安全性和可靠性,已成為軍工領域的首選操作系統。之前我們在適配麒麟V4國防版的過程中已發現諸多安全性要求,而麒麟V10國防版在安全防護等級上又達到了更高的級別。
本文將主要演示離線部署,因為軍工項目基本不會出現聯網場景。即使在線,也可以按離線方式部署,且離線部署由于有私有倉庫,不會存在鏡像獲取不到和丟失情況。
環境涉及軟件版本信息
- 服務器芯片: 鯤鵬920/飛騰2500(arm64)
- 操作系統:銀河麒麟V10國防版
- Containerd: 1.7.13
- Kubernetes:v1.30.12
- KubeSphere:v3.4.1
- KubeKey: v3.1.10(二開版)
- Docker: 24.0.9
- DockerCompose: v2.26.1
- Harbor: v2.7.1
- Prometheus: v2.51.2
1.說明
作者使用k8s
和kubesphere
過程中已適配芯片和操作系統如下:
- CPU芯片:
- 鯤鵬
- 飛騰
- 海光
- 兆芯
- 國際芯片:interl、amd等
- 操作系統
- 銀河麒麟V10
- 麒麟國防版
- 麒麟信安
- 中標麒麟V7
- 統信 UOS
- 華為歐拉 openEuler、移動大云
- 阿里龍蜥 Anolis OS
- 騰訊 TencentOS
- 國際操作系統:centos、ubuntu、debian等
本文由 [編碼如寫詩-天行1st] 原創編寫,有任何問題可聯系我 [sd_zdhr] 獲取幫助。
關于我:
- 主要從事后端開發,兼具前端、運維及全棧工程師,熱愛
Golang
、Docker
、kubernetes
、KubeSphere
。 - 信創服務器
k8s
&KubeSphere
布道者、KubeSphere
離線部署布道者
關于kt
kt
是基于kk
二次開發的產物,具備kk
的所有功能,二開主要為適配信創國產化環境、簡化arm
部署過程和國產化環境離線部署。支持arm64
和amd64
架構國產操作系統,已適配芯片+操作系統 如上。
2 離線部署準備
2.1 將安裝包拷貝至離線環境
將下載的 kt、制品 artifact 、腳本文件等介質拷貝至master1主節點。
2.2 初始化操作系統
所有節點,上傳kt_arm.tar.gz 解壓后執行./kt init-os
。已適配操作系統和架構見1.說明
2.3 修改配置文件
主要修改相關節點和harbor信息
vi config-sample.yaml
kind: Cluster
metadata:name: sample
spec:hosts:- {name: node1, address: 192.168.0.45, internalAddress: 192.168.0.45, user: root, password: "123456",arch: "arm64"}roleGroups:etcd:- node1control-plane:- node1worker:- node1registry:- node1controlPlaneEndpoint:## Internal loadbalancer for apiservers # internalLoadbalancer: haproxydomain: lb.kubesphere.localaddress: ""port: 6443kubernetes:version: v1.30.12clusterName: cluster.localautoRenewCerts: truecontainerManager: dockeretcd:type: kubekeynetwork:plugin: flannelkubePodsCIDR: 10.233.64.0/18kubeServiceCIDR: 10.233.0.0/18## multus support. https://github.com/k8snetworkplumbingwg/multus-cnimultusCNI:enabled: falseregistry:type: harborregistryMirrors: []insecureRegistries: []privateRegistry: "dockerhub.kubekey.local"namespaceOverride: "kubesphereio"auths: # if docker add by `docker login`, if containerd append to `/etc/containerd/config.toml`"dockerhub.kubekey.local":username: "admin"password: Harbor@123 # 此處可自定義,kk3.1.8新特性skipTLSVerify: true # Allow contacting registries over HTTPS with failed TLS verification.plainHTTP: false # Allow contacting registries over HTTP.certsPath: "/etc/docker/certs.d/dockerhub.kubekey.local"addons: []---
2.4 創建鏡像倉庫
./kt init registry -f config-sample.yaml -a artifact-arm-k8s13012-ks413.tar.gz
可以看到使用了arm64
版本的harbor
2.5 創建harbor項目
說明:
Harbor 管理員賬號:admin,密碼:Harbor@123。密碼同步使用配置文件中的對應password
harbor 安裝文件在 <font style="background-color:rgb(255,245,235);">/opt/harbor</font>
目錄下,可在該目錄下對 harbor 進行運維。
vi create_project_harbor.sh
#!/usr/bin/env bashurl="https://dockerhub.kubekey.local" # 或修改為實際鏡像倉庫地址
user="admin"
passwd="Harbor@123"harbor_projects=(kskubespherekubesphereiogjing1st
)for project in "${harbor_projects[@]}"; doecho "creating $project"curl -u "${user}:${passwd}" -X POST -H "Content-Type: application/json" "${url}/api/v2.0/projects" -d "{ \"project_name\": \"${project}\", \"public\": true}" -k # 注意在 curl 命令末尾加上 -k
done
創建 Harbor 項目
chmod +x create_project_harbor.sh./create_project_harbor.sh
驗證
2.6 上傳ks3.4.1相關鏡像
tar zxf ks3.4.1-images.tar.gz
cd ks3.4.1-images && ./load-push.sh
3 安裝Kubernetes +KubeSphere
執行以下命令創建 Kubernetes 集群:
./kt create cluster -f config-sample.yaml -a artifact-arm-k8s13012-ks413.tar.gz --with-local-storage
等待大概兩分鐘左右看到k8s安裝完成,開始安裝ks
期間可以通過kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l 'app in (ks-install, ks-installer)' -o jsonpath='{.items[0].metadata.name}') -f
查看安裝進度
4 驗證
登錄頁面
初次登錄需要換密碼,如果不想換也可以繼續填寫P@88w0rd
,不過建議更換
首頁
節點:
監控
集群信息