Created
May 21, 2020 18:51
-
-
Save danisla/a8e970192cb2d1aa377c98d060d1dae3 to your computer and use it in GitHub Desktop.
KubeDNS Metrics Exporter to Stackdriver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2020 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: kube-dns-metrics | |
namespace: kube-system | |
spec: | |
selector: | |
k8s-app: kube-dns | |
ports: | |
- port: 10054 | |
name: metrics | |
protocol: TCP | |
targetPort: 10054 | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: kube-dns-metrics-exporter | |
namespace: kube-system | |
labels: | |
k8s-app: kube-dns-metrics-exporter | |
spec: | |
progressDeadlineSeconds: 600 | |
replicas: 1 | |
selector: | |
matchLabels: | |
k8s-app: kube-dns-metrics-exporter | |
strategy: | |
rollingUpdate: | |
maxSurge: 10% | |
maxUnavailable: 0 | |
type: RollingUpdate | |
template: | |
metadata: | |
labels: | |
k8s-app: kube-dns-metrics-exporter | |
spec: | |
serviceAccount: kube-dns | |
terminationGracePeriodSeconds: 30 | |
tolerations: | |
- key: CriticalAddonsOnly | |
operator: Exists | |
- key: components.gke.io/gke-managed-components | |
operator: Exists | |
containers: | |
- name: prometheus-to-sd | |
image: k8s.gcr.io/prometheus-to-sd:v0.4.2 | |
command: | |
- /monitor | |
- --source=kubedns:http://kube-dns-metrics.kube-system.svc.cluster.local:10054/metrics?whitelisted=probe_kubedns_latency_ms,probe_kubedns_errors,dnsmasq_misses,dnsmasq_hits | |
- --stackdriver-prefix=custom.googleapis.com/addons | |
- --api-override=https://monitoring.googleapis.com/ | |
- --pod-id=$(POD_NAME) | |
- --namespace-id=$(POD_NAMESPACE) | |
- --scrape-interval=30s | |
- --v=2 | |
env: | |
- name: POD_NAME | |
valueFrom: | |
fieldRef: | |
apiVersion: v1 | |
fieldPath: metadata.name | |
- name: POD_NAMESPACE | |
valueFrom: | |
fieldRef: | |
apiVersion: v1 | |
fieldPath: metadata.namespace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment