One, kube-apiserver
1. The apiserver itself also provides the /metrics api to provide monitoring data
2. Based on the above information, add the following content to the prometheus configuration file
- job_name: 'kubernetes-apiserver'
static_configs:
- targets: ['10.96.0.1'] #apiserver的svc
scheme: https #访问方式,默认是http
tls_config: #因apiserver的调用需有授权认证信息
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
#授权的ca与token信息,是存放在prometheus的容器里
3. Apply the configuration file, delete the original pod, restart it again, and reload the configuration file
4. Check the data acquisition situation
二、kube-scheduler
1. Understand the current installation of kube-scheduler
2. Add the prometheus configuration file based on the above information
- job_name: 'kubernetes-scheduler'
static_configs:
- targets: ['10.3.153.200:10251']
3. Reconfigure and verify the effect