<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          在華為云上安裝高可用 K8S + KubeSphere

          共 17899字,需瀏覽 36分鐘

           ·

          2021-09-03 21:15

          隨著多云多集群的場景越來越豐富,在各個云廠商環(huán)境部署 KubeSphere 的需求隨之升高。由于各云廠商的云資源使用規(guī)則和菜單導(dǎo)航欄各不相同,會使用戶花大量時間去排錯。為降低部署過程錯誤率,本教程使用華為云平臺部署一套高可用的 KubeSphere,希望可以幫助大家提高部署體驗。

          一、部署前期準(zhǔn)備

          所需環(huán)境的資源滿足以下條件即可:

          華為云產(chǎn)品數(shù)量用途
          ECS 云服務(wù)器6master、node
          VPC1可用區(qū)
          ELB2負(fù)載均衡
          安全組1出入口管控
          公網(wǎng) IP7外網(wǎng)訪問

          二、云平臺資源初始化

          1. 創(chuàng)建 VPC

          進(jìn)入到華為云控制,在左側(cè)列表選擇「虛擬私有云」,選擇「創(chuàng)建虛擬私有云」創(chuàng)建 VPC,配置如下圖:

          2. 創(chuàng)建安全組

          創(chuàng)建一個安全組,設(shè)置入方向的規(guī)則、關(guān)聯(lián)實例參考如下:

          3. 創(chuàng)建實例

          在網(wǎng)絡(luò)配置中,網(wǎng)絡(luò)選擇第一步創(chuàng)建的 VPC 和子網(wǎng)。在安全組中,選擇上一步創(chuàng)建的安全組。

          4. 創(chuàng)建負(fù)載均衡器(創(chuàng)建內(nèi)外兩個)

          內(nèi)網(wǎng) ELB

          外網(wǎng) ELB

          若集群需要配置公網(wǎng)訪問,則需要為外網(wǎng)負(fù)載均衡器配置一個公網(wǎng) IP 為所有節(jié)點添加后端監(jiān)聽器,監(jiān)聽端口為 80(測試使用 30880 端口,此處 80 端口也需要在安全組中開放)。

          后面配置文件 config.yaml 需要配置在前面創(chuàng)建的內(nèi)網(wǎng) SLB 分配的地址(VIP)

           controlPlaneEndpoint:
             domain: lb.kubesphere.local
             address: "192.168.0.205"
             port: "6443"

          部署 KubeSphere 平臺

          1. 下載 KK

          $ curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -

          2. 添加執(zhí)行權(quán)限

          $ chmod +x kk

          3. 使用 kubekey 部署

          $ ./kk create config --with-kubesphere v3.1.1 --with-kubernetes v1.17.9 -f master-HA.yaml

          4. 集群配置調(diào)整

          apiVersion: kubekey.kubesphere.io/v1alpha1
          kind: Cluster
          metadata:
            name: master-HA
          spec:
            hosts:
            - {name: master1, address: 192.168.1.10, internalAddress: 192.168.1.10, password: yourpassword} # Assume that the default port for SSH is 22, otherwise add the port number after the IP address as above
            - {name: master2, address: 192.168.1.11, internalAddress: 192.168.1.11, password: yourpassword} # Assume that the default port for SSH is 22, otherwise add the port number after the IP address as above
            - {name: master3, address: 192.168.1.12, internalAddress: 192.168.1.12, password: yourpassword} # Assume that the default port for SSH is 22, otherwise add the port number after the IP address as above
            - {name: node1, address:  192.168.1.13, internalAddress: 192.168.1.13, password: yourpassword} # Assume that the default port for SSH is 22, otherwise add the port number after the IP address as above
            - {name: node2, address: 192.168.1.14, internalAddress: 192.168.1.14, password: yourpassword} # Assume that the default port for SSH is 22SSH is 22, otherwise add the port number after the IP address as above
            - {name: node3, address: 192.168.1.15, internalAddress: 192.168.1.15, password: yourpassword} # Assume that the default port for SSH is 22, otherwise add the port number after the IP address as above
            roleGroups:
              etcd:
               - master[1:3]
              master:
               - master[1:3]
              worker:
               - node[1:3]
            controlPlaneEndpoint:
              domain: lb.kubesphere.local
              address: "192.168.1.8"
              port: "6443"
            kubernetes:
              version: v1.17.9
              imageRepo: kubesphere
              clusterName: cluster.local
              masqueradeAll: false  # masqueradeAll tells kube-proxy to SNAT everything if using the pure iptables proxy mode. [Default: false]
              maxPods: 110  # maxPods is the number of pods that can run on this Kubelet. [Default: 110]
              nodeCidrMaskSize: 24  # internal network node size allocation. This is the size allocated to each node on your network. [Default: 24]
              proxyMode: ipvs  # mode specifies which proxy mode to use. [Default: ipvs]
            network:
              plugin: calico
              calico:
                ipipMode: Always  # IPIP Mode to use for the IPv4 POOL created at start up. If set to a value other than Never, vxlanMode should be set to "Never". [Always | CrossSubnet | Never] [Default: Always]
                vxlanMode: Never  # VXLAN Mode to use for the IPv4 POOL created at start up. If set to a value other than Never, ipipMode should be set to "Never". [Always | CrossSubnet | Never] [Default: Never]
                vethMTU: 1440  # The maximum transmission unit (MTU) setting determines the largest packet size that can be transmitted through your network. [Default: 1440]
              kubePodsCIDR: 10.233.64.0/18
              kubeServiceCIDR: 10.233.0.0/18
            registry:
              registryMirrors: ["https://*.mirror.aliyuncs.com"] # # input your registryMirrors
              insecureRegistries: []
              privateRegistry: ""
            storage:
              defaultStorageClass: localVolume
              localVolume:
                storageClassName: local

          ---
          apiVersion: installer.kubesphere.io/v1alpha1
          kind: ClusterConfiguration
          metadata:
            name: ks-installer
            namespace: kubesphere-system
            labels:
              version: v3.1.1
          spec:
            local_registry: ""
            persistence:
              storageClass: ""
            authentication:
              jwtSecret: ""
            etcd:
              monitoring: true        # Whether to install etcd monitoring dashboard
              endpointIps: 192.168.1.10,192.168.1.11,192.168.1.12  # etcd cluster endpointIps
              port: 2379              # etcd port
              tlsEnable: true
            common:
              mysqlVolumeSize: 20Gi # MySQL PVC size
              minioVolumeSize: 20Gi # Minio PVC size
              etcdVolumeSize: 20Gi  # etcd PVC size
              openldapVolumeSize: 2Gi   # openldap PVC size
              redisVolumSize: 2Gi # Redis PVC size
              es:  # Storage backend for logging, tracing, events and auditing.
                elasticsearchMasterReplicas: 1   # total number of master nodes, it's not allowed to use even number
                elasticsearchDataReplicas: 1     # total number of data nodes
                elasticsearchMasterVolumeSize: 4Gi   # Volume size of Elasticsearch master nodes
                elasticsearchDataVolumeSize: 20Gi    # Volume size of Elasticsearch data nodes
                logMaxAge: 7                     # Log retention time in built-in Elasticsearch, it is 7 days by default.
                elkPrefix: logstash              # The string making up index names. The index name will be formatted as ks-<elk_prefix>-log
                # externalElasticsearchUrl:
                # externalElasticsearchPort:
            console:
              enableMultiLogin: false  # enable/disable multiple sing on, it allows an account can be used by different users at the same time.
              port: 30880
            alerting:                # Whether to install KubeSphere alerting system. It enables Users to customize alerting policies to send messages to receivers in time with different time intervals and alerting levels to choose from.
              enabled: true
            auditing:                # Whether to install KubeSphere audit log system. It provides a security-relevant chronological set of records,recording the sequence of activities happened in platform, initiated by different tenants.
              enabled: true
            devops:                  # Whether to install KubeSphere DevOps System. It provides out-of-box CI/CD system based on Jenkins, and automated workflow tools including Source-to-Image & Binary-to-Image
              enabled: true
              jenkinsMemoryLim: 2Gi      # Jenkins memory limit
              jenkinsMemoryReq: 1500Mi   # Jenkins memory request
              jenkinsVolumeSize: 8Gi     # Jenkins volume size
              jenkinsJavaOpts_Xms: 512m  # The following three fields are JVM parameters
              jenkinsJavaOpts_Xmx: 512m
              jenkinsJavaOpts_MaxRAM: 2g
            events:                  # Whether to install KubeSphere events system. It provides a graphical web console for Kubernetes Events exporting, filtering and alerting in multi-tenant Kubernetes clusters.
              enabled: true
            logging:                 # Whether to install KubeSphere logging system. Flexible logging functions are provided for log query, collection and management in a unified console. Additional log collectors can be added, such as Elasticsearch, Kafka and Fluentd.
              enabled: true
              logsidecarReplicas: 2
            metrics_server:                    # Whether to install metrics-server. IT enables HPA (Horizontal Pod Autoscaler).
              enabled: true
            monitoring:                        #
              prometheusReplicas: 1            # Prometheus replicas are responsible for monitoring different segments of data source and provide high availability as well.
              prometheusMemoryRequest: 400Mi   # Prometheus request memory
              prometheusVolumeSize: 20Gi       # Prometheus PVC size
              alertmanagerReplicas: 1          # AlertManager Replicas
            multicluster:
              clusterRole: none  # host | member | none  # You can install a solo cluster, or specify it as the role of host or member cluster
            networkpolicy:       # Network policies allow network isolation within the same cluster, which means firewalls can be set up between certain instances (Pods).
              enabled: true
            notification:        # It supports notification management in multi-tenant Kubernetes clusters. It allows you to set AlertManager as its sender, and receivers include Email, Wechat Work, and Slack.
              enabled: true
            openpitrix:          # Whether to install KubeSphere App Store. It provides an application store for Helm-based applications, and offer application lifecycle management
              enabled: true
            servicemesh:         # Whether to install KubeSphere Service Mesh (Istio-based). It provides fine-grained traffic management, observability and tracing, and offer visualization for traffic topology
              enabled: true

          5. 執(zhí)行命令創(chuàng)建集群

          # 指定配置文件創(chuàng)建集群
          $ ./kk create cluster --with-kubesphere v3.1.1 -f master-HA.yaml

          # 查看 KubeSphere 安裝日志  -- 直到出現(xiàn)控制臺的訪問地址和登錄帳戶
          $ kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
          #####################################################
          ###              Welcome to KubeSphere!           ###
          #####################################################

          Console: http://192.168.1.10:30880
          Account: admin
          Password: P@88w0rd

          NOTES:
            1. After you log into the console, please check the
               monitoring status of service components in
               the "Cluster Management". If any service is not
               ready, please wait patiently until all components
               are up and running.
            2. Please change the default password after login.

          #####################################################
          https://kubesphere.io             2020-08-28 01:25:54
          #####################################################

          訪問公網(wǎng) IP + Port,使用默認(rèn)帳戶密碼 (admin/P@88w0rd) 登錄,登錄成功后,點擊「平臺管理」 → 「集群管理」可看到組件列表和機(jī)器的詳細(xì)信息。在集群概述頁面中,可以看到如下圖所示的儀表板。

          瀏覽 159
          點贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  口爆AV| 啊啊啊国产 | 国产AV手机版 | 日韩精品网站 | 爱搞搞电影|