最新更新: 2022-06-23 09:41:33
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar

启用计费

本教程介绍如何启用 KubeSphere 的计费功能,以查看集群中不同资源的消费情况。计费功能默认不启用,因此您需要在 ConfigMap 中手动添加价格信息。

请按照以下步骤启用 KubeSphere 的计费功能。

  1. 执行以下命令编辑 ConfigMap kubesphere-config

    kubectl edit cm kubesphere-config -n kubesphere-system
  2. 在该 ConfigMap 的 metering 下添加保留期限和价格信息。以下为示例配置:

    $ kubectl get cm kubesphere-config -n kubesphere-system -oyaml ... alerting: prometheusEndpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090 thanosRulerEndpoint: http://thanos-ruler-operated.kubesphere-monitoring-system.svc:10902 thanosRuleResourceLabels: thanosruler=thanos-ruler,role=thanos-alerting-rules ... metering: retentionDay: 7d billing: priceInfo: currencyUnit: "USD" cpuPerCorePerHour: 1.5 memPerGigabytesPerHour: 5 ingressNetworkTrafficPerMegabytesPerHour: 1 egressNetworkTrafficPerMegabytesPerHour: 1 pvcPerGigabytesPerHour: 2.1 kind: ConfigMap ...

    相关参数描述如下:

    参数 描述
    retentionDay retentionDay 决定用户的资源消费统计页面显示的日期范围。该参数的值必须与 Prometheusretention 的值相同.
    currencyUnit 资源消费统计页面显示的货币单位。目前可用的单位有 CNY(人民币)和 USD(美元)。若指定其他货币,控制台将默认以美元为单位显示消费情况。
    cpuCorePerHour 每核/小时的 CPU 单价。
    memPerGigabytesPerHour 每 GB/小时的内存单价。
    ingressNetworkTrafficPerMegabytesPerHour 每 MB/小时的入站流量单价。
    egressNetworkTrafficPerMegabytesPerHour 每 MB/小时的出站流量单价。
    pvcPerGigabytesPerHour 每 GB/小时的 PVC 单价。请注意,无论实际使用的存储是多少,KubeSphere 都会根据 PVC 请求的存储容量来计算存储卷的总消费情况。
  3. 执行以下命令重启 ks-apiserver

    kubectl rollout restart deploy ks-apiserver -n kubesphere-system
  4. 资源消费统计页面,您可以看到资源的消费信息。

通过邮件接收 KubeSphere 最新的技术博客与产品更新的通知


页面内容

当前版本已经不再维护,将在 10 秒钟后重定向到 kubesphere.io 获取最新版本。