当前位置:   article > 正文

Kubesphere安装和使用_kubesphere使用

kubesphere使用

一、简介

Kubesphere是界面话操作k8s的平台化工具

官网https://kubesphere.io/zh/docs/v3.3/quick-start/minimal-kubesphere-on-k8s/

二、前置安装工作

1、k8s

安装docker,k8s,配置好nfs默认存储。这些我在前面的文章涨已经介绍过,有手把手的课程。

https://blog.csdn.net/u014225032/article/details/126138089

https://blog.csdn.net/u014225032/article/details/128862988

2、metrics- server安装

Metrics-Server是k8s集群采集监控数据的聚合器,如采集node、pod的cpu、内存等数据,从 Kubernetes1.8 开始默认使用Metrics-Server采集数据,并通过Metrics API的形式提供查询,但是,kubeadm安装的k8s集群默认是没有安装Metrics-Server的,所以我们来安装一下Metrics-Server。

可以从GitHub上面得到安装Metrics-Server的yaml文件,https://github.com/kubernetes-sigs/metrics-server/releases/download

我们用这个版本:https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.6.1/components.yaml

注意1

k8s.gcr.io/metrics-server/metrics-server:v0.6.1改为阿里云的镜像

image: registry.aliyuncs.com/google_containers/metrics-server:v0.6.1

注意2

kubelet 的 10250 端口使用的是 https 协议,metrics-server去连接kubelet获取数据则需要验证 tls 证书。我们可以使用 参数--kubelet-insecure-tls 不验证客户端证书

  1. # 在deployment中的args末尾中添加
  2. - args:
  3. ...................................
  4. - --kubelet-insecure-tls #添加这一句,表示不验证客户端证书

部署玩测试 kubectl top nodes

说明成功。

三、基于k8s安装Kubesphere

参考下官网哈。

1、下载yaml

https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/kubesphere-installer.yaml

https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/cluster-configuration.yaml

