kubesphere安装部署附带Metrics server的安装(二)

简介: kubesphere安装部署附带Metrics server的安装

四,部署并设置一个defualt的StorageClass


部署和设置default就不重复了以免篇幅太长,见我的博客:kubernetes学习之持久化存储StorageClass(4)_zsk_john的博客-CSDN博客

五,开始kubesphere的安装:


这个文件不需要改动

[root@master media]# cat kubesphere-installer.yaml 
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: clusterconfigurations.installer.kubesphere.io
spec:
  group: installer.kubesphere.io
  versions:
  - name: v1alpha1
    served: true
    storage: true
  scope: Namespaced
  names:
    plural: clusterconfigurations
    singular: clusterconfiguration
    kind: ClusterConfiguration
    shortNames:
    - cc
---
apiVersion: v1
kind: Namespace
metadata:
  name: kubesphere-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: ks-installer
  namespace: kubesphere-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: ks-installer
rules:
- apiGroups:
  - ""
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - apps
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - extensions
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - batch
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - apiregistration.k8s.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - tenant.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - certificates.k8s.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - devops.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - monitoring.coreos.com
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - logging.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - jaegertracing.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - storage.k8s.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - admissionregistration.k8s.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - policy
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - autoscaling
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - networking.istio.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - config.istio.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - iam.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - notification.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - auditing.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - events.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - core.kubefed.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - installer.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - storage.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - security.istio.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - monitoring.kiali.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - kiali.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - networking.k8s.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - kubeedge.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - types.kubefed.io
  resources:
  - '*'
  verbs:
  - '*'
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: ks-installer
subjects:
- kind: ServiceAccount
  name: ks-installer
  namespace: kubesphere-system
roleRef:
  kind: ClusterRole
  name: ks-installer
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ks-installer
  namespace: kubesphere-system
  labels:
    app: ks-install
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ks-install
  template:
    metadata:
      labels:
        app: ks-install
    spec:
      serviceAccountName: ks-installer
      containers:
      - name: installer
        image: kubesphere/ks-installer:v3.1.1
        imagePullPolicy: "IfNotPresent"
        resources:
          limits:
            cpu: "1"
            memory: 1Gi
          requests:
            cpu: 20m
            memory: 100Mi
        volumeMounts:
        - mountPath: /etc/localtime
          name: host-time
      volumes:
      - hostPath:
          path: /etc/localtime
          type: ""
        name: host-time

集群设置和功能选择的配置文件:

[root@master media]# cat cluster-configuration.yaml 
---
apiVersion: installer.kubesphere.io/v1alpha1
kind: ClusterConfiguration
metadata:
  name: ks-installer
  namespace: kubesphere-system
  labels:
    version: v3.1.1
spec:
  persistence:
    storageClass: ""        #这里保持默认即可,因为有默认的存储类
  authentication:
    jwtSecret: ""      
  local_registry: ""        # Add your private registry address if it is needed.这里是离线安装的仓库地址,如果你有内网仓库的话。
  etcd:                    
    monitoring: true       # 改为"true",表示开启etcd的监控功能
    endpointIps: 192.168.217.16  # 改为自己的master节点IP地址
    port: 2379              # etcd port.
    tlsEnable: true
  common:
    redis:
      enabled: true         #改为"true",开启redis功能
    openldap: 
      enabled: true         #改为"true",开启轻量级目录协议
    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
      elasticsearchMasterVolumeSize: 4Gi   # The volume size of Elasticsearch master nodes.
      elasticsearchDataVolumeSize: 20Gi    # The 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-<elk_prefix>-log.
      basicAuth:
        enabled: false          #此处的"false"不用改为"true",这个标识在开启监控功能之后是否要连接ElasticSearch的账户和密码,此处不用
        username: ""
        password: ""
      externalElasticsearchUrl: ""
      externalElasticsearchPort: ""
  console:
    enableMultiLogin: true  # Enable or disable simultaneous logins. It allows different users to log in with the same account at the same time.
    port: 30880
  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.
    enabled: true         # 改为"true",开启告警功能
  auditing:                
    enabled: true         #  改为"true",开启审计功能
  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.
    enabled: true             # 改为"true",开启DevOps功能
    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:                  # Provide a graphical web console for Kubernetes Events exporting, filtering and alerting in multi-tenant Kubernetes clusters.
    enabled: true         # 改为"true",开启集群的事件功能
    ruler:
      enabled: true
      replicas: 2
  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.
    enabled: true        # 改为"true",开启日志功能
    logsidecar:
      enabled: true
      replicas: 2
  metrics_server:                    # (CPU: 56 m, Memory: 44.35 MiB) It enables HPA (Horizontal Pod Autoscaler).
    enabled: false                   # 这个不用修改,因为在上卖弄我们已经安装过了,如果这里开启,镜像是官方的,会拉取镜像失败
  monitoring:
    storageClass: ""                 
    prometheusMemoryRequest: 400Mi   # Prometheus request memory.
    prometheusVolumeSize: 20Gi       # Prometheus PVC size.
  multicluster:
    clusterRole: none  # host | member | none  # You can install a solo cluster, or specify it as the 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).
      enabled: true # 改为"true",开启网络策略
    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.
      type: none #如果你的网络插件是calico,需要修改为"calico",这里我是Flannel,保持默认。
    topology: # Use Service Topology to view Service-to-Service communication based on Weave Scope.
      type: none # Specify "weave-scope" for this field to enable Service Topology. "none" means that Service Topology is disabled.
  openpitrix: # An App Store that is accessible to all platform tenants. You can use it to manage apps across their entire lifecycle.
    store:
      enabled: true # 改为"true",开启应用商店
  servicemesh:         # (0.3 Core, 300 MiB) Provide fine-grained traffic management, observability and tracing, and visualized traffic topology.
    enabled: true     # 改为"true",开启微服务治理
  kubeedge:          # Add edge nodes to your cluster and deploy workloads on edge nodes.
    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 address which can be accessed by edge nodes must be provided.
          - ""            # Note that once KubeEdge is enabled, CloudCore will malfunction if the address is not provided.
        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: []

