gtxyzz

使用kubekey安装kubesphere

gtxyzz 运维技术 2022-11-09 430浏览 0

使用kubekey安装kubesphere

下载 KubeKey

KubeKey 是新一代 Kubernetes 和 KubeSphere 安装器,可帮助您以简单、快速、灵活的方式安装 Kubernetes 和 KubeSphere。

exportKKZONE=cn
curl-sfLhttps://get-kk.kubesphere.io|VERSION=v1.0.1sh-

准备镜像

如果您想让安装加快或者您的机房没有外网,可以使用公司内部的私有仓库,预先把镜像推送到私有仓库中,我这里的仓库使用harbor

下载离线安装工具,我这里只是用这个脚本来下载和推送镜像

curl-L-Ohttps://github.com/kubesphere/ks-installer/releases/download/v3.0.0/offline-installation-tool.sh
curl-L-Ohttps://github.com/kubesphere/ks-installer/releases/download/v3.0.0/images-list.txt

拉取镜像

./offline-installation-tool.sh-s-limages-list.txt-d./kubesphere-images
在./kubesphere-images目录下能看到以下压缩包
#ll
total8606088
-rw-r--r--1rootroot454465957Feb215:37csi-images.tar.gz
-rw-r--r--1rootroot1231853258Feb215:33example-images.tar.gz
-rw-r--r--1rootroot445244294Feb214:50istio-images.tar.gz
-rw-r--r--1rootroot762326634Feb214:27k8s-images.tar.gz
-rw-r--r--1rootroot1297767607Feb214:40ks-core-images.tar.gz
-rw-r--r--1rootroot3439146357Feb215:19ks-devops-images.tar.gz
-rw-r--r--1rootroot733165078Feb214:46ks-logging-images.tar.gz
-rw-r--r--1rootroot448651153Feb215:23openpitrix-images.tar.gz

推送镜像到私有仓库,待脚本完成即可

./offline-installation-tool.sh-limages-list.txt-d./kubesphere-images-rhub.evbj.easou.com

创建多节点集群

您可用使用 KubeKey 同时安装 Kubernetes 和 KubeSphere,通过自定义配置文件中的参数创建多节点集群。

创建安装有 KubeSphere 的 Kubernetes 集群(例如 –with-kubesphere v3.0.0)

./kkcreateconfig--with-kubernetesv1.17.9--with-kubespherev3.0.0

系统将创建默认的 config-sample.yaml 文件。您可以根据您的环境修改此文件。

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/disablemultilogin
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

环境初始化

./kkinitos-fconfig-sample.yaml
INFO[14:04:19CST]Initoperatingsystem
INFO[14:04:20CST]Startinitializingkubesphere008[10.26.31.121]node=10.26.31.121
INFO[14:04:20CST]Startinitializingkubesphere001[10.26.31.34]node=10.26.31.34
INFO[14:04:20CST]Startinitializingkubesphere003[10.26.31.42]node=10.26.31.42
INFO[14:04:20CST]Startinitializingkubesphere005[10.26.31.118]node=10.26.31.118
INFO[14:04:20CST]Startinitializingkubesphere006[10.26.31.119]node=10.26.31.119
INFO[14:04:20CST]Startinitializingkubesphere004[10.26.31.46]node=10.26.31.46
INFO[14:04:20CST]Startinitializingkubesphere007[10.26.31.120]node=10.26.31.120
INFO[14:04:20CST]Startinitializingkubesphere002[10.26.31.36]node=10.26.31.36
INFO[14:06:34CST]Completeinitializationkubesphere005[10.26.31.118]node=10.26.31.118
INFO[14:06:56CST]Completeinitializationkubesphere002[10.26.31.36]node=10.26.31.36
INFO[14:07:04CST]Completeinitializationkubesphere006[10.26.31.119]node=10.26.31.119
INFO[14:07:04CST]Completeinitializationkubesphere007[10.26.31.120]node=10.26.31.120
INFO[14:07:07CST]Completeinitializationkubesphere003[10.26.31.42]node=10.26.31.42
INFO[14:07:11CST]Completeinitializationkubesphere004[10.26.31.46]node=10.26.31.46
INFO[14:08:23CST]Completeinitializationkubesphere001[10.26.31.34]node=10.26.31.34
INFO[14:10:57CST]Completeinitializationkubesphere008[10.26.31.121]node=10.26.31.121
INFO[14:10:57CST]Initoperatingsystemsuccessful.

部署

以上准备工作完成且再次检查配置文件无误后,执行安装。

./kkcreatecluster-fconfig-sample.yaml
+-------------------------+------+------+---------+----------+-------+-------+-----------+--------+------------+-------------+------------------+--------------+
|name|sudo|curl|openssl|ebtables|socat|ipset|conntrack|docker|nfsclient|cephclient|glusterfsclient|time|
+-------------------------+------+------+---------+----------+-------+-------+-----------+--------+------------+-------------+------------------+--------------+
|kubesphere005|y|y|y|y|y|y|y|y|y|y|y|CST14:16:55|
|kubesphere006|y|y|y|y|y|y|y|y|y|y|y|CST14:16:55|
|kubesphere007|y|y|y|y|y|y|y|y|y|y|y|CST14:16:55|
|kubesphere004|y|y|y|y|y|y|y|y|y|y|y|CST14:16:55|
|kubesphere001|y|y|y|y|y|y|y|y|y|y|y|CST14:16:55|
|kubesphere003|y|y|y|y|y|y|y|y|y|y|y|CST14:16:55|
|kubesphere002|y|y|y|y|y|y|y|y|y|y|y|CST14:16:55|
|kubesphere008|y|y|y|y|y|y|y|y|y|y|y|CST14:16:55|
+-------------------------+------+------+---------+----------+-------+-------+-----------+--------+------------+-------------+------------------+--------------+

Thisisasimplecheckofyourenvironment.
Beforeinstallation,youshouldensurethatyourmachinesmeetallrequirementsspecifiedat
https://github.com/kubesphere/kubekey#requirements-and-recommendations

Continuethisinstallation?[yes/no]:yes
INFO[14:17:25CST]DownloadingInstallationFiles
INFO[14:17:25CST]Downloadingkubeadm...

**************************************************
#####################################################
###WelcometoKubeSphere!###
#####################################################

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

NOTES:
1.Afterloggingintotheconsole,pleasecheckthe
monitoringstatusofservicecomponentsin
the"ClusterManagement".Ifanyserviceisnot
ready,pleasewaitpatientlyuntilallcomponents
areready.
2.Pleasemodifythedefaultpasswordafterlogin.

#####################################################
https://kubesphere.io2021-02-0515:47:21
#####################################################

至此kubesphere安装成功,可以通过浏览器访问http://10.26.31.34:30880 验证

验证

您可以使用默认的帐户和密码 admin/P@88w0rd 登录 KubeSphere 控制台并开始使用 KubeSphere。请在登录后修改默认密码。

使用kubekey安装kubesphere

登录后如下图

使用kubekey安装kubesphere

现在就可以开始您的kubesphere之旅了,更多详情请参见官网。

继续浏览有关 系统运维 的文章
发表评论