[云原生专题-61]:Kubesphere云治理-安装(3)-可插拔组件的安装

作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客

本文网址:https://blog.csdn.net/HiWangWenBing/article/details/122910292


目录

第1章 概述

1.1 Kubesphere在系统中的位置

1.2 可插拔组件的安装概述

1.3 官网安装步骤:

第2章  Kubesphere支持的可插拔组件

2.1 组件类型

2.2 可插拔功能组件配置要求

第3章 配置文件解读

3.1 集群安装配置文件解读:cluster-configuration.yaml

3.2 单机版配置文件:conf/common.yaml

第4章 安装步骤

4.1 前置条件

4.2 在安装Kubesphere前启用可插拔组件 -- Linux KK上安装

4.3 在安装Kubesphere前启用可插拔组件 -- K8S上安装

4.4 在安装Kubesphere后启用可插拔组件

4.5 查看组件的安装状态


第1章 概述

1.1 Kubesphere在系统中的位置

[云原生专题-61]:Kubesphere云治理-安装(3)-可插拔组件的安装_第1张图片

1.2 可插拔组件的安装概述

Kubesphere提供了大量的功能,而这些功能遵循了微服务的理念,每个功能可以动态的安装和卸载,而每个功能相当于K8S一个独立的服务Service

KubeSphere 在 2.1 版本的 Installer 对各功能组件进行了 解耦快速安装将默认仅开启最小化安装(Minimal Installation),支持在安装前或安装后 自定义可插拔的功能组件的安装,使最小化安装 更快速轻量且资源占用更少,也方便不同用户 按需选择安装不同的功能组件

1.3 官网安装步骤:

KubeSphere 可插拔功能组件概览 | KubeSphere DocumentsLinux 单节点安装 KubeSphere 与 Kuberneteshttps://v2-1.docs.kubesphere.io/docs/zh-CN/installation/pluggable-components/

启用可插拔组件了解如何在 KubeSphere 上启用可插拔组件,以便您全方位地探索 KubeSphere。安装前和安装后均可启用可插拔组件。https://kubesphere.com.cn/docs/quick-start/enable-pluggable-components/

第2章  Kubesphere支持的可插拔组件

2.1 组件类型

KubeSphere 有以下六个可插拔功能组件,您可以根据需求,选择开启安装 KubeSphere 的功能组件。我们非常建议您开启这些功能组件来体验 KubeSphere 完整的功能以及端到端的解决方案。

  • KubeSphere 应用商店   =》有了应用商店,就可以直接通过KubeSphere安装应用,简化部署
  • KubeSphere DevOps 系统  =》集成Jekins等自动化开发流程管理各种工具,实现流水线管理
  • KubeSphere 日志系统   =》内置日志查询、日志收集和日志转发等功能
  • KubeSphere Service Mesh(基于 Istio)=》支持灰度发布、流量拓扑、流量治理、Tracing
  • KubeSphere 告警通知系统 =》内存等资源监控、Email通知。
  • Metrics-server(HPA)=》根据业务需求和策略自动调整计算能力(即实例数量)的服务

2.2 可插拔功能组件配置要求

注意:开启可选功能组件之前,请先参考下表确认集群的可用 CPU 与内存空间是否充足(下表是计算得出的各组件 CPU 与内存的 Request 值),否则可能会因为资源不足而导致的机器崩溃或其它问题。

功能组件 命名空间(所属项目) CPU (request) 内存 (request) 说明
KubeSphere 应用商店 openpitrix-system 0.3 core 300 MiB 内置应用商店与应用生命周期管理
,建议安装
KubeSphere 告警通知系统 kubesphere-alerting-system 0.08 core 80 M alerting 与 notification 安装时
建议同时开启
KubeSphere DevOps System(All-in-one) kubesphere-devops-system 34 m 2.69 G

一站式 DevOps 方案,

内置 Jenkins 流水线与 B2I & S2I

KubeSphere DevOps System (Multi-node) kubesphere-devops-system 0.47 core 8.6 G 多节点安装 DevOps 需要
有一个节点的内存大于 8 G
KubeSphere Service Mesh(基于 Istio) istio-system 2 core 3.6 G 支持灰度发布、流量拓扑、流量治理、Tracing
KubeSphere 日志系统 kubesphere-logging-system 56 m 2.76 G 内置日志查询、日志收集和日志转发等功能
弹性伸缩(HPA) metrics-server 5 m 44.35 MiB 内置 弹性伸缩 HPA

