apiVersion: apps/v1
kind: Deployment
metadata: 
  name: kube-state-metrics
  namespace: kube-system
spec:
  selector:
    matchLabels: 
      "app": "kube-state-metrics"
  replicas: 1
  template:
    metadata:
      labels: 
        "app": "kube-state-metrics"
      annotations:
        prometheus.io/scrape: 'true' # 能被集群内 Prometheus 获取指标的关键表示符
        prometheus.io/port: '8080'
        prometheus.io/path: '/metrics'
    spec:
      serviceAccountName: kube-state-metrics
      containers:
      - name: kube-state-metrics
        image: quay.io/coreos/kube-state-metrics:v1.8.0
        ports:
        - name: http-metrics
          containerPort: 8080
        readinessProbe:
          httpGet: 
            path: /healthz
            port: 8080
          initialDelaySeconds: 5
          timeoutSeconds: 5