执行以上两个文件即可,时间比较长,估计得1个小时左右,安装结束这样的是正确的:

Start installing servicemesh
**************************************************
Waiting for all tasks to be completed ...
task alerting status is successful  (1/10)
task multicluster status is successful  (2/10)
task network status is successful  (3/10)
task openpitrix status is successful  (4/10)
task auditing status is successful  (5/10)
task logging status is successful  (6/10)
task events status is successful  (7/10)
task devops status is successful  (8/10)
task monitoring status is successful  (9/10)
task servicemesh status is successful  (10/10)
**************************************************
Collecting installation results ...
#####################################################
###              Welcome to KubeSphere!           ###
#####################################################
Console: http://192.168.217.16: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.
#####################################################
https://kubesphere.io             2022-08-31 13:33:27
#####################################################

大概安装了这些

[root@master ~]# k get po -A
NAMESPACE                      NAME                                               READY   STATUS              RESTARTS   AGE
default                        nginx1                                             1/1     Running             4          3d19h
istio-system                   istio-ingressgateway-76df6567c6-xf4k8              0/1     ContainerCreating   0          40m
istio-system                   jaeger-operator-587999bcb9-rx25x                   1/1     Running             0          22m
istio-system                   kiali-operator-855cc4486d-w2gz9                    0/1     ContainerCreating   0          22m
kube-system                    coredns-76648cbfc9-lb75g                           1/1     Running             4          3d16h
kube-system                    kube-flannel-ds-mhkdq                              1/1     Running             11         3d21h
kube-system                    kube-flannel-ds-mlb7l                              1/1     Running             9          3d21h
kube-system                    kube-flannel-ds-sl4qv                              1/1     Running             6          3d21h
kube-system                    metrics-server-7d594964f5-nf6nz                    1/1     Running             2          148m
kube-system                    nfs-client-provisioner-9c9f9bd86-ffc4c             0/1     CrashLoopBackOff    8          107m
kube-system                    snapshot-controller-0                              1/1     Running             0          51m
kubesphere-controls-system     default-http-backend-857d7b6856-mdtnz              1/1     Running             0          49m
kubesphere-controls-system     kubectl-admin-db9fc54f5-cxwqq                      1/1     Running             0          20m
kubesphere-devops-system       ks-jenkins-58fffc7489-h8cnz                        0/1     Init:0/1            0          40m
kubesphere-devops-system       s2ioperator-0                                      1/1     Running             0          44m
kubesphere-logging-system      elasticsearch-logging-data-0                       1/1     Running             0          50m
kubesphere-logging-system      elasticsearch-logging-data-1                       1/1     Running             4          44m
kubesphere-logging-system      elasticsearch-logging-discovery-0                  1/1     Running             1          50m
kubesphere-logging-system      fluentbit-operator-85cbc8c7b6-9dvn4                0/1     PodInitializing     0          49m
kubesphere-logging-system      ks-events-operator-8dbf7fccc-rkzvs                 0/1     ContainerCreating   0          43m
kubesphere-logging-system      kube-auditing-operator-697658f8d-cdh79             1/1     Running             0          45m
kubesphere-logging-system      kube-auditing-webhook-deploy-9484b5ff-8jjdr        1/1     Running             0          29m
kubesphere-logging-system      kube-auditing-webhook-deploy-9484b5ff-t4qpn        1/1     Running             0          29m
kubesphere-logging-system      logsidecar-injector-deploy-74c66bfd85-jj4f6        0/2     ContainerCreating   0          44m
kubesphere-logging-system      logsidecar-injector-deploy-74c66bfd85-sks5d        2/2     Running             0          44m
kubesphere-monitoring-system   alertmanager-main-0                                2/2     Running             0          36m
kubesphere-monitoring-system   alertmanager-main-1                                2/2     Running             0          36m
kubesphere-monitoring-system   alertmanager-main-2                                0/2     ContainerCreating   0          36m
kubesphere-monitoring-system   kube-state-metrics-d6645c6b-ttv7g                  3/3     Running             0          39m
kubesphere-monitoring-system   node-exporter-4vz5v                                2/2     Running             0          39m
kubesphere-monitoring-system   node-exporter-fhwwl                                0/2     ContainerCreating   0          39m
kubesphere-monitoring-system   node-exporter-m84q5                                2/2     Running             0          39m
kubesphere-monitoring-system   notification-manager-deployment-674dddcbd9-4xgs5   1/1     Running             0          34m
kubesphere-monitoring-system   notification-manager-deployment-674dddcbd9-9xfx7   1/1     Running             0          34m
kubesphere-monitoring-system   notification-manager-operator-7877c6574f-6nj58     2/2     Running             3          35m
kubesphere-monitoring-system   prometheus-k8s-0                                   0/3     ContainerCreating   0          38m
kubesphere-monitoring-system   prometheus-k8s-1                                   0/3     ContainerCreating   0          38m
kubesphere-monitoring-system   prometheus-operator-7d7684fc68-wkhlr               2/2     Running             0          39m
kubesphere-monitoring-system   thanos-ruler-kubesphere-0                          2/2     Running             0          35m
kubesphere-monitoring-system   thanos-ruler-kubesphere-1                          2/2     Running             0          35m
kubesphere-system              ks-apiserver-5dd69b75b9-qgc2v                      1/1     Running             0          20m
kubesphere-system              ks-console-7494896c94-c4jkj                        1/1     Running             0          48m
kubesphere-system              ks-controller-manager-579b4c7847-xzgtw             1/1     Running             1          20m
kubesphere-system              ks-installer-7568684bbc-jsshg                      1/1     Running             0          54m
kubesphere-system              minio-597cb64f44-6wkdr                             1/1     Running             0          50m
kubesphere-system              openldap-0                                         1/1     Running             1          50m
kubesphere-system              openpitrix-import-job-qmk6r                        0/1     Completed           1          46m
kubesphere-system              redis-5566549765-k8kks                             1/1     Running             0          51m

