Enable Billing
This tutorial demonstrates how to enable KubeSphere Billing to view the cost of different resources in your cluster. By default, the Billing function is disabled so you need to manually add the price information in a ConfigMap.
Perform the following steps to enable KubeSphere Billing.
Run the following command to edit the ConfigMap
kubesphere-config
:kubectl edit cm kubesphere-config -n kubesphere-system
Add the retention day and price information under
metering
in the ConfigMap. The following is an example for your reference:$ 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
...
The following table describes the parameters.
Parameter Description retentionDay
retentionDay
determines the date range displayed on the Metering and Billing page for users. The value of this parameter must be the same as the value ofretention
in Prometheus.currencyUnit
The currency that is displayed on the Metering and Billing page. Currently allowed values are CNY
(Renminbi) andUSD
(US dollars). If you specify other currencies, the console will display cost in USD by default.cpuCorePerHour
The unit price of CPU per core/hour. memPerGigabytesPerHour
The unit price of memory per GB/hour. ingressNetworkTrafficPerMegabytesPerHour
The unit price of ingress traffic per MB/hour. egressNetworkTrafficPerMegabytesPerHour
The unit price of egress traffic per MB/hour. pvcPerGigabytesPerHour
The unit price of PVC per GB/hour. Note that KubeSphere calculates the total cost of volumes based on the storage capacity PVCs request regardless of the actual storage in use. Run the following command to restart
ks-apiserver
:kubectl rollout restart deploy ks-apiserver -n kubesphere-system
On the Metering and Billing page, you can see the cost information of resources.
Feedback
Was this page Helpful?
Yes No
当前内容版权归 KubeSphere 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 KubeSphere .