apiVersion: v1
kind: Pod
metadata:
  name: kube-metrics
spec:
  hostNetwork: true
  containers:
  - name: kube-state-metrics
    image: gcr.io/google-containers/kube-state-metrics:v1.4.0
    ports:
      - name: http-metrics
        containerPort: 8080
    readinessProbe:
      httpGet:
        path: /healthz
        port: 8080
      initialDelaySeconds: 5
      timeoutSeconds: 5
    resources:
      requests:
        memory: 200Mi
        cpu: 100m
      limits:
        memory: 300Mi
        cpu: 200m
  - name: prometheus-to-sd
    image: gcr.io/google-containers/prometheus-to-sd:v0.9.0
    ports:
      - name: profiler
        containerPort: 6060
    command:
      - /monitor
      - --stackdriver-prefix=custom.googleapis.com
      - --source=kube-state-metrics:http://localhost:8080
      - --pod-id=$(POD_NAME)
      - --namespace-id=$(POD_NAMESPACE)
    env:
      - name: POD_NAME
        valueFrom:
          fieldRef:
            fieldPath: metadata.name
      - name: POD_NAMESPACE
        valueFrom:
          fieldRef:
            fieldPath: metadata.namespace
