1 kubesphere对接华为云准备
1:网络规划
2:域名规划
3:资源规划
4:需申请公网IP
https://support.huaweicloud.com/cce
2 下载配置文件



cat <<EOF > /etc/yum.repos.d/kubernetes.repo[kubernetes]name=Kubernetesbaseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/enabled=1gpgcheck=1repo_gpgcheck=1gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpgEOF
上传并配置work节点config文件,使用kubectl命令行管理集群
cd /homechmod +x kubectlmv -f kubectl /usr/local/binmkdir -p $HOME/.kubemv -f kubeconfig.json $HOME/.kube/config
yum install kubectl-1.19.13-0 -yyum install bash-completion -y
source <(kubectl completion bash)echo "source <(kubectl completion bash)" >> ~/.bashrc
集群联通验证、需要集群管理员分配命名空间管理权限
kubectl config use-context internalkubectl cluster-info
[root@uat-cce-40364 ~]# kubectl config use-context internalSwitched to context "internal".You have new mail in /var/spool/mail/root[root@uat-cce-40364 ~]# kubectl cluster-infoKubernetes master is running at https://172.25.1.35:5443CoreDNS is running at https://172.25.1.35:5443/api/v1/namespaces/kube-system/services/coredns:dns/proxyTo further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.[root@uat-cce-40364 ~]#
3 新建存储配置文件
[root@cce-uat-48749-owct8 ~]# kubectl get scNAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGEcsi-disk everest-csi-provisioner Delete Immediate true 45hcsi-disk-topology everest-csi-provisioner Delete WaitForFirstConsumer true 45hcsi-nas everest-csi-provisioner Delete Immediate true 45hcsi-obs everest-csi-provisioner Delete Immediate false 45hcsi-sfsturbo everest-csi-provisioner Delete Immediate true 45hefs-performance flexvolume-huawei.com/fuxiefs Delete Immediate true 45hefs-standard flexvolume-huawei.com/fuxiefs Delete Immediate true 45hnfs-rw flexvolume-huawei.com/fuxinfs Delete Immediate true 45hobs-standard flexvolume-huawei.com/fuxiobs Delete Immediate false 45hobs-standard-ia flexvolume-huawei.com/fuxiobs Delete Immediate false 45hsas flexvolume-huawei.com/fuxivol Delete Immediate true 45hsata flexvolume-huawei.com/fuxivol Delete Immediate true 45hssd flexvolume-huawei.com/fuxivol Delete Immediate true 45h[root@cce-uat-48749-owct8 ~]#
csi-disk-sas.yaml
apiVersion: storage.k8s.io/v1kind: StorageClassmetadata:annotations:storageclass.kubernetes.io/is-default-class: "true"storageclass.kubesphere.io/support-snapshot: "false"name: csi-disk-sasparameters:csi.storage.k8s.io/csi-driver-name: disk.csi.everest.iocsi.storage.k8s.io/fstype: ext4everest.io/disk-volume-type: SASeverest.io/passthrough: "true"provisioner: everest-csi-provisionerallowVolumeExpansion: truereclaimPolicy: DeletevolumeBindingMode: Immediate
创建新存储配置
kubectl apply -f csi-disk-sas.yaml
[root@cce-uat-48749-owct8 home]# kubectl get storageclassNAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGEcsi-disk everest-csi-provisioner Delete Immediate true 45hcsi-disk-sas (default) everest-csi-provisioner Delete Immediate true 97scsi-disk-topology everest-csi-provisioner Delete WaitForFirstConsumer true 45hcsi-nas everest-csi-provisioner Delete Immediate true 45hcsi-obs everest-csi-provisioner Delete Immediate false 45hcsi-sfsturbo everest-csi-provisioner Delete Immediate true 45hefs-performance flexvolume-huawei.com/fuxiefs Delete Immediate true 45hefs-standard flexvolume-huawei.com/fuxiefs Delete Immediate true 45hnfs-rw flexvolume-huawei.com/fuxinfs Delete Immediate true 45hobs-standard flexvolume-huawei.com/fuxiobs Delete Immediate false 45hobs-standard-ia flexvolume-huawei.com/fuxiobs Delete Immediate false 45hsas flexvolume-huawei.com/fuxivol Delete Immediate true 45hsata flexvolume-huawei.com/fuxivol Delete Immediate true 45hssd flexvolume-huawei.com/fuxivol Delete Immediate true 45hYou have new mail in /var/spool/mail/root[root@cce-uat-48749-owct8 home]#
如果有取消需取消默认配置
kubectl patch storageclass sas -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
4 ks-installer 执行最小化部署
kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/kubesphere-installer.yamlkubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/cluster-configuration.yaml



查看安装日志
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
kubectl get svc/ks-console -n kubesphere-system
**************************************************Collecting installation results ...######################################################## Welcome to KubeSphere! ########################################################Console: http://172.25.1.46:30880Account: adminPassword: P@88w0rdNOTES:1. After you log into the console, please check themonitoring status of service components in"Cluster Management". If any service is notready, please wait patiently until all componentsare up and running.2. Please change the default password after login.#####################################################https://kubesphere.io 2021-07-08 10:25:34#####################################################

5 启用其他组件
自定义资源CRD
clusterconfiguration
kubectl -n kubesphere-system edit cc ks-installer
6 host集群接管
内网网络可到达前提下,使用直接对接模式


harbor通过内网方式同步到华为云镜像swr
https://support.huaweicloud.com/bestpractice-swr/swr_bestpractice_0004.html#toTop
报错1 :
校验失败Get "https://172.25.1.35:5443/version?timeout=10s": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
原因:网络不可达
7 参考链接
https://kubernetes.io/zh/docs/tasks/administer-cluster/change-default-storage-class
https://kubesphere.io/zh/docs/installing-on-kubernetes/hosted-kubernetes/install-kubesphere-on-huaweicloud-cce
https://v3-1.docs.kubesphere.io/zh/docs/multicluster-management/import-cloud-hosted-k8s/import-aliyun-ack
