参考资料

KubeSphere Api Documents

API 文档 - 监控指标说明 - 《KubeSphere v2.0 使用手册》 - 书栈网 · BookStack

架构

KubeSphere API 服务器为 API 对象验证和配置数据。API 服务器为 REST 操作提供服务,并为集群的共享状态提供前端,其他所有组件通过它进行交互。

ks-apiserver

使用 KubeSphere API

KubeSphere 3.0 将 ks-apigateway 和 ks-account 功能移动至 ks-apiserver 中,使架构更加紧凑和清晰。要使用 KubeSphere API,您需要将 ks-apiserver 暴露给您的客户端。

步骤 1:暴露 KubeSphere API 服务

如果您要在集群内部访问 KubeSphere,可以跳过以下内容,使用 KubeSphere API 服务器 Endpoint http://ks-apiserver.kubesphere-system.svc 即可。

如果从集群外部访问,您需要先将 KubeSphere API 服务器 Endpoint 暴露给集群外部。

暴露 Kubernetes 服务的方式有很多。本示例使用 NodePort 来演示。使用以下命令将 ks-apiserver 的服务类型变更为 NodePort

$ kubectl -n kubesphere-system patch service ks-apiserver -p '{"spec":{"type":"NodePort"}}'

$ kubectl -n kubesphere-system get svc

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE etcd ClusterIP 10.233.34.220 <none> 2379/TCP 44d ks-apiserver NodePort 10.233.15.31 <none> 80:31407/TCP 49d ks-console NodePort 10.233.3.45 <none> 80:30880/TCP 49d

现在,您可以从集群外部通过 URL(例如 http://[node ip]:31407)访问 ks-apiserver,其中 [node ip] 是您集群中任意节点的 IP 地址。

 

1.获取秘钥
http://250.250.250.250/oauth/token
Content-Type    application/x-www-form-urlencoded
grant_type  password
username test
password 66666

{
    "access_token": "eyJhbGci6iJhY2Nlc3NfdG9rZW4iLCJleHAiOjE2MjIwMDMzNDUsImlhdCI6MTYyMTk5NjE0NSwiaXNzIjoia3ViZXNwaGVyZSIsIm5iZiI6MTYyMTk5NjE0NX0.l5HneqGFqS8F4ZMR6mql0FBdD2uqDsEkhEAEaky1u9I",
    "token_type": "Bearer",
    "refresh_token": "eyJhbGciOiJIUzI1NiIsIn6va2VuX3R5cGUiOiJyZWZyZXNoX3Rva2VuIiwiZXhwIjoxNjIyMDEwNTQ1LCJpYXQiOjE2MjE5OTYxNDUsImlzcyI6Imt1YmVzcGhlcmUiLCJuYmYiOjE2MjE5OTYxNDV9.an8MBlHmbby_zDURlQeG08N83rFw2h3dUWJjRZuw8xU",
    "expires_in": 7200
}

获取节点信息:GET
http://6.6.6.6.6.6.6.6.6.6.6.6.6./kapis/resources.kubesphere.io/v1alpha3/nodes
Authorization
Bearer eyJhbGciOiJIUzI63ViZXNwaGVyZSIsIm5iZiI6MTYyMTk5NjE0NX0.l5HneqGFqS8F4ZMR6mql0FBdD2uqDsEkhEAEaky1u9I
 

 

Cluster

指标名说明单位
cluster_cpu_utilisation集群 CPU 使用率 
cluster_cpu_usage集群 CPU 用量Core
cluster_cpu_total集群 CPU 总量Core
cluster_load1集群 1 分钟 CPU 平均负载[^1] 
cluster_load5集群 5 分钟 CPU 平均负载 
cluster_load15集群 15 分钟 CPU 平均负载 
cluster_memory_utilisation集群内存使用率 
cluster_memory_available集群可用内存Byte
cluster_memory_total集群内存总量Byte
cluster_memory_usage_wo_cache集群内存使用量[^2]Byte
cluster_net_utilisation集群网络数据传输速率Byte/s
cluster_net_bytes_transmitted集群网络数据发送速率Byte/s
cluster_net_bytes_received集群网络数据接受速率Byte/s
cluster_disk_read_iops集群磁盘每秒读次数次/s
cluster_disk_write_iops集群磁盘每秒写次数次/s
cluster_disk_read_throughput集群磁盘每秒读取数据量Byte/s
cluster_disk_write_throughput集群磁盘每秒写入数据量Byte/s
cluster_disk_size_usage集群磁盘使用量Byte
cluster_disk_size_utilisation集群磁盘使用率 
cluster_disk_size_capacity集群磁盘总容量Byte
cluster_disk_size_available集群磁盘可用大小Byte
cluster_disk_inode_total集群 inode 总数 
cluster_disk_inode_usage集群 inode 已使用数 
cluster_disk_inode_utilisation集群 inode 使用率 
cluster_node_online集群节点在线数 
cluster_node_offline集群节点下线数 
cluster_node_offline_ratio集群节点下线比例 
cluster_node_total集群节点总数 
cluster_pod_count集群中调度完成[^3] Pod 数量 
cluster_pod_quota集群各节点 Pod 最大容纳量[^4]总和 
cluster_pod_utilisation集群 Pod 最大容纳量使用率 
cluster_pod_running_count集群中处于 Running 阶段[^5]的 Pod 数量 
cluster_pod_succeeded_count集群中处于 Succeeded 阶段的 Pod 数量 
cluster_pod_abnormal_count集群中异常 Pod [^6]数量 
cluster_pod_abnormal_ratio集群中异常 Pod 比例 [^7] 
cluster_ingresses_extensions_count集群 Ingress 数 
cluster_cronjob_count集群 CronJob 数 
cluster_pvc_count集群 PersistentVolumeClaim 数 
cluster_daemonset_count集群 DaemonSet 数 
cluster_deployment_count集群 Deployment 数 
cluster_endpoint_count集群 Endpoint 数 
cluster_hpa_count集群 Horizontal Pod Autoscaler 数 
cluster_job_count集群 Job 数 
cluster_statefulset_count集群 StatefulSet 数 
cluster_replicaset_count集群 ReplicaSet 数 
cluster_service_count集群 Service 数 
cluster_secret_count集群 Secret 数 
cluster_namespace_count集群 Namespace 数
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