第3章 配置文件解读

3.1 集群安装配置文件解读:cluster-configuration.yaml

为了方便对组件的动态安装和卸载,Kubesphere在K8S service基础之上,进一步抽象,抽象出了一个个的功能 模块(而不是service),可以对这些功能模型进行enable或disable。

这些功能模块的disable/enable的状态以及其他参数的状态,通过cluster-configuration.yaml来承载,我们只需要通过编辑和apply该配置文件,就可以完成功能的动态卸载与安装。

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

---
apiVersion: installer.kubesphere.io/v1alpha1
kind: ClusterConfiguration
metadata:
  name: ks-installer
  namespace: kubesphere-system
  labels:
    version: v3.1.0
spec:
  persistence:
    storageClass: ""        # If there is not a default StorageClass in your cluster, you need to specify an existing StorageClass here.
  authentication:
    jwtSecret: ""           # Keep the jwtSecret consistent with the host cluster. Retrive the jwtSecret by executing "kubectl -n kubesphere-system get cm kubesphere-config -o yaml | grep -v "apiVersion" | grep jwtSecret" on the host cluster.
  local_registry: ""        # Add your private registry address if it is needed.
  etcd:
    monitoring: false       # Whether to enable etcd monitoring dashboard installation. You have to create a secret for etcd before you enable it.
    endpointIps: localhost  # etcd cluster EndpointIps, it can be a bunch of IPs here.
    port: 2379              # etcd port
    tlsEnable: true
  common:
    redis:
      enabled: false
    openldap:
      enabled: false
    minioVolumeSize: 20Gi # Minio PVC size.
    openldapVolumeSize: 2Gi   # openldap PVC size.
    redisVolumSize: 2Gi # Redis PVC size.
    monitoring:
      endpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090 # Prometheus endpoint to get metrics data
    es:   # Storage backend for logging, 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--log.
      basicAuth:
        enabled: false
        username: ""
        password: ""
      externalElasticsearchUrl: ""
      externalElasticsearchPort: ""
  console:
    enableMultiLogin: true  # enable/disable multiple sign on, it allows an account can be used by different users at the same time.
    port: 30880
  alerting:                # (CPU: 0.1 Core, Memory: 100 MiB) 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: false
    # thanosruler:
    #   replicas: 1
    #   resources: {}
  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: false
  devops:                  # (CPU: 0.47 Core, Memory: 8.6 G) 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: false
    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: false
    ruler:
      enabled: true
      replicas: 2
  logging:                 # (CPU: 57 m, Memory: 2.76 G) 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: false
    logsidecar:
      enabled: true
      replicas: 2
  metrics_server:                    # (CPU: 56 m, Memory: 44.35 MiB) Whether to install metrics-server. IT enables HPA (Horizontal Pod Autoscaler).
    enabled: false
  monitoring:
    storageClass: ""                 # If there is a independent StorageClass your need for prometheus, you can specify it here. default StorageClass used by default.
    # 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.
  network:
    networkpolicy: # Network policies allow network isolation within the same cluster, which means firewalls can be set up between certain instances (Pods).
      # 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.
      enabled: false
    ippool: # if calico cni is integrated then use the value "calico", "none" means that the ippool function is disabled
      type: none
    topology: # "weave-scope" means to use "weave-scope" to provide network topology information, "none" means that the topology function is disabled
      type: none
  openpitrix:
    store:
      enabled: false
  servicemesh:         # (0.3 Core, 300 MiB) Whether to install KubeSphere Service Mesh (Istio-based). It provides fine-grained traffic management, observability and tracing, and offer visualization for traffic topology.
    enabled: false     # base component (pilot)
  kubeedge:
    enabled: false
    cloudCore:
      nodeSelector: {"node-role.kubernetes.io/worker": ""}
      tolerations: []
      cloudhubPort: "10000"
      cloudhubQuicPort: "10001"
      cloudhubHttpsPort: "10002"
      cloudstreamPort: "10003"
      tunnelPort: "10004"
      cloudHub:
        advertiseAddress: # At least a public IP Address or an IP which can be accessed by edge nodes must be provided
          - ""            # Causion!: Leave this entry to empty will cause CloudCore to exit abnormally once KubeEdge is enabled.
        nodeLimit: "100"
      service:
        cloudhubNodePort: "30000"
        cloudhubQuicNodePort: "30001"
        cloudhubHttpsNodePort: "30002"
        cloudstreamNodePort: "30003"
        tunnelNodePort: "30004"
    edgeWatcher:
      nodeSelector: {"node-role.kubernetes.io/worker": ""}
      tolerations: []
      edgeWatcherAgent:
        nodeSelector: {"node-role.kubernetes.io/worker": ""}
        tolerations: []

