报错信息:
KubeControllerManager has disappeared from Prometheus target discovery.
集群版本:
- k8s 1.18
- kube-prometheusr elease1.6
- docker 19.3
根据ServiceMonitor—> Service—>endpoints(pod) 服务发现机制查看到KubeControllerManager没有对应的svc 所以我们需要创建svc,配置文件如下:
kind: Service
apiVersion: v1
metadata:
name: kube-controller-manager
labels:
k8s-app: kube-controller-manager
namespace: kube-system
spec:
clusterIP: None
ports:
- protocol: TCP
port: 10257
targetPort: 10257
name: https-metrics
selector:
component: kube-controller-manager
重新apply下配置文件,查看prometheusr target即可
prometheusr 如果显示targetDown的话,修改配置文件/etc/kubernetes/manifests/kube-controller-manager.yaml 相关字段,保存自动重启,集群的话主节点都要修改
- --bind-address=0.0.0.0