kubesphere-installer.yaml可以直接执行安装,cluster-configuration.yaml需要开启一些功能。几乎都是把false改为true.endpointIps需要改完你主机的ip.

  1. ---
  2. apiVersion: installer.kubesphere.io/v1alpha1
  3. kind: ClusterConfiguration
  4. metadata:
  5. name: ks-installer
  6. namespace: kubesphere-system
  7. labels:
  8. version: v3.1.1
  9. spec:
  10. persistence:
  11. storageClass: "" # If there is no default StorageClass in your cluster, you need to specify an existing StorageClass here.
  12. authentication:
  13. jwtSecret: "" # Keep the jwtSecret consistent with the Host Cluster. Retrieve the jwtSecret by executing "kubectl -n kubesphere-system get cm kubesphere-config -o yaml | grep -v "apiVersion" | grep jwtSecret" on the Host Cluster.
  14. local_registry: "" # Add your private registry address if it is needed.
  15. etcd:
  16. monitoring: true # Enable or disable etcd monitoring dashboard installation. You have to create a Secret for etcd before you enable it.
  17. endpointIps: 192.168.211.11 # etcd cluster EndpointIps. It can be a bunch of IPs here.
  18. port: 2379 # etcd port.
  19. tlsEnable: true
  20. common:
  21. redis:
  22. enabled: true
  23. openldap:
  24. enabled: true
  25. minioVolumeSize: 20Gi # Minio PVC size.
  26. openldapVolumeSize: 2Gi # openldap PVC size.
  27. redisVolumSize: 2Gi # Redis PVC size.
  28. monitoring:
  29. # type: external # Whether to specify the external prometheus stack, and need to modify the endpoint at the next line.
  30. endpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090 # Prometheus endpoint to get metrics data.
  31. es: # Storage backend for logging, events and auditing.
  32. # elasticsearchMasterReplicas: 1 # The total number of master nodes. Even numbers are not allowed.
  33. # elasticsearchDataReplicas: 1 # The total number of data nodes.
  34. elasticsearchMasterVolumeSize: 4Gi # The volume size of Elasticsearch master nodes.
  35. elasticsearchDataVolumeSize: 20Gi # The volume size of Elasticsearch data nodes.
  36. logMaxAge: 7 # Log retention time in built-in Elasticsearch. It is 7 days by default.
  37. elkPrefix: logstash # The string making up index names. The index name will be formatted as ks-<elk_prefix>-log.
  38. basicAuth:
  39. enabled: false
  40. username: ""
  41. password: ""
  42. externalElasticsearchUrl: ""
  43. externalElasticsearchPort: ""
  44. console:
  45. enableMultiLogin: true # Enable or disable simultaneous logins. It allows different users to log in with the same account at the same time.
  46. port: 30880
  47. alerting: # (CPU: 0.1 Core, Memory: 100 MiB) It enables users to customize alerting policies to send messages to receivers in time with different time intervals and alerting levels to choose from.
  48. enabled: true # Enable or disable the KubeSphere Alerting System.
  49. # thanosruler:
  50. # replicas: 1
  51. # resources: {}
  52. auditing: # Provide a security-relevant chronological set of records,recording the sequence of activities happening on the platform, initiated by different tenants.
  53. enabled: true # Enable or disable the KubeSphere Auditing Log System.
  54. devops: # (CPU: 0.47 Core, Memory: 8.6 G) Provide an out-of-the-box CI/CD system based on Jenkins, and automated workflow tools including Source-to-Image & Binary-to-Image.
  55. enabled: true # Enable or disable the KubeSphere DevOps System.
  56. jenkinsMemoryLim: 2Gi # Jenkins memory limit.
  57. jenkinsMemoryReq: 1500Mi # Jenkins memory request.
  58. jenkinsVolumeSize: 8Gi # Jenkins volume size.
  59. jenkinsJavaOpts_Xms: 512m # The following three fields are JVM parameters.
  60. jenkinsJavaOpts_Xmx: 512m
  61. jenkinsJavaOpts_MaxRAM: 2g
  62. events: # Provide a graphical web console for Kubernetes Events exporting, filtering and alerting in multi-tenant Kubernetes clusters.
  63. enabled: true # Enable or disable the KubeSphere Events System.
  64. ruler:
  65. enabled: true
  66. replicas: 2
  67. logging: # (CPU: 57 m, Memory: 2.76 G) 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.
  68. enabled: true # Enable or disable the KubeSphere Logging System.
  69. logsidecar:
  70. enabled: true
  71. replicas: 2
  72. metrics_server: # (CPU: 56 m, Memory: 44.35 MiB) It enables HPA (Horizontal Pod Autoscaler).
  73. enabled: false # Enable or disable metrics-server.
  74. monitoring:
  75. storageClass: "" # If there is an independent StorageClass you need for Prometheus, you can specify it here. The default StorageClass is used by default.
  76. # prometheusReplicas: 1 # Prometheus replicas are responsible for monitoring different segments of data source and providing high availability.
  77. prometheusMemoryRequest: 400Mi # Prometheus request memory.
  78. prometheusVolumeSize: 20Gi # Prometheus PVC size.
  79. # alertmanagerReplicas: 1 # AlertManager Replicas.
  80. multicluster:
  81. clusterRole: none # host | member | none # You can install a solo cluster, or specify it as the Host or Member Cluster.
  82. network:
  83. networkpolicy: # Network policies allow network isolation within the same cluster, which means firewalls can be set up between certain instances (Pods).
  84. # Make sure that the CNI network plugin used by the cluster supports NetworkPolicy. There are a number of CNI network plugins that support NetworkPolicy, including Calico, Cilium, Kube-router, Romana and Weave Net.
  85. enabled: true # Enable or disable network policies.
  86. ippool: # Use Pod IP Pools to manage the Pod network address space. Pods to be created can be assigned IP addresses from a Pod IP Pool.
  87. type: calico # Specify "calico" for this field if Calico is used as your CNI plugin. "none" means that Pod IP Pools are disabled.
  88. topology: # Use Service Topology to view Service-to-Service communication based on Weave Scope.
  89. type: none # Specify "weave-scope" for this field to enable Service Topology. "none" means that Service Topology is disabled.
  90. openpitrix: # An App Store that is accessible to all platform tenants. You can use it to manage apps across their entire lifecycle.
  91. store:
  92. enabled: true # Enable or disable the KubeSphere App Store.
  93. servicemesh: # (0.3 Core, 300 MiB) Provide fine-grained traffic management, observability and tracing, and visualized traffic topology.
  94. enabled: true # Base component (pilot). Enable or disable KubeSphere Service Mesh (Istio-based).
  95. kubeedge: # Add edge nodes to your cluster and deploy workloads on edge nodes.
  96. enabled: true # Enable or disable KubeEdge.
  97. cloudCore:
  98. nodeSelector: {"node-role.kubernetes.io/worker": ""}
  99. tolerations: []
  100. cloudhubPort: "10000"
  101. cloudhubQuicPort: "10001"
  102. cloudhubHttpsPort: "10002"
  103. cloudstreamPort: "10003"
  104. tunnelPort: "10004"
  105. cloudHub:
  106. advertiseAddress: # At least a public IP address or an IP address which can be accessed by edge nodes must be provided.
  107. - "" # Note that once KubeEdge is enabled, CloudCore will malfunction if the address is not provided.
  108. nodeLimit: "100"
  109. service:
  110. cloudhubNodePort: "30000"
  111. cloudhubQuicNodePort: "30001"
  112. cloudhubHttpsNodePort: "30002"
  113. cloudstreamNodePort: "30003"
  114. tunnelNodePort: "30004"
  115. edgeWatcher:
  116. nodeSelector: {"node-role.kubernetes.io/worker": ""}
  117. tolerations: []
  118. edgeWatcherAgent:
  119. nodeSelector: {"node-role.kubernetes.io/worker": ""}
  120. tolerations: []

安装顺序执行完成后,等待所有pod执行完毕即可

注意如果需要卸载,请参考下 http://www.manongjc.com/detail/25-fsylsungewdxqmw.html

https://blog.csdn.net/Wqr_18390921824/article/details/124208510

只要内存和cup足够,基本没什么问题。

四、单节点安装Kubesphere

官网https://kubesphere.io/zh/docs/v3.3/quick-start/all-in-one-on-linux/

  1. 安装提示安装即可

2、官网还有多节点。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/247625
推荐阅读
相关标签
  

闽ICP备14008679号