K8S CAvisor组件-获取到容器相关的监控指标
获取secret
[root@oa-k8s-dje2s ~]# k get secret -n monitoring
NAME TYPE DATA AGE
alertmanager-prometheus-operator-hw-alertmanager Opaque 1 189d
default-secret kubernetes.io/dockerconfigjson 1 196d
default-token-hr2pp kubernetes.io/service-account-token 3 196d
paas.elb cfe/secure-opaque 3 196d
prometheus-operator-admission Opaque 3 196d
prometheus-operator-hw-admission Opaque 3 189d
prometheus-operator-hw-alertmanager-token-jmscx kubernetes.io/service-account-token 3 189d
prometheus-operator-hw-grafana Opaque 3 189d
prometheus-operator-hw-grafana-test-token-mt7dz kubernetes.io/service-account-token 3 189d
prometheus-operator-hw-grafana-token-mj7mh kubernetes.io/service-account-token 3 189d
prometheus-operator-hw-kube-state-metrics-token-ppkc6 kubernetes.io/service-account-token 3 189d
prometheus-operator-hw-operator-token-w4tcx kubernetes.io/service-account-token 3 189d
prometheus-operator-hw-prometheus-node-exporter-token-snhzf kubernetes.io/service-account-token 3 189d
prometheus-operator-hw-prometheus-scrape-confg Opaque 1 32m
prometheus-operator-hw-prometheus-token-5pqkj kubernetes.io/service-account-token 3 189d
prometheus-prometheus-operator-hw-prometheus Opaque 1 189d
prometheus-prometheus-operator-hw-prometheus-tls-assets Opaque 0 189d
sh.helm.release.v1.prometheus-operator-hw.v10 helm.sh/release.v1 1 9h
sh.helm.release.v1.prometheus-operator-hw.v11 helm.sh/release.v1 1 5h32m
sh.helm.release.v1.prometheus-operator-hw.v12 helm.sh/release.v1 1 5h24m
sh.helm.release.v1.prometheus-operator-hw.v13 helm.sh/release.v1 1 33m
sh.helm.release.v1.prometheus-operator-hw.v4 helm.sh/release.v1 1 141d
sh.helm.release.v1.prometheus-operator-hw.v5 helm.sh/release.v1 1 141d
sh.helm.release.v1.prometheus-operator-hw.v6 helm.sh/release.v1 1 141d
sh.helm.release.v1.prometheus-operator-hw.v7 helm.sh/release.v1 1 141d
sh.helm.release.v1.prometheus-operator-hw.v8 helm.sh/release.v1 1 138d
sh.helm.release.v1.prometheus-operator-hw.v9 helm.sh/release.v1 1 9h
查看对应秘钥
[root@oa-k8s-dje2s ~]# k describe secret -n monitoring prometheus-operator-hw-prometheus-token-5pqkj
Name: prometheus-operator-hw-prometheus-token-5pqkj
Namespace: monitoring
Labels: <none>
Annotations: kubernetes.io/service-account.name: prometheus-operator-hw-prometheus
kubernetes.io/service-account.uid: 74aa9807-8e61-437f-9ea9-22931617c63d
Type: kubernetes.io/service-account-token
Data
====
token: eyJhbGciOiJSUzI1NiIsImtpZCI6IkdHUUkxUXpBRDVlV3JTV0U5dVhyeW8xRTRVckdXeGhjai1WQnpWb1FQZE0ifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJtb25pdG9yaW5nIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6InByb21ldGhldXMtb3BlcmF0b3ItaHctcHJvbWV0aGV1cy10b2tlbi01cHFraiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJwcm9tZXRoZXVzLW9wZXJhdG9yLWh3LXByb21ldGhldXMiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI3NGFhOTgwNy04ZTYxLTQzN2YtOWVhOS0yMjkzMTYxN2M2M2QiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6bW9uaXRvcmluZzpwcm9tZXRoZXVzLW9wZXJhdG9yLWh3LXByb21ldGhldXMifQ.n84fSNwAdLcvG1WrOVpJscrIur27atwZQHtkdm8AZ5DcumYcStMIscpbNsfMjgmAwt1ABBl0-y6vcLwup7lVvDtIeoCRnGs6hTU6Gu_iUsUP1AzeLtRVqDkDR6w0uMLgAjFVtIG9fNgBo7Zpo1-apWqvmbbXeZ4Sl5Ist7uBEuTd9-Kht7DmglsaejRCbW3Rifz5A_cWiuofcMTvIRN4sNHIBkPU1poIGQ9WrD0jMzGIS_vBplQ68colQcJkRubWmjtgrE5ciQrR02Vbf4EFT1bFzqznqaJlat2wGj4brswb_L0_ra1GxYrhXiymuzknw6pBK4F-uYY7sW5ZRX_Pdw
ca.crt: 1082 bytes
namespace: 10 bytes
获取metrics指标
[root@oa-k8s-prod04 ~]# curl https://192.168.32.18:10250/metrics/cadvisor -k -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkdHUUkxUXpBRDVlV3JTV0U5dVhyeW8xRTRVckdXeGhjai1WQnpWb1FQZE0ifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJtb25pdG9yaW5nIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6InByb21ldGhldXMtb3BlcmF0b3ItaHctcHJvbWV0aGV1cy10b2tlbi01cHFraiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJwcm9tZXRoZXVzLW9wZXJhdG9yLWh3LXByb21ldGhldXMiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI3NGFhOTgwNy04ZTYxLTQzN2YtOWVhOS0yMjkzMTYxN2M2M2QiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6bW9uaXRvcmluZzpwcm9tZXRoZXVzLW9wZXJhdG9yLWh3LXByb21ldGhldXMifQ.n84fSNwAdLcvG1WrOVpJscrIur27atwZQHtkdm8AZ5DcumYcStMIscpbNsfMjgmAwt1ABBl0-y6vcLwup7lVvDtIeoCRnGs6hTU6Gu_iUsUP1AzeLtRVqDkDR6w0uMLgAjFVtIG9fNgBo7Zpo1-apWqvmbbXeZ4Sl5Ist7uBEuTd9-Kht7DmglsaejRCbW3Rifz5A_cWiuofcMTvIRN4sNHIBkPU1poIGQ9WrD0jMzGIS_vBplQ68colQcJkRubWmjtgrE5ciQrR02Vbf4EFT1bFzqznqaJlat2wGj4brswb_L0_ra1GxYrhXiymuzknw6pBK4F-uYY7sW5ZRX_Pdw"
指标信息
如对您有帮助,支持下呗!
微信
支付宝