mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-03 04:41:10 +00:00
Add basic design for how metrics service works in Kata 2.0. Signed-off-by: bin liu <bin@hyper.sh>
133 lines
2.5 KiB
YAML
133 lines
2.5 KiB
YAML
apiVersion: v1
|
|
kind: Namespace
|
|
metadata:
|
|
name: prometheus
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
kind: ClusterRole
|
|
metadata:
|
|
name: prometheus
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources:
|
|
- nodes
|
|
- nodes/proxy
|
|
- services
|
|
- endpoints
|
|
- pods
|
|
verbs: ["get", "list", "watch"]
|
|
- apiGroups:
|
|
- extensions
|
|
resources:
|
|
- ingresses
|
|
verbs: ["get", "list", "watch"]
|
|
- nonResourceURLs: ["/metrics"]
|
|
verbs: ["get"]
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: prometheus
|
|
namespace: prometheus
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: prometheus
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: ClusterRole
|
|
name: prometheus
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: prometheus
|
|
namespace: prometheus
|
|
|
|
---
|
|
|
|
kind: Service
|
|
apiVersion: v1
|
|
metadata:
|
|
name: prometheus
|
|
namespace: prometheus
|
|
labels:
|
|
app: prometheus
|
|
spec:
|
|
type: NodePort
|
|
selector:
|
|
app: prometheus
|
|
ports:
|
|
- port: 9090
|
|
targetPort: 9090
|
|
name: http
|
|
nodePort: 30909
|
|
protocol: TCP
|
|
|
|
---
|
|
|
|
kind: Deployment
|
|
apiVersion: apps/v1
|
|
metadata:
|
|
name: prometheus
|
|
namespace: prometheus
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: prometheus
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: prometheus
|
|
spec:
|
|
serviceAccountName: prometheus
|
|
containers:
|
|
- name: prometheus
|
|
image: prom/prometheus:v2.7.1
|
|
ports:
|
|
- containerPort: 9090
|
|
volumeMounts:
|
|
- name: prometheus-config-volume
|
|
mountPath: /etc/prometheus/prometheus.yml
|
|
subPath: prometheus.yml
|
|
volumes:
|
|
- name: prometheus-config-volume
|
|
configMap:
|
|
name: prometheus-config
|
|
restartPolicy: Always
|
|
|
|
---
|
|
|
|
kind: ConfigMap
|
|
apiVersion: v1
|
|
metadata:
|
|
name: prometheus-config
|
|
namespace: prometheus
|
|
data:
|
|
prometheus.yml: |
|
|
# my global config
|
|
global:
|
|
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
|
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
|
|
|
|
scrape_configs:
|
|
- job_name: 'kubernetes-pods'
|
|
kubernetes_sd_configs:
|
|
- role: pod
|
|
namespaces:
|
|
names:
|
|
- kata-system
|
|
|
|
relabel_configs:
|
|
# Example relabel to scrape only pods that have
|
|
# "prometheus.io/scrape: true" annotation.
|
|
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
|
|
action: keep
|
|
regex: true
|