KubeSphere基础:多节点集群安装部署

网友投稿 430 2022-10-21

KubeSphere基础:多节点集群安装部署

2、下载kubekey

#所有节点都安装预备环境 yum install -y vim wget curl conntrack #主节点下载KK export KKZONE=cn curl -sfL | VERSION=v2.0.0 sh - chmod +x kk

3、主节点上创建集群yaml文件

./kk create config --with-kubernetes v1.21.5 --with-kubesphere v3.2.1

4、主节点上更改yaml文件默认配置

[root@master ~]# cat config-sample.yaml apiVersion: kubekey.kubesphere.io/v1alpha2 kind: Cluster metadata: name: sample spec: hosts: - {name: master, address: 172.18.0.2, internalAddress: 172.18.0.2, user: root, password: "KNBE^1d7"} - {name: node01, address: 172.18.0.3, internalAddress: 172.18.0.3, user: root, password: "KNBE^1d7"} - {name: node02, address: 172.18.0.4, internalAddress: 172.18.0.4, user: root, password: "KNBE^1d7"} roleGroups: etcd: - master control-plane: - master worker: - master - node01 - node02 controlPlaneEndpoint: ## Internal loadbalancer for apiservers # internalLoadbalancer: haproxy domain: lb.kubesphere.local address: "" port: 6443 kubernetes: version: v1.21.5 clusterName: cluster.local network: plugin: calico kubePodsCIDR: 10.233.64.0/18 kubeServiceCIDR: 10.233.0.0/18 ## multus support. https://github.com/k8snetworkplumbingwg/multus-cni multusCNI: enabled: false registry: plainHTTP: false privateRegistry: "" namespaceOverride: "" registryMirrors: [] insecureRegistries: [] addons: [] --- apiVersion: installer.kubesphere.io/v1alpha1 kind: ClusterConfiguration metadata: name: ks-installer namespace: kubesphere-system labels: version: v3.2.1 spec: persistence: storageClass: "" authentication: jwtSecret: "" local_registry: "" namespace_override: "" # dev_tag: "" etcd: monitoring: true endpointIps: localhost port: 2379 tlsEnable: true

5、主节点上配置主机hosts文件

vi /etc/hosts 172.18.0.2 master 172.18.0.3 node01 172.18.0.4 node02

6、主节点上使用kubekey一键创建K8S+KS集群

./kk create cluster -f config-sample.yaml

7.安装成功信息输出

clusterconfiguration.installer.kubesphere.io/ks-installer created 23:37:00 CST success: [master] ##################################################### ### Welcome to KubeSphere! ### ##################################################### Console: http://172.18.0.2:30880 Account: admin Password: P@88w0rd NOTES: 1. After you log into the console, please check the monitoring status of service components in "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. ##################################################### 2022-04-12 23:47:57 ##################################################### 23:47:58 CST success: [master] 23:47:58 CST Pipeline[CreateClusterPipeline] execute successful Installation is complete. Please check the result using the command: kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f

8、查看集群信息

[root@master ~]# kubectl version Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.5", GitCommit:"aea7bbadd2fc0cd689de94a54e5b7b758869d691", GitTreeState:"clean", BuildDate:"2021-09-15T21:10:45Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.5", GitCommit:"aea7bbadd2fc0cd689de94a54e5b7b758869d691", GitTreeState:"clean", BuildDate:"2021-09-15T21:04:16Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"linux/amd64"} [root@master ~]# kubectl get node NAME STATUS ROLES AGE VERSION master Ready control-plane,master,worker 23m v1.21.5 node01 Ready worker 22m v1.21.5 node02 Ready worker 22m v1.21.5 [root@master ~]# kubectl get namespace NAME STATUS AGE default Active 22m kube-node-lease Active 22m kube-public Active 22m kube-system Active 22m kubekey-system Active 21m kubesphere-controls-system Active 19m kubesphere-monitoring-federated Active 19m kubesphere-monitoring-system Active 21m kubesphere-system Active 21m [root@master ~]# kubectl get pod -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system calico-kube-controllers-75ddb95444-qppgg 1/1 Running 0 21m kube-system calico-node-22z2c 1/1 Running 0 21m kube-system calico-node-9h5h5 1/1 Running 0 21m kube-system calico-node-tvptz 1/1 Running 0 21m kube-system coredns-5495dd7c88-2j64r 1/1 Running 0 22m kube-system coredns-5495dd7c88-qrlxp 1/1 Running 0 22m kube-system kube-apiserver-master 1/1 Running 0 22m kube-system kube-controller-manager-master 1/1 Running 0 22m kube-system kube-proxy-4sw97 1/1 Running 0 21m kube-system kube-proxy-rsxq8 1/1 Running 0 21m kube-system kube-proxy-vcm7p 1/1 Running 0 22m kube-system kube-scheduler-master 1/1 Running 0 22m kube-system nodelocaldns-896zd 1/1 Running 0 22m kube-system nodelocaldns-j2qrv 1/1 Running 0 21m kube-system nodelocaldns-pr47q 1/1 Running 0 21m kube-system openebs-localpv-provisioner-6c9dcb5c54-rflls 1/1 Running 0 21m kube-system snapshot-controller-0 1/1 Running 0 19m kubesphere-controls-system default- 1/1 Running 0 18m kubesphere-controls-system kubectl-admin-6667774bb-r8dnc 1/1 Running 0 10m kubesphere-monitoring-system alertmanager-main-0 0/2 ContainerCreating 0 17m kubesphere-monitoring-system alertmanager-main-1 2/2 Running 0 17m kubesphere-monitoring-system alertmanager-main-2 2/2 Running 0 17m kubesphere-monitoring-system kube-state-metrics-5547ddd4cc-ggkqm 3/3 Running 0 17m kubesphere-monitoring-system node-exporter-5fzxj 0/2 ContainerCreating 0 17m kubesphere-monitoring-system node-exporter-qtd2r 2/2 Running 0 17m kubesphere-monitoring-system node-exporter-vwgch 2/2 Running 0 17m kubesphere-monitoring-system notification-manager-deployment-78664576cb-bnf96 0/2 ContainerCreating 0 9m36s kubesphere-monitoring-system notification-manager-deployment-78664576cb-n5lmp 2/2 Running 0 9m36s kubesphere-monitoring-system notification-manager-operator-7d44854f54-45wdx 2/2 Running 0 17m kubesphere-monitoring-system prometheus-k8s-0 2/2 Running 1 17m kubesphere-monitoring-system prometheus-k8s-1 0/2 ContainerCreating 0 17m kubesphere-monitoring-system prometheus-operator-5c5db79546-pr6zv 2/2 Running 0 17m kubesphere-system ks-apiserver-594b586748-47bgg 1/1 Running 0 16m kubesphere-system ks-console-65f4d44d88-9ccjm 1/1 Running 0 18m kubesphere-system ks-controller-manager-64b6fd8886-shf7f 1/1 Running 0 16m kubesphere-system ks-installer-69df988b79-4mvc7 1/1 Running 0 21m [root@master ~]#

9、公网访问master+端口

http://139.198.104.152:30880/ Account: admin Password: P@88w0rd

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:harbor密码丢失,忘记Harbor密码?
下一篇:Docker的网络模式
相关文章

 发表评论

暂时没有评论,来抢沙发吧~