for service discovery to work within prometheus configuration (ServiceMonitor k8s-app) these service and endpoints should belong to kube-system namespace. Otherwise the service monitor won't fetch it.
31 lines
572 B
YAML
31 lines
572 B
YAML
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
namespace: kube-system
|
|
name: kube-controller-manager-prometheus-discovery
|
|
labels:
|
|
k8s-app: kube-controller-manager
|
|
spec:
|
|
type: ClusterIP
|
|
clusterIP: None
|
|
ports:
|
|
- name: http-metrics
|
|
port: 10252
|
|
targetPort: 10252
|
|
protocol: TCP
|
|
---
|
|
apiVersion: v1
|
|
kind: Endpoints
|
|
metadata:
|
|
namespace: kube-system
|
|
name: kube-controller-manager-prometheus-discovery
|
|
labels:
|
|
k8s-app: kube-controller-manager
|
|
subsets:
|
|
- addresses:
|
|
- ip: MINIKUBE_IP
|
|
ports:
|
|
- name: http-metrics
|
|
port: 10252
|
|
protocol: TCP
|