可以看到kubesphere有非常多的组件,例如,openldap,prometheus,node-exporter,elasticsearch,minio等等。因此,kubesphere可以看做是一个PaaS平台啦。

相关实践学习
深入解析Docker容器化技术
Docker是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器上,也可以实现虚拟化,容器是完全使用沙箱机制,相互之间不会有任何接口。Docker是世界领先的软件容器平台。开发人员利用Docker可以消除协作编码时“在我的机器上可正常工作”的问题。运维人员利用Docker可以在隔离容器中并行运行和管理应用,获得更好的计算密度。企业利用Docker可以构建敏捷的软件交付管道,以更快的速度、更高的安全性和可靠的信誉为Linux和Windows Server应用发布新功能。 在本套课程中,我们将全面的讲解Docker技术栈,从环境安装到容器、镜像操作以及生产环境如何部署开发的微服务应用。本课程由黑马程序员提供。 &nbsp; &nbsp; 相关的阿里云产品:容器服务 ACK 容器服务 Kubernetes 版(简称 ACK)提供高性能可伸缩的容器应用管理能力,支持企业级容器化应用的全生命周期管理。整合阿里云虚拟化、存储、网络和安全能力,打造云端最佳容器化应用运行环境。 了解产品详情: https://www.aliyun.com/product/kubernetes
目录
相关文章
|
弹性计算 Kubernetes 容器
在 ECS 上启动 minikube 失败的解决办法
在尝试启动Minikube时遇到初始化失败的错误,可能由于 kubelet 或系统配置问题。通过指定 Kubernetes 版本 (`--kubernetes-version=v1.23.8`) 和镜像国家 (`--image-mirror-country=&#39;cn&#39;`) 启动 Minikube 可以解决问题。执行该命令后,成功启动了 Minikube 并设置了默认的 kubectl 配置。
1610 2
|
3月前
|
人工智能 自然语言处理 数据可视化
QwenWork 千问办公全场景测评:打通 PPT、网页、数据分析,一站式 AI 办公平台上手体验
随着大模型技术快速迭代,市面上绝大多数AI工具依旧停留在“对话问答输出文本”的阶段。用户拿到AI输出文字之后,还需要手动复制粘贴,切换多个软件完成排版、制作PPT、整理表格、编写网页,大量时间消耗在中转操作上。千问办公QwenWork作为面向个人与企业的一站式AI原生办公平台,依托Qwen3.8旗舰大模型,跳出单纯聊天问答的定位,主打**对话即执行,生成即所得**。用户只需要输入一句自然语言指令,就可以直接拿到PPT、Word、Excel、可交互网页、视频剪辑素材、数据分析报告等可直接交付使用的成果。产品同时覆盖网页端、桌面客户端,深度打通钉钉生态,打通个人云盘、本地文件系统、连接器、定时任务
959 0
|
6月前
|
人工智能 自然语言处理 监控
阿里云百炼大模型服务平台如何部署模型?具体流程与模型计费方式和收费标准参考
本文系统介绍了阿里云百炼平台大模型从调优到部署上线的流程。首先需完成数据准备与模型调优,生成自定义模型并获取API Key;随后在模型部署控制台选择模型与计费方式(后付费/预付费),配置推理模式、上下文长度等参数,等待服务状态变为"运行中"即部署成功。平台提供预置吞吐、模型单元、Token用量三种计费模式,分别适用于高并发生产场景、资源隔离需求及效果验证场景,支持按量与包月付费。部署后可通过OpenAI兼容API、Dify、Chatbox等多种方式调用,也可借助Gradio搭建本地Web UI,满足多样化应用需求。
|
7月前
|
人工智能 资源调度 API
阿里云百炼AI大模型平台怎么样?支持150多种主流模型、毫秒级响应及低成本API调用说明
阿里云百炼平台支持150+主流大模型(如Qwen、DeepSeek),毫秒级响应、高并发低延迟;开通即赠7000万免费Tokens,成本优、生态全、易上手,是AI API调用的高性价比选择。阿里云百炼官网:https://t.aliyun.com/U/fPVHqY
433 0
阿里云百炼AI大模型平台怎么样?支持150多种主流模型、毫秒级响应及低成本API调用说明
解决Minikube运行拉取镜像慢的问题
使用国内镜像源加速Minikube启动:先拉取阿里云托管的kicbase基础镜像,删除原有集群,再通过指定镜像和中国区镜像源启动Minikube,提升部署效率。
2036 0
|
消息中间件 Java 微服务
2025 版 Java 学习路线实战指南从入门到精通
《Java学习路线实战指南(2025版)》是一份全面的Java开发学习手册,涵盖基础环境搭建、核心语法与新特性、数据结构与算法、微服务架构、云原生技术栈、AI融合及项目实战。内容包括JDK安装配置、IntelliJ IDEA设置、Records类与模式匹配增强、LeetCode题解、Spring Cloud微服务开发、Kubernetes部署、OpenAI API调用等。结合在线商城系统案例,采用Vue 3、Spring Boot 3.5、MySQL、Elasticsearch等技术,提供从理论到实践的完整路径,助力开发者掌握2025年最新趋势与最佳实践。
1059 4
|
机器学习/深度学习 人工智能 算法
深度解析:基于卷积神经网络的宠物识别
宠物识别技术随着饲养规模扩大而兴起,传统手段存在局限性,基于卷积神经网络的宠物识别技术应运而生。快瞳AI通过优化MobileNet-SSD架构、多尺度特征融合及动态网络剪枝等技术,实现高效精准识别。其在智能家居、宠物医疗和防走失领域展现广泛应用前景,为宠物管理带来智能化解决方案,推动行业迈向新高度。
1551 66
|
Oracle 安全 关系型数据库
【Oracle】使用Navicat Premium连接Oracle数据库两种方法
以上就是两种使用Navicat Premium连接Oracle数据库的方法介绍,希望对你有所帮助!
3057 28
|
SQL 监控 关系型数据库
PostgreSQL普通表转换成分区表
如何使用pg_rewrite扩展将普遍表转换成分区表
|
人工智能 自然语言处理 前端开发
VideoChat:高效学习新神器!一键解读音视频内容,结合 AI 生成总结内容、思维导图和智能问答
VideoChat 是一款智能音视频内容解读助手,支持批量上传音视频文件并自动转录为文字。通过 AI 技术,它能快速生成内容总结、详细解读和思维导图,并提供智能对话功能,帮助用户更高效地理解和分析音视频内容。
1564 6
VideoChat:高效学习新神器!一键解读音视频内容,结合 AI 生成总结内容、思维导图和智能问答

热门文章

最新文章