enabled: false =》 enabled: true

3.2 单机版配置文件:conf/common.yaml

# LOGGING CONFIGURATION
# logging is an optional component when installing KubeSphere, and
# Kubernetes builtin logging APIs will be used if logging_enabled is set to false.
# Builtin logging only provides limited functions, so recommend to enable logging.
logging_enabled: true # 是否安装内置的日志系统
elasticsearch_master_replica: 1  # es 主节点副本数,主节点数不能为偶数
elasticsearch_data_replica: 2  # 数据节点副本数
elasticsearch_volume_size: 20Gi # Elasticsearch 存储卷大小
log_max_age: 7 # 集群内置的 Elasticsearch 中日志保留时间,默认是 7 天
elk_prefix: logstash # 自定义 index 命名方式,index 将以 ks--log 形式命名
kibana_enabled: false # 是否部署内置的 Kibana
#external_es_url: SHOULD_BE_REPLACED # 安装支持对接外部的 Elasticsearch 7.x,可减少资源消耗,此处填写 ES 服务的地址
#external_es_port: SHOULD_BE_REPLACED # 此处填写 ES 服务暴露的端口号

#DevOps Configuration
devops_enabled: true # 是否安装内置的 DevOps 系统(支持流水线、 S2i 和 B2i 等功能)
jenkins_memory_lim: 8Gi # Jenkins 内存限制,默认 8 Gi
jenkins_memory_req: 4Gi # Jenkins 内存请求,默认 4 Gi
jenkins_volume_size: 8Gi # Jenkins 存储卷大小,默认 8 Gi
jenkinsJavaOpts_Xms: 3g # 以下三项为 jvm 启动参数
jenkinsJavaOpts_Xmx: 6g
jenkinsJavaOpts_MaxRAM: 8g
sonarqube_enabled: true # 是否安装内置的 SonarQube (代码静态分析工具)
#sonar_server_url: SHOULD_BE_REPLACED # 安装支持对接外部已有的 SonarQube,此处填写 SonarQube 服务的地址
#sonar_server_token: SHOULD_BE_REPLACED  # 此处填写 SonarQube 的 Token

# Following components are all optional for KubeSphere,
# Which could be turned on to install it before installation or later by updating its value to true
openpitrix_enabled: true       # KubeSphere 应用商店
metrics_server_enabled: true   # KubeSphere HPA(弹性伸缩)
servicemesh_enabled: true      # KubeSphere Service Mesh
notification_enabled: true     # KubeSphere 通知系统
alerting_enabled: true         # KubeSphere 告警系统

第4章 安装步骤

4.1 前置条件

Linux平台上已经安装了Kubesphere installer.

4.2 在安装Kubesphere启用可插拔组件 -- Linux KK上安装

可以通过K8S的命令安装这些服务,只需要编制每个服务的yaml配置文件,然后通过kubectl apply -f命令或通过kk命令,就可以安装一个独立的服务。

# 下载指定集群配置文件

# 修改配置文件,enable/disable某些组件

#  应用配置文件
$ ./kk create cluster -f config-sample.yaml

# 

4.3 在安装Kubesphere启用可插拔组件 -- K8S上安装

# 下载指定集群配置文件

# 修改配置文件,enable/disable某些组件

#  应用配置文件
$ kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.2.1/kubesphere-installer.yaml
   
$ kubectl apply -f cluster-configuration.yaml

# 

无论是在 Linux 上还是在 Kubernetes 上安装 KubeSphere,

安装后都可以在 KubeSphere 的 Web 控制台中检查已启用组件的状态。

4.4 在安装Kubesphere启用可插拔组件

Kubesphere增强的功能服务,就不需要通过kubectl apply -f命令也安装了,只需要通过Kubesphere的用户界面,简答操作UE界面,就可以完成功能模块的动态安装与卸载,非常的方便。

4.5 查看组件的安装状态

(1)Kubesphere UI检查

可以在UI上检查所有的组件的安装状态。 

(2)命令行检查

$ kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f

$ kubectl get pod --all-namespaces

作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客

本文网址:https://blog.csdn.net/HiWangWenBing/article/details/122910292

你可能感兴趣的:(云原生专题,云原生,cloud,native,K8S,Kubesphere,安装)