纯粹的原始方法是使用磁盘使用(du) Unix 命令行。
壳到你的吊舱:
$ kubectl exec -it <pod-id> sh
将 dirs 更改为临时存储的挂载点(如果您使用的是卷挂载):
$ mount # check mount points if you'd like
$ cd /mnt/of/ephemeral
$ du .
如果您不使用卷挂载:
$ du .
您可以使用其他工具来获取指标:
cAdvisor还嵌入到 kubelet 代码中,暴露在/stats/summary
or/metrics
端点下。更多信息在这里。示例输出:
$ curl -k -H 'Authorization: Bearer <Redacted>' \
https://node-hostname:10250/stats/summary
{
"node": {
"nodeName": "node-hostname",
"systemContainers": [
{
"name": "kubelet",
...
"volume": [
{
"time": "2018-11-08T23:52:03Z",
"availableBytes": 1969168384,
"capacityBytes": 1969180672,
"usedBytes": 12288,
"inodesFree": 480748,
"inodes": 480757,
"inodesUsed": 9,
"name": "kube-proxy-token-pprwb"
}
],
"ephemeral-storage": {
"time": "2018-11-09T00:05:10Z",
"availableBytes": 31057477632,
"capacityBytes": 41567858688,
"inodesFree": 4873887,
"inodes": 5120000
}
...
}
相似地:
$ curl -k -H 'Authorization: Bearer <Redacted>' \
https://node-hostname:10250/stats/summary
# HELP apiserver_audit_event_total Counter of audit events generated and sent to the audit backend.
# TYPE apiserver_audit_event_total counter
apiserver_audit_event_total 0
# HELP apiserver_client_certificate_expiration_seconds Distribution of the remaining lifetime on the certificate used to authenticate a request.
# TYPE apiserver_client_certificate_expiration_seconds histogram
apiserver_client_certificate_expiration_seconds_bucket{le="0"} 0
apiserver_client_certificate_expiration_seconds_bucket{le="21600"} 0
apiserver_client_certificate_expiration_seconds_bucket{le="43200"} 0
...
有关kubelet 身份验证/授权的更多信息。
普罗米修斯
有关 K8s 指标的更多信息,请点击此处。