這篇文章主要為大家展示了“如何使用kubekey安裝kubesphere”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“如何使用kubekey安裝kubesphere”這篇文章吧。
成都創(chuàng)新互聯(lián)是一家專業(yè)提供鹽城企業(yè)網(wǎng)站建設(shè),專注與網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、HTML5建站、小程序制作等業(yè)務(wù)。10年已為鹽城眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)的建站公司優(yōu)惠進(jìn)行中。
下載 KubeKey
KubeKey 是新一代 Kubernetes 和 KubeSphere 安裝器,可幫助您以簡單、快速、靈活的方式安裝 Kubernetes 和 KubeSphere。
export KKZONE=cn curl -sfL https://get-kk.kubesphere.io | VERSION=v1.0.1 sh -
準(zhǔn)備鏡像
如果您想讓安裝加快或者您的機(jī)房沒有外網(wǎng),可以使用公司內(nèi)部的私有倉庫,預(yù)先把鏡像推送到私有倉庫中,我這里的倉庫使用harbor
下載離線安裝工具,我這里只是用這個(gè)腳本來下載和推送鏡像
curl -L -O https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/offline-installation-tool.sh curl -L -O https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/images-list.txt
拉取鏡像
./offline-installation-tool.sh -s -l images-list.txt -d ./kubesphere-images 在./kubesphere-images目錄下能看到以下壓縮包 # ll total 8606088 -rw-r--r-- 1 root root 454465957 Feb 2 15:37 csi-images.tar.gz -rw-r--r-- 1 root root 1231853258 Feb 2 15:33 example-images.tar.gz -rw-r--r-- 1 root root 445244294 Feb 2 14:50 istio-images.tar.gz -rw-r--r-- 1 root root 762326634 Feb 2 14:27 k8s-images.tar.gz -rw-r--r-- 1 root root 1297767607 Feb 2 14:40 ks-core-images.tar.gz -rw-r--r-- 1 root root 3439146357 Feb 2 15:19 ks-devops-images.tar.gz -rw-r--r-- 1 root root 733165078 Feb 2 14:46 ks-logging-images.tar.gz -rw-r--r-- 1 root root 448651153 Feb 2 15:23 openpitrix-images.tar.gz
推送鏡像到私有倉庫,待腳本完成即可
./offline-installation-tool.sh -l images-list.txt -d ./kubesphere-images -r hub.evbj.easou.com
創(chuàng)建多節(jié)點(diǎn)集群
您可用使用 KubeKey 同時(shí)安裝 Kubernetes 和 KubeSphere,通過自定義配置文件中的參數(shù)創(chuàng)建多節(jié)點(diǎn)集群。
創(chuàng)建安裝有 KubeSphere 的 Kubernetes 集群(例如 --with-kubesphere v3.0.0)
./kk create config --with-kubernetes v1.17.9 --with-kubesphere v3.0.0
系統(tǒng)將創(chuàng)建默認(rèn)的 config-sample.yaml 文件。您可以根據(jù)您的環(huán)境修改此文件。
apiVersion: kubekey.kubesphere.io/v1alpha1 kind: Cluster metadata: name: ESCloud spec: hosts: - {name: kubesphere001, address: 10.26.31.34, internalAddress: 10.26.31.34, privateKeyPath: "~/.ssh/id_dsa", port: 20755} - {name: kubesphere002, address: 10.26.31.36, internalAddress: 10.26.31.36, privateKeyPath: "~/.ssh/id_dsa", port: 20755} - {name: kubesphere003, address: 10.26.31.42, internalAddress: 10.26.31.42, privateKeyPath: "~/.ssh/id_dsa", port: 20755} - {name: kubesphere004, address: 10.26.31.46, internalAddress: 10.26.31.46, privateKeyPath: "~/.ssh/id_dsa", port: 20755} - {name: kubesphere005, address: 10.26.31.118, internalAddress: 10.26.31.118, privateKeyPath: "~/.ssh/id_dsa", port: 20755} - {name: kubesphere006, address: 10.26.31.119, internalAddress: 10.26.31.119, privateKeyPath: "~/.ssh/id_dsa", port: 20755} - {name: kubesphere007, address: 10.26.31.120, internalAddress: 10.26.31.120, privateKeyPath: "~/.ssh/id_dsa", port: 20755} - {name: kubesphere008, address: 10.26.31.121, internalAddress: 10.26.31.121, privateKeyPath: "~/.ssh/id_dsa", port: 20755} roleGroups: etcd: - kubesphere001 - kubesphere002 - kubesphere003 master: - kubesphere001 - kubesphere002 - kubesphere003 worker: - kubesphere004 - kubesphere005 - kubesphere006 - kubesphere007 - kubesphere008 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: ["hub.kubeops.net"] privateRegistry: "hub.kubeops.net" addons: [] --- apiVersion: installer.kubesphere.io/v1alpha1 kind: ClusterConfiguration metadata: name: ks-installer namespace: kubesphere-system labels: version: v3.0.0 spec: local_registry: "hub.kubeops.net" persistence: storageClass: "" authentication: jwtSecret: "" etcd: monitoring: true endpointIps: localhost port: 2379 tlsEnable: true common: es: elasticsearchDataVolumeSize: 20Gi elasticsearchMasterVolumeSize: 4Gi elkPrefix: logstash logMaxAge: 7 MySQLVolumeSize: 20Gi minioVolumeSize: 20Gi etcdVolumeSize: 20Gi openldapVolumeSize: 2Gi redisVolumSize: 2Gi console: enableMultiLogin: true # enable/disable multi login port: 30880 alerting: enabled: false auditing: enabled: false devops: enabled: false jenkinsMemoryLim: 2Gi jenkinsMemoryReq: 1500Mi jenkinsVolumeSize: 8Gi jenkinsJavaOpts_Xms: 512m jenkinsJavaOpts_Xmx: 512m jenkinsJavaOpts_MaxRAM: 2g events: enabled: false ruler: enabled: true replicas: 2 logging: enabled: false logsidecarReplicas: 2 metrics_server: enabled: true monitoring: prometheusMemoryRequest: 400Mi prometheusVolumeSize: 20Gi multicluster: clusterRole: none # host | member | none networkpolicy: enabled: false notification: enabled: false openpitrix: enabled: false servicemesh: enabled: false
環(huán)境初始化
./kk init os -f config-sample.yaml INFO[14:04:19 CST] Init operating system INFO[14:04:20 CST] Start initializing kubesphere008 [10.26.31.121] node=10.26.31.121 INFO[14:04:20 CST] Start initializing kubesphere001 [10.26.31.34] node=10.26.31.34 INFO[14:04:20 CST] Start initializing kubesphere003 [10.26.31.42] node=10.26.31.42 INFO[14:04:20 CST] Start initializing kubesphere005 [10.26.31.118] node=10.26.31.118 INFO[14:04:20 CST] Start initializing kubesphere006 [10.26.31.119] node=10.26.31.119 INFO[14:04:20 CST] Start initializing kubesphere004 [10.26.31.46] node=10.26.31.46 INFO[14:04:20 CST] Start initializing kubesphere007 [10.26.31.120] node=10.26.31.120 INFO[14:04:20 CST] Start initializing kubesphere002 [10.26.31.36] node=10.26.31.36 INFO[14:06:34 CST] Complete initialization kubesphere005 [10.26.31.118] node=10.26.31.118 INFO[14:06:56 CST] Complete initialization kubesphere002 [10.26.31.36] node=10.26.31.36 INFO[14:07:04 CST] Complete initialization kubesphere006 [10.26.31.119] node=10.26.31.119 INFO[14:07:04 CST] Complete initialization kubesphere007 [10.26.31.120] node=10.26.31.120 INFO[14:07:07 CST] Complete initialization kubesphere003 [10.26.31.42] node=10.26.31.42 INFO[14:07:11 CST] Complete initialization kubesphere004 [10.26.31.46] node=10.26.31.46 INFO[14:08:23 CST] Complete initialization kubesphere001 [10.26.31.34] node=10.26.31.34 INFO[14:10:57 CST] Complete initialization kubesphere008 [10.26.31.121] node=10.26.31.121 INFO[14:10:57 CST] Init operating system successful.
部署
以上準(zhǔn)備工作完成且再次檢查配置文件無誤后,執(zhí)行安裝。
./kk create cluster -f config-sample.yaml +-------------------------+------+------+---------+----------+-------+-------+-----------+--------+------------+-------------+------------------+--------------+ | name | sudo | curl | openssl | ebtables | socat | ipset | conntrack | docker | nfs client | ceph client | glusterfs client | time | +-------------------------+------+------+---------+----------+-------+-------+-----------+--------+------------+-------------+------------------+--------------+ | kubesphere005 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | | kubesphere006 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | | kubesphere007 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | | kubesphere004 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | | kubesphere001 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | | kubesphere003 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | | kubesphere002 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | | kubesphere008 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | +-------------------------+------+------+---------+----------+-------+-------+-----------+--------+------------+-------------+------------------+--------------+ This is a simple check of your environment. Before installation, you should ensure that your machines meet all requirements specified at https://github.com/kubesphere/kubekey#requirements-and-recommendations Continue this installation? [yes/no]: yes INFO[14:17:25 CST] Downloading Installation Files INFO[14:17:25 CST] Downloading kubeadm ... ************************************************** ##################################################### ### Welcome to KubeSphere! ### ##################################################### Console: http://10.26.31.34:30880 Account: admin Password: P@88w0rd NOTES: 1. After logging 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 ready. 2. Please modify the default password after login. ##################################################### https://kubesphere.io 2021-02-05 15:47:21 #####################################################
至此kubesphere安裝成功,可以通過瀏覽器訪問http://10.26.31.34:30880 驗(yàn)證
驗(yàn)證
您可以使用默認(rèn)的帳戶和密碼 admin/P@88w0rd 登錄 KubeSphere 控制臺(tái)并開始使用 KubeSphere。請(qǐng)?jiān)诘卿浐笮薷哪J(rèn)密碼。
登錄后如下圖
以上是“如何使用kubekey安裝kubesphere”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!