Commit c3fb8a35 by Frank Mai Committed by Alena Prokharchyk

Copied from v0.0.5

parent 1beff94f
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
apiVersion: v1
description: Provides monitoring for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: thxCode
email: frank@rancher.com
name: rancher-monitoring
sources:
- https://github.com/coreos/prometheus-operator
version: 0.0.6
appVersion: 0.0.6
home: https://github.com/coreos/prometheus-operator
keywords:
- operator
- prometheus
icon: https://coreos.com/sites/default/files/inline-images/Overview-prometheus_0.png
# rancher-monitoring
Installs [prometheus-operator](https://github.com/coreos/prometheus-operator) to create/configure/manage Prometheus clusters atop Kubernetes.
> **Tip**: Only use for Rancher Monitoring!!!
## Prerequisites
- Rancher 2.2+
apiVersion: v1
description: Creates Alertmanager CRD instance for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: thxCode
email: frank@rancher.com
name: alertmanager
version: 0.0.1
apiVersion: {{ template "operator_api_version" . }}
kind: Alertmanager
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ .Release.Name }}
spec:
{{- if .Values.securityContext }}
securityContext:
{{ toYaml .Values.securityContext | indent 4 }}
{{- end }}
podMetadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
baseImage: {{ template "system_default_registry" . }}{{ .Values.image.repository }}
nodeSelector:
{{- include "linux-node-selector" . | nindent 4 }}
{{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
paused: {{ .Values.paused }}
replicas: {{ .Values.replicaCount }}
logLevel: {{ .Values.logLevel }}
{{- if and .Values.resources .Values.resources.core }}
resources:
{{ toYaml .Values.resources.core | indent 4 }}
{{- end }}
retention: "{{ .Values.retention }}"
{{- if .Values.secrets }}
secrets:
{{ toYaml .Values.secrets | indent 4 }}
{{- end }}
{{- if .Values.enabledRBAC }}
serviceAccountName: {{ default (include "app.fullname" .) .Values.serviceAccountName }}
{{- end }}
{{- if or .Values.storageSpec .Values.persistence.enabled }}
storage:
volumeClaimTemplate:
{{- if .Values.persistence.name }}
metadata:
name: {{ .Values.persistence.name }}
{{- end }}
spec:
{{- if .Values.storageSpec }}
{{ toYaml .Values.storageSpec | indent 8 }}
{{- else }}
{{ if and .Values.persistence.storageClass (ne "default" .Values.persistence.storageClass) }}
storageClassName: {{ .Values.persistence.storageClass }}
{{ end }}
accessModes:
- {{ default "ReadWriteOnce" .Values.persistence.accessMode }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end }}
{{- end }}
version: "{{ .Values.image.tag }}"
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app: {{ template "app.name" . }}
alertmanager: {{ .Release.Name }}
tolerations:
{{- include "linux-node-tolerations" . | nindent 8 }}
{{- if .Values.tolerations }}
{{ toYaml .Values.tolerations | indent 4 }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: expose-alertmanager-metrics
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{ .Values.apiGroup }}: "true"
spec:
type: ClusterIP
clusterIP: None
selector:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
ports:
- name: http
port: 9093
targetPort: web
\ No newline at end of file
{{- if and .Values.enabledRBAC (not .Values.serviceAccountName) }}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
imagePullSecrets:
{{ toYaml .Values.image.pullSecrets | indent 2 }}
{{- end }}
\ No newline at end of file
{{- if not .Values.configFromSecret }}
apiVersion: v1
kind: Secret
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
data:
alertmanager.yaml: {{ toYaml .Values.config | b64enc | quote }}
{{- range $key, $val := .Values.templates }}
{{ $key }}: {{ $val | b64enc | quote }}
{{- end }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: access-alertmanager
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
kubernetes.io/cluster-service: "true"
spec:
type: ClusterIP
selector:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
ports:
- name: http
port: 80
targetPort: web
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
{{ .Values.apiGroup }}: "true"
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
endpoints:
- port: http
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
enabledRBAC: true
## The name of a secret in the same kubernetes namespace which contains the Alertmanager config
## If defined this will be used instead of the `config` block values.
## The name of the secret must be alertmanager-{{ .Release.Name }} and its data must contain, at least, a key called `alertmanager.yaml`
## that contains the configuration as value.
##
configFromSecret: ""
## Alertmanager template files to include
#
templates: {}
#
# An example template:
# template_1.tmpl: |-
# {{ define "cluster" }}{{ .ExternalURL | reReplaceAll ".*alertmanager\\.(.*)" "$1" }}{{ end }}
#
# {{ define "slack.myorg.text" }}
# {{- $root := . -}}
# {{ range .Alerts }}
# *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
# *Cluster:* {{ template "cluster" $root }}
# *Description:* {{ .Annotations.description }}
# *Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:>
# *Runbook:* <{{ .Annotations.runbook }}|:spiral_note_pad:>
# *Details:*
# {{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
# {{ end }}
## Tolerations for use with node taints
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
##
tolerations: []
# - key: "key"
# operator: "Equal"
# value: "value"
# effect: "NoSchedule"
## If true, the Operator won't process any Alertmanager configuration changes
##
paused: false
## Number of Alertmanager replicas desired
##
replicaCount: 1
## How long to retain metrics
##
retention: 24h
## List of Secrets in the same namespace as the Alertmanager
## object, which shall be mounted into the Alertmanager Pods.
## Ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec
##
secrets: []
logLevel: "info"
## Alertmanager StorageSpec for persistent data
## Ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/user-guides/storage.md
##
storageSpec: {}
# storageClassName: gluster
# accessModes: ["ReadWriteOnce"]
# resources:
# requests:
# storage: 50Gi
# selector: {}
apiVersion: v1
description: Creates ServiceMonitor CRD of coredns for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: thxCode
email: frank@rancher.com
name: exporter-coredns
version: 0.0.1
{{- if .Values.endpoints }}
apiVersion: v1
kind: Endpoints
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: expose-coredns-metrics
subsets:
- addresses:
{{- range .Values.endpoints }}
- ip: {{ . }}
{{- end }}
ports:
- name: {{ .Values.ports.metrics.name }}
port: {{ .Values.ports.metrics.port }}
protocol: {{ .Values.ports.metrics.protocol }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
name: expose-coredns-metrics
namespace: {{ .Release.Namespace }}
spec:
type: ClusterIP
clusterIP: None
ports:
- name: {{ .Values.ports.metrics.name }}
port: {{ .Values.ports.metrics.port }}
protocol: {{ .Values.ports.metrics.protocol }}
targetPort: {{ .Values.ports.metrics.port }}
{{- if not .Values.endpoints }}
selector:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
{{- end }}
\ No newline at end of file
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
namespaceSelector:
matchNames:
{{- if not .Values.endpoints }}
- "kube-system"
{{- else }}
- {{ .Release.Namespace | quote }}
{{- end }}
endpoints:
- port: {{ .Values.ports.metrics.name }}
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
scheme: {{ .Values.ports.metrics.scheme }}
{{- if eq .Values.ports.metrics.scheme "https" }}
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
{{- if .Values.insecureSkipVerify }}
insecureSkipVerify: true
{{- end }}
{{- end }}
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
apiVersion: v1
description: Creates Fluentd Metrics Exporter instance for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: aiwantaozi
email: michelia.feng@gmail.com
name: exporter-fluentd
version: 0.0.1
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
namespaceSelector:
matchNames:
- cattle-logging
endpoints:
- port: {{ .Values.ports.metrics.name }}
honorLabels: true
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
scheme: {{ .Values.ports.metrics.scheme }}
{{- if eq .Values.ports.metrics.scheme "https" }}
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
{{- if .Values.insecureSkipVerify }}
insecureSkipVerify: true
{{- end }}
{{- end }}
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
apiVersion: v1
description: Creates ServiceMonitor CRD of controller manager for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: thxCode
email: frank@rancher.com
name: exporter-kube-controller-manager
version: 0.0.1
{{- if .Values.endpoints }}
apiVersion: v1
kind: Endpoints
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: expose-kube-cm-metrics
subsets:
- addresses:
{{- range .Values.endpoints }}
- ip: {{ . }}
{{- end }}
ports:
- name: {{ .Values.ports.metrics.name }}
port: {{ .Values.ports.metrics.port }}
protocol: {{ .Values.ports.metrics.protocol }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
name: expose-kube-cm-metrics
namespace: {{ .Release.Namespace }}
spec:
type: ClusterIP
clusterIP: None
ports:
- name: {{ .Values.ports.metrics.name }}
port: {{ .Values.ports.metrics.port }}
protocol: {{ .Values.ports.metrics.protocol }}
targetPort: {{ .Values.ports.metrics.port }}
{{- if not .Values.endpoints }}
selector:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
{{- end }}
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
namespaceSelector:
matchNames:
{{- if not .Values.endpoints }}
- "kube-system"
{{- else }}
- {{ .Release.Namespace | quote }}
{{- end }}
endpoints:
- port: {{ .Values.ports.metrics.name }}
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
scheme: {{ .Values.ports.metrics.scheme }}
{{- if eq .Values.ports.metrics.scheme "https" }}
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
{{- if .Values.insecureSkipVerify }}
insecureSkipVerify: true
{{- end }}
{{- end }}
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
apiVersion: v1
description: Creates ServiceMonitor CRD of kube-dns for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: thxCode
email: frank@rancher.com
name: exporter-kube-dns
version: 0.0.1
{{- if .Values.endpoints }}
apiVersion: v1
kind: Endpoints
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: expose-kube-dns-metrics
subsets:
- addresses:
{{- range .Values.endpoints }}
- ip: {{ . }}
{{- end }}
ports:
- name: {{ .Values.ports.metrics.dnsmasq.name }}
port: {{ .Values.ports.metrics.dnsmasq.port }}
protocol: {{ .Values.ports.metrics.dnsmasq.protocol }}
- name: {{ .Values.ports.metrics.skydns.name }}
port: {{ .Values.ports.metrics.skydns.port }}
protocol: {{ .Values.ports.metrics.skydns.protocol }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
name: expose-kube-dns-metrics
namespace: {{ .Release.Namespace }}
spec:
type: ClusterIP
clusterIP: None
ports:
- name: {{ .Values.ports.metrics.dnsmasq.name }}
port: {{ .Values.ports.metrics.dnsmasq.port }}
protocol: {{ .Values.ports.metrics.dnsmasq.protocol }}
targetPort: {{ .Values.ports.metrics.dnsmasq.port }}
- name: {{ .Values.ports.metrics.skydns.name }}
port: {{ .Values.ports.metrics.skydns.port }}
protocol: {{ .Values.ports.metrics.skydns.protocol }}
targetPort: {{ .Values.ports.metrics.skydns.port }}
{{- if not .Values.endpoints }}
selector:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
{{- end }}
\ No newline at end of file
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
namespaceSelector:
matchNames:
{{- if not .Values.endpoints }}
- "kube-system"
{{- else }}
- {{ .Release.Namespace | quote }}
{{- end }}
endpoints:
- port: {{ .Values.ports.metrics.dnsmasq.name }}
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
scheme: {{ .Values.ports.metrics.dnsmasq.scheme }}
{{- if eq .Values.ports.metrics.dnsmasq.scheme "https" }}
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
{{- if .Values.insecureSkipVerify }}
insecureSkipVerify: true
{{- end }}
{{- end }}
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
- port: {{ .Values.ports.metrics.skydns.name }}
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
scheme: {{ .Values.ports.metrics.skydns.scheme }}
{{- if eq .Values.ports.metrics.skydns.scheme "https" }}
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
{{- if .Values.insecureSkipVerify }}
insecureSkipVerify: true
{{- end }}
{{- end }}
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
apiVersion: v1
description: Creates ServiceMonitor CRD of etcd for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: thxCode
email: frank@rancher.com
name: exporter-kube-etcd
version: 0.0.1
{{- if .Values.endpoints }}
apiVersion: v1
kind: Endpoints
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: expose-kube-etcd-metrics
subsets:
- addresses:
{{- range .Values.endpoints }}
- ip: {{ . }}
{{- end }}
ports:
- name: {{ .Values.ports.metrics.name }}
port: {{ .Values.ports.metrics.port }}
protocol: {{ .Values.ports.metrics.protocol }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
name: expose-kube-etcd-metrics
namespace: {{ .Release.Namespace }}
spec:
type: ClusterIP
clusterIP: None
ports:
- name: {{ .Values.ports.metrics.name }}
port: {{ .Values.ports.metrics.port }}
protocol: {{ .Values.ports.metrics.protocol }}
targetPort: {{ .Values.ports.metrics.port }}
{{- if not .Values.endpoints }}
selector:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
{{- end }}
\ No newline at end of file
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
namespaceSelector:
matchNames:
{{- if not .Values.endpoints }}
- "kube-system"
{{- else }}
- {{ .Release.Namespace | quote }}
{{- end }}
endpoints:
- port: {{ .Values.ports.metrics.name }}
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
scheme: {{ .Values.ports.metrics.scheme }}
{{- if eq .Values.ports.metrics.scheme "https" }}
tlsConfig:
caFile: {{ .Values.caFile }}
{{- if .Values.certFile }}
certFile: {{ .Values.certFile }}
{{- end }}
{{- if .Values.keyFile }}
keyFile: {{ .Values.keyFile }}
{{- end}}
{{- if .Values.insecureSkipVerify }}
insecureSkipVerify: true
{{- end }}
{{- end }}
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
apiVersion: v1
description: Creates ServiceMonitor CRD of scheduler for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: thxCode
email: frank@rancher.com
name: exporter-kube-scheduler
version: 0.0.1
{{- if .Values.endpoints }}
apiVersion: v1
kind: Endpoints
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: expose-kube-scheduler-metrics
subsets:
- addresses:
{{- range .Values.endpoints }}
- ip: {{ . }}
{{- end }}
ports:
- name: {{ .Values.ports.metrics.name }}
port: {{ .Values.ports.metrics.port }}
protocol: {{ .Values.ports.metrics.protocol }}
{{- end }}
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
name: expose-kube-scheduler-metrics
namespace: {{ .Release.Namespace }}
spec:
type: ClusterIP
clusterIP: None
ports:
- name: {{ .Values.ports.metrics.name }}
port: {{ .Values.ports.metrics.port }}
protocol: {{ .Values.ports.metrics.protocol }}
targetPort: {{ .Values.ports.metrics.port }}
{{- if not .Values.endpoints }}
selector:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
{{- end }}
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
namespaceSelector:
matchNames:
{{- if not .Values.endpoints }}
- "kube-system"
{{- else }}
- {{ .Release.Namespace | quote }}
{{- end }}
endpoints:
- port: {{ .Values.ports.metrics.name }}
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
scheme: {{ .Values.ports.metrics.scheme }}
{{- if eq .Values.ports.metrics.scheme "https" }}
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
{{- if .Values.insecureSkipVerify }}
insecureSkipVerify: true
{{- end }}
{{- end }}
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
apiVersion: v1
description: Creates Kube-state Exporter instance for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: thxCode
email: frank@rancher.com
name: exporter-kube-state
version: 0.0.1
apiVersion: {{ template "deployment_api_version" . }}
kind: Deployment
metadata:
name: {{ template "app.fullname" . }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: kube-state
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
ports:
- name: http
containerPort: 8080
- name: http-metrics
containerPort: 8081
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 30
timeoutSeconds: 30
readinessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 30
timeoutSeconds: 5
resources:
{{ toYaml .Values.resources | indent 10 }}
{{- if .Values.enabledRBAC }}
serviceAccountName: {{ default (include "app.fullname" .) .Values.serviceAccountName }}
{{- end }}
{{- if .Values.securityContext }}
securityContext:
{{ toYaml .Values.securityContext | indent 8 }}
{{- end }}
tolerations:
{{- include "linux-node-tolerations" . | nindent 8}}
{{- if .Values.tolerations }}
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
nodeSelector:
{{- include "linux-node-selector" . | nindent 8 }}
{{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
{{- if and .Values.enabledRBAC (not .Values.serviceAccountName) }}
apiVersion: {{ template "rbac_api_version" . }}
kind: ClusterRole
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
rules:
- apiGroups:
- ""
resources:
- namespaces
- nodes
- pods
- services
- resourcequotas
- replicationcontrollers
- limitranges
- persistentvolumeclaims
- persistentvolumes
- endpoints
- configmaps
- secrets
verbs:
- "list"
- "watch"
- apiGroups:
- "extensions"
- "apps"
resources:
- daemonsets
- deployments
- replicasets
verbs:
- "list"
- "watch"
- apiGroups:
- "apps"
resources:
- statefulsets
- deployments
verbs:
- "list"
- "watch"
- apiGroups:
- "batch"
resources:
- cronjobs
- jobs
verbs:
- "list"
- "watch"
- apiGroups:
- "autoscaling"
resources:
- horizontalpodautoscalers
verbs:
- "list"
- "watch"
- apiGroups:
- "policy"
resources:
- "poddisruptionbudgets"
verbs:
- "list"
- "watch"
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
imagePullSecrets:
{{ toYaml .Values.image.pullSecrets | indent 2 }}
---
apiVersion: {{ template "rbac_api_version" . }}
kind: ClusterRoleBinding
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "app.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "app.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: expose-kubernetes-metrics
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
k8s-app: kube-state
{{ .Values.apiGroup }}: "true"
spec:
type: ClusterIP
clusterIP: None
selector:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
ports:
- name: http
port: 8080
targetPort: http
- name: http-metrics
port: 8081
targetPort: http-metrics
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
{{ .Values.apiGroup }}: "true"
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
endpoints:
- port: http
honorLabels: true
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
- port: http-metrics
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
enabledRBAC: true
## Tolerations for use with node taints
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
##
tolerations: []
# - key: "key"
# operator: "Equal"
# value: "value"
# effect: "NoSchedule"
apiVersion: v1
description: Creates ServiceMonitor CRD of kublets for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: thxCode
email: frank@rancher.com
name: exporter-kubelets
version: 0.0.1
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "charts.exporter-kubelets.fullname" . }}
spec:
selector:
matchLabels:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
endpoints:
{{- if .Values.https }}
- port: https-metrics
scheme: https
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
{{- if .Values.insecureSkipVerify }}
insecureSkipVerify: true
{{- end }}
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
- port: https-metrics
scheme: https
path: /metrics/cadvisor
honorLabels: true
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
{{- if .Values.insecureSkipVerify }}
insecureSkipVerify: true
{{- end }}
metricRelabelings:
- action: labeldrop
regex: (^id$|^image$|^name$|^cpu$)
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
- port: https-metrics
scheme: https
path: /metrics/resource/v1alpha1
honorLabels: true
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
{{- if .Values.insecureSkipVerify }}
insecureSkipVerify: true
{{- end }}
metricRelabelings:
- action: replace
regex: (.+)
replacement: $1
sourceLabels:
- container
targetLabel: container_name
- action: replace
regex: (.+)
replacement: $1
sourceLabels:
- pod
targetLabel: pod_name
{{- else }}
- port: http-metrics
metricRelabelings:
- action: labeldrop
regex: (^id$|^image$|^name$|^cpu$)
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
- port: http-metrics
path: /metrics/cadvisor
honorLabels: true
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
- port: http-metrics
path: /metrics/resource/v1alpha1
honorLabels: true
metricRelabelings:
- action: replace
regex: (.+)
replacement: $1
sourceLabels:
- container
targetLabel: container_name
- action: replace
regex: (.+)
replacement: $1
sourceLabels:
- pod
targetLabel: pod_name
{{- end }}
apiVersion: v1
description: Creates ServiceMonitor CRD of apiserver for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: thxCode
email: frank@rancher.com
name: exporter-kubernetes
version: 0.0.1
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
{{- range .Values.serviceSelectorLabels }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
namespaceSelector:
matchNames:
- "default"
endpoints:
- port: {{ .Values.ports.metrics.name }}
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
scheme: {{ .Values.ports.metrics.scheme }}
{{- if eq .Values.ports.metrics.scheme "https" }}
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
{{- if .Values.insecureSkipVerify }}
insecureSkipVerify: true
{{- end }}
{{- end }}
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
action: replace
targetLabel: host_ip
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
action: replace
targetLabel: node
regex: (.+)
replacement: $1
apiVersion: v1
description: Windows Node Exporter service/endpoint and service monitor.
engine: gotpl
maintainers:
- name: michelia
email: michelia@rancher.com
name: exporter-node-windows
version: 0.0.1
\ No newline at end of file
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "app.fullname" . }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
data:
copy-binary.ps1: |-
$ErrorActionPreference = 'Stop'
function Create-Directory
{
param (
[parameter(Mandatory = $false, ValueFromPipeline = $true)] [string]$Path
)
if (Test-Path -Path $Path) {
if (-not (Test-Path -Path $Path -PathType Container)) {
# clean the same path file
Remove-Item -Recurse -Force -Path $Path -ErrorAction Ignore | Out-Null
}
return
}
New-Item -Force -ItemType Directory -Path $Path | Out-Null
}
function Transfer-File
{
param (
[parameter(Mandatory = $true)] [string]$Src,
[parameter(Mandatory = $true)] [string]$Dst
)
if (Test-Path -PathType leaf -Path $Dst) {
$dstHasher = Get-FileHash -Path $Dst
$srcHasher = Get-FileHash -Path $Src
if ($dstHasher.Hash -eq $srcHasher.Hash) {
return
}
}
$null = Copy-Item -Force -Path $Src -Destination $Dst
}
Create-Directory -Path "c:\host\etc\wmi-exporter"
Transfer-File -Src "c:\etc\wmi-exporter\wmi-exporter.exe" -Dst "c:\host\etc\wmi-exporter\wmi-exporter.exe"
apiVersion: {{ template "daemonset_api_version" . }}
kind: DaemonSet
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
spec:
initContainers:
- name: exporter-node-binary-copy
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
command:
- pwsh
- -f
- c:/scripts/copy-binary.ps1
{{- if and .Values.resources .Values.resources.inits }}
resources:
{{ toYaml .Values.resources.inits | indent 10 }}
{{- end }}
volumeMounts:
- name: binary-host-path
mountPath: c:/host/etc/wmi-exporter
- name: exporter-scripts
mountPath: c:/scripts/
containers:
- name: exporter-node
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
{{- if .Values.args }}
args: {{ .Values.args }}
{{ end }}
ports:
- name: http
containerPort: {{ .Values.ports.metrics.port }}
env:
- name: LISTEN_PORT
value: "{{ .Values.ports.metrics.port }}"
{{- if .Values.enabledCollectors }}
- name: ENABLED_COLLECTORS
value: {{ .Values.enabledCollectors }}
{{- end }}
{{- if .Values.extraEnv }}
{{ toYaml .Values.extraEnv | indent 10 }}
{{- end }}
{{- if and .Values.resources .Values.resources.core }}
resources:
{{ toYaml .Values.resources.core | indent 10 }}
{{- end }}
volumeMounts:
- name: wins-pipe
mountPath: \\.\pipe\rancher_wins
{{- if .Values.enabledRBAC }}
serviceAccountName: {{ default (include "app.fullname" .) .Values.serviceAccountName }}
{{- end }}
tolerations:
- operator: Exists
nodeSelector:
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion }}
beta.kubernetes.io/os: windows
{{- else}}
kubernetes.io/os: windows
{{- end}}
{{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
volumes:
- name: wins-pipe
hostPath:
path: \\.\pipe\rancher_wins
- name: binary-host-path
hostPath:
path: c:/etc/wmi-exporter
type: DirectoryOrCreate
- name: exporter-scripts
configMap:
name: {{ template "app.fullname" . }}
{{- if .Values.endpoints }}
apiVersion: v1
kind: Endpoints
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: expose-node-metrics-windows
subsets:
- addresses:
{{- range .Values.endpoints }}
- ip: {{ . }}
{{- end }}
ports:
- name: {{ .Values.ports.metrics.name }}
port: {{ .Values.ports.metrics.port }}
protocol: {{ .Values.ports.metrics.protocol }}
{{- end }}
\ No newline at end of file
{{- if and .Values.enabledRBAC (not .Values.serviceAccountName) }}
apiVersion: {{ template "rbac_api_version" . }}
kind: ClusterRole
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
rules:
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
imagePullSecrets:
{{ toYaml .Values.image.pullSecrets | indent 2 }}
---
apiVersion: {{ template "rbac_api_version" . }}
kind: ClusterRoleBinding
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "app.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "app.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: expose-node-metrics-windows
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{ .Values.apiGroup }}: "true"
spec:
type: ClusterIP
clusterIP: None
ports:
- name: {{ .Values.ports.metrics.name }}
port: {{ .Values.ports.metrics.port }}
targetPort: {{ .Values.ports.metrics.port }}
protocol: {{ .Values.ports.metrics.protocol }}
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
{{ .Values.apiGroup }}: "true"
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
endpoints:
- port: {{ .Values.ports.metrics.name }}
metricRelabelings:
- sourceLabels: [volume, nic]
regex: (.*);(.*)
separator: ''
targetLabel: device
action: replace
replacement: $1$2
- sourceLabels: [__name__]
regex: wmi_cs_logical_processors
replacement: 'system'
targetLabel: mode
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
role: windows-node-recording-rules
source: rancher-monitoring
name: windows-node-recording-rules
namespace: cattle-prometheus
spec:
groups:
- name: windows-cpu-recording.rules
rules:
- record: node_cpu_seconds_total
expr: wmi_cpu_time_total
- record: node_load1
expr: avg_over_time(wmi_system_processor_queue_length[1m])
- record: node_load5
expr: avg_over_time(wmi_system_processor_queue_length[5m])
- record: node_load15
expr: avg_over_time(wmi_system_processor_queue_length[15m])
- record: node_load15
expr: avg_over_time(wmi_system_processor_queue_length[15m])
- name: windows-memory-recording.rules
rules:
- record: node_memory_MemAvailable_bytes
expr: wmi_os_physical_memory_free_bytes
- record: node_memory_MemTotal_bytes
expr: wmi_cs_physical_memory_bytes
- name: windows-network-io-recording.rules
rules:
- record: node_network_receive_bytes_total
expr: wmi_net_bytes_received_total
- record: node_network_transmit_bytes_total
expr: wmi_net_bytes_sent_total
- name: windows-network-packet-recording.rules
rules:
- record: node_network_receive_packets_total
expr: wmi_net_packets_received_total
- record: node_network_transmit_packets_total
expr: wmi_net_packets_sent_total
- record: node_network_receive_drop_total
expr: wmi_net_packets_received_discarded
- record: node_network_receive_errs_total
expr: wmi_net_packets_received_errors
- record: node_network_transmit_drop_total
expr: wmi_net_packets_outbound_discarded
- name: windows-disk-io-recording.rules
rules:
- record: node_disk_written_bytes_total
expr: wmi_logical_disk_write_bytes_total
- record: node_disk_read_bytes_total
expr: wmi_logical_disk_read_bytes_total
- name: windows-file-usage-recording.rules
rules:
- record: node_filesystem_size_bytes
expr: wmi_logical_disk_size_bytes
- record: node_filesystem_free_bytes
expr: wmi_logical_disk_free_bytes
\ No newline at end of file
enabledRBAC: true
# Get more details on https://github.com/martinlindhe/wmi_exporter
enabledCollectors: "net,os,service,system,cpu,cs,logical_disk,tcp,memory,container"
\ No newline at end of file
apiVersion: v1
description: Creates Node Exporter instance for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: thxCode
email: frank@rancher.com
name: exporter-node
version: 0.0.1
\ No newline at end of file
apiVersion: {{ template "daemonset_api_version" . }}
kind: DaemonSet
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: exporter-node
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
args:
- --web.listen-address=0.0.0.0:{{ .Values.ports.metrics.port }}
- --path.procfs=/host/proc
- --path.sysfs=/host/sys
- --path.rootfs=/host
{{- $usingCollectors := merge .Values.collectors .Values.defaultCollectorSettings }}
{{- range $collectorName, $collectorVal := $usingCollectors }}
{{- if and $collectorVal $collectorVal.enabled }}
- --collector.{{ $collectorName }}
{{- $_ := unset $collectorVal "enabled" -}}
{{- if $collectorVal }}
{{- range $collectorValKey, $collectorValVal := $collectorVal }}
{{- if $collectorValVal }}
- --collector.{{ $collectorName }}.{{ $collectorValKey }}={{ $collectorValVal }}
{{- else }}
- --collector.{{ $collectorName }}.{{ $collectorValKey }}
{{- end }}
{{- end }}
{{- end }}
{{- else }}
- --no-collector.{{$collectorName}}
{{- end }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.ports.metrics.port }}
{{- if .Values.enabledHostNetwork }}
hostPort: {{ .Values.ports.metrics.port }}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
- name: proc
mountPath: /host/proc
readOnly: true
- name: sys
mountPath: /host/sys
readOnly: true
- name: host
mountPath: /host
readOnly: true
{{- if .Values.enabledRBAC }}
serviceAccountName: {{ default (include "app.fullname" .) .Values.serviceAccountName }}
{{- end }}
securityContext:
runAsNonRoot: true
runAsUser: 65534
tolerations:
- operator: Exists
nodeSelector:
{{- include "linux-node-selector" . | nindent 8 }}
{{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
{{- if .Values.enabledHostNetwork }}
hostNetwork: true
{{- end }}
{{- if .Values.enabledHostPID }}
hostPID: true
{{- end }}
volumes:
- name: proc
hostPath:
path: /proc
- name: sys
hostPath:
path: /sys
- name: host
hostPath:
path: /
{{- if .Values.enabledPSP }}
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ template "app.fullname" . }}
spec:
allowPrivilegeEscalation: false
fsGroup:
ranges:
- max: 65535
min: 1
rule: MustRunAs
requiredDropCapabilities:
- ALL
runAsUser:
rule: RunAsAny
seLinux:
rule: RunAsAny
supplementalGroups:
ranges:
- max: 65535
min: 1
rule: MustRunAs
volumes:
- configMap
- emptyDir
- projected
- secret
- downwardAPI
- persistentVolumeClaim
- hostPath
allowedHostPaths:
- pathPrefix: /
readOnly: true
{{- if .Values.enabledHostNetwork }}
hostNetwork: true
hostPorts:
- min: {{ .Values.ports.metrics.port }}
max: {{ .Values.ports.metrics.port }}
{{- end }}
{{- if .Values.enabledHostPID }}
hostPID: true
{{- end }}
{{- end }}
\ No newline at end of file
{{- if and .Values.enabledRBAC (not .Values.serviceAccountName) }}
apiVersion: {{ template "rbac_api_version" . }}
kind: ClusterRole
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
rules:
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
imagePullSecrets:
{{ toYaml .Values.image.pullSecrets | indent 2 }}
---
apiVersion: {{ template "rbac_api_version" . }}
kind: ClusterRoleBinding
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "app.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "app.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- if .Values.enabledPSP }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ template "app.fullname" . }}-psp-role
rules:
- apiGroups:
- extensions
- policy
resourceNames:
- {{ template "app.fullname" . }}
resources:
- podsecuritypolicies
verbs:
- use
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ template "app.fullname" . }}-psp-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "app.fullname" . }}-psp-role
subjects:
- kind: ServiceAccount
name: {{ template "app.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: expose-node-metrics
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
k8s-app: node
{{ .Values.apiGroup }}: "true"
spec:
type: ClusterIP
clusterIP: None
selector:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
ports:
- name: metrics
port: {{ .Values.ports.metrics.port }}
targetPort: {{ .Values.ports.metrics.port }}
protocol: TCP
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
{{ .Values.apiGroup }}: "true"
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
endpoints:
- port: metrics
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
enabledRBAC: true
enabledPSP: true
##
# Default collector settings
##
defaultCollectorSettings:
##
# Enabled by default on Linux
##
# Exposes ARP statistics from /proc/net/arp
arp:
enabled: true
# Exposes bcache statistics from /sys/fs/bcache/
bcache:
enabled: true
# Exposes the number of configured and active slaves of Linux bonding interfaces
bonding:
enabled: true
# Shows conntrack statistics (does nothing if no /proc/sys/net/netfilter/ present)
conntrack:
enabled: true
# Exposes CPU statistics
cpu:
enabled: true
# Exposes disk I/O statistics.
diskstats:
enabled: true
# Exposes error detection and correction statistics
edac:
enabled: true
# Exposes available entropy
entropy:
enabled: true
# Exposes file descriptor statistics from /proc/sys/fs/file-nr
filefd:
enabled: true
# Exposes filesystem statistics, such as disk space used
filesystem:
enabled: true
# Expose hardware monitoring and sensor data from /sys/class/hwmon/
hwmon:
enabled: true
# Exposes network statistics specific to InfiniBand and Intel OmniPath configurations
infiniband:
enabled: true
# Exposes IPVS status from /proc/net/ip_vs and stats from /proc/net/ip_vs_stats
ipvs:
enabled: true
# Exposes load average. Darwin, Dragonfly, FreeBSD, Linux, NetBSD, OpenBSD, Solaris
loadavg:
enabled: true
# Exposes statistics about devices in /proc/mdstat (does nothing if no /proc/mdstat present)
mdadm:
enabled: true
# Exposes memory statistics.
meminfo:
enabled: true
# Exposes network interface statistics such as bytes transferred
netdev:
enabled: true
# Exposes network statistics from /proc/net/netstat
netstat:
enabled: true
# Exposes NFS client statistics from /proc/net/rpc/nfs
nfs:
enabled: true
# Exposes NFS kernel server statistics from /proc/net/rpc/nfsd
nfsd:
enabled: true
# Exposes various statistics from /proc/net/sockstat
sockstat:
enabled: true
# Exposes various statistics from /proc/stat
stat:
enabled: true
# Exposes statistics read from local disk
textfile:
enabled: true
# Exposes the current system time
time:
enabled: true
# Exposes selected adjtimex(2) system call stats
timex:
enabled: true
# Exposes system information as provided by the uname system call
uname:
enabled: true
# Exposes statistics from /proc/vmstat
vmstat:
enabled: true
# Exposes XFS runtime statistics
xfs:
enabled: true
# Exposes ZFS performance statistics
zfs:
enabled: true
##
# Enabled by default on Linux
##
# Exposes statistics of memory fragments as reported by /proc/buddyinfo
buddyinfo:
enabled: false
# Exposes Distributed Replicated Block Device statistics (to version 8.4)
drbd:
enabled: false
# Exposes detailed interrupts statistics
interrupts:
enabled: false
# Exposes kernel and system statistics from /sys/kernel/mm/ksm
ksmd:
enabled: false
# Exposes session counts from logind
logind:
enabled: false
# Exposes memory statistics from /proc/meminfo_numa
meminfo_numa:
enabled: false
# Exposes filesystem statistics from /proc/self/mountstats, exposes detailed NFS client statistics
mountstats:
enabled: false
# Exposes local NTP daemon health to check time
ntp:
enabled: false
# Exposes aggregate process statistics from /proc
processes:
enabled: false
# Exposes queuing discipline statistics
qdisc:
enabled: false
# Exposes service status from runit
runit:
enabled: false
# Exposes service status from supervisord
supervisord:
enabled: false
# Exposes service and system status from systemd
systemd:
enabled: false
# Exposes TCP connection status information from /proc/net/tcp and /proc/net/tcp6
tcpstat:
enabled: false
# Exposes WiFi device and station statistics
wifi:
enabled: false
apiVersion: v1
description: Creates Grafana instance for Kubernetes which maintaining by Rancher 2.
engine: gotpl
maintainers:
- name: thxCode
email: frank@rancher.com
name: grafana
version: 0.0.1
{"__requires":[{"type":"grafana","id":"grafana","name":"Grafana","version":"5.3.0"},{"type":"panel","id":"graph","name":"Graph","version":"5.0.0"},{"type":"datasource","id":"prometheus","name":"Prometheus","version":"5.0.0"}],"annotations":{"list":[{"builtIn":1,"datasource":"-- Grafana --","enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations & Alerts","type":"dashboard"}]},"description":"-","editable":true,"gnetId":5508,"graphTooltip":0,"id":null,"links":[],"panels":[{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"RANCHER_MONITORING","editable":true,"error":false,"fill":1,"grid":{"threshold1Color":"rgba(216, 200, 27, 0.27)","threshold2Color":"rgba(234, 112, 112, 0.22)"},"gridPos":{"h":7,"w":12,"x":0,"y":0},"id":6,"isNew":false,"legend":{"alignAsTable":false,"avg":false,"current":false,"hideEmpty":false,"hideZero":false,"max":false,"min":false,"rightSide":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"links":[],"nullPointMode":"null","percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"expr":"sum by(instance) (rate(apiserver_request_count{code!~\"2..\"}[5m]))","format":"time_series","intervalFactor":2,"legendFormat":"Error -{{instance}} ","refId":"A","step":60},{"expr":"sum by(instance) (rate(apiserver_request_count[5m]))","format":"time_series","intervalFactor":2,"legendFormat":"Request - {{instance}}","refId":"B","step":60}],"thresholds":[],"timeFrom":null,"timeShift":null,"title":"API Server Request Rates","tooltip":{"msResolution":false,"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","logBase":1,"show":true},{"format":"short","logBase":1,"show":true}],"yaxis":{"align":false,"alignLevel":null}},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"RANCHER_MONITORING","editable":true,"error":false,"fill":1,"grid":{"threshold1Color":"rgba(216, 200, 27, 0.27)","threshold2Color":"rgba(234, 112, 112, 0.22)"},"gridPos":{"h":7,"w":12,"x":12,"y":0},"id":7,"isNew":false,"legend":{"alignAsTable":false,"avg":false,"current":false,"hideEmpty":false,"hideZero":false,"max":false,"min":false,"rightSide":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"links":[],"nullPointMode":"null","percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"expr":"avg(apiserver_request_latencies_sum / apiserver_request_latencies_count) by (instance)","format":"time_series","intervalFactor":2,"legendFormat":"","refId":"A","step":30}],"thresholds":[],"timeFrom":null,"timeShift":null,"title":"API Server Request Latency","tooltip":{"msResolution":false,"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"ns","logBase":1,"show":true},{"format":"short","logBase":1,"show":true}],"yaxis":{"align":false,"alignLevel":null}},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"RANCHER_MONITORING","fill":1,"gridPos":{"h":9,"w":12,"x":0,"y":7},"id":11,"legend":{"avg":false,"current":false,"max":false,"min":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"links":[],"nullPointMode":"null","percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"expr":"increase(nginx_ingress_controller_nginx_process_requests_total[1m])","format":"time_series","intervalFactor":1,"legendFormat":"Request Rate","refId":"A"}],"thresholds":[],"timeFrom":null,"timeShift":null,"title":"Nginx Ingress Request Rate","tooltip":{"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true},{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true}],"yaxis":{"align":false,"alignLevel":null}},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"RANCHER_MONITORING","fill":1,"gridPos":{"h":9,"w":12,"x":12,"y":7},"id":9,"legend":{"avg":false,"current":false,"max":false,"min":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"links":[],"nullPointMode":"null","percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"expr":"sum(service_depth)","format":"time_series","intervalFactor":1,"legendFormat":"Service Depth","refId":"A"},{"expr":"sum(volumes_depth)","format":"time_series","intervalFactor":1,"legendFormat":"Volumes Depth","refId":"B"},{"expr":"sum(replicationmanager_depth)","format":"time_series","intervalFactor":1,"legendFormat":"Replication Manager Depth","refId":"C"},{"expr":"sum(statefulset_depth)","format":"time_series","intervalFactor":1,"legendFormat":"StatefulSet Depth","refId":"D"},{"expr":"sum(serviceaccount_depth)","format":"time_series","intervalFactor":1,"legendFormat":"Service Account Depth","refId":"E"},{"expr":"sum(endpoint_depth)","format":"time_series","intervalFactor":1,"legendFormat":"Endpoint Depth","refId":"F"},{"expr":"sum(deployment_depth)","format":"time_series","intervalFactor":1,"legendFormat":"Deployment Depth","refId":"G"},{"expr":"sum(daemonset_depth)","format":"time_series","intervalFactor":1,"legendFormat":"DaemonSet Depth","refId":"H"},{"expr":"sum(replicaset_depth)","format":"time_series","intervalFactor":1,"refId":"I"}],"thresholds":[],"timeFrom":null,"timeShift":null,"title":"Controller Manager Queue Depth","tooltip":{"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true},{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true}],"yaxis":{"align":false,"alignLevel":null}}],"refresh":false,"schemaVersion":16,"style":"dark","tags":[],"templating":{"list":[]},"time":{"from":"now-5m","to":"now"},"timepicker":{"refresh_intervals":["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"],"time_options":["5m","15m","1h","6h","12h","24h","2d","7d","30d"]},"timezone":"browser","title":"Kubernetes Components","uid":"Ld4acTYmz","version":1}
\ No newline at end of file
{"__requires":[{"id":"grafana","name":"Grafana","type":"grafana","version":"5.3.0"},{"id":"graph","name":"Graph","type":"panel","version":"5.0.0"},{"id":"prometheus","name":"Prometheus","type":"datasource","version":"5.0.0"},{"id":"singlestat","name":"Singlestat","type":"panel","version":"5.0.0"}],"annotations":{"list":[{"builtIn":1,"datasource":"-- Grafana --","enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations & Alerts","type":"dashboard"}]},"editable":true,"gnetId":null,"graphTooltip":0,"id":null,"links":[],"panels":[{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"RANCHER_MONITORING","description":"This represents the total [CPU resource requests](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu) in the cluster.\nFor comparison the total [allocatable CPU cores](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node-allocatable.md) is also shown.","editable":true,"error":false,"fill":1,"grid":{"threshold1Color":"rgba(216, 200, 27, 0.27)","threshold2Color":"rgba(234, 112, 112, 0.22)"},"gridPos":{"h":8,"w":18,"x":0,"y":0},"id":1,"isNew":false,"legend":{"alignAsTable":false,"avg":false,"current":false,"hideEmpty":false,"hideZero":false,"max":false,"min":false,"rightSide":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"links":[],"nullPointMode":"null","percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"expr":"min(sum(kube_node_status_allocatable_cpu_cores) by (instance))","hide":false,"intervalFactor":2,"legendFormat":"allocatable","refId":"A","step":20},{"expr":"max(sum(kube_pod_container_resource_requests_cpu_cores) by (instance))","hide":false,"intervalFactor":2,"legendFormat":"requested","refId":"B","step":20}],"thresholds":[],"timeFrom":null,"timeShift":null,"title":"CPU Cores","tooltip":{"msResolution":false,"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","label":"CPU Cores","logBase":1,"show":true},{"format":"short","logBase":1,"show":true}],"yaxis":{"align":false,"alignLevel":null}},{"cacheTimeout":null,"colorBackground":false,"colorValue":false,"colors":["rgba(50, 172, 45, 0.97)","rgba(237, 129, 40, 0.89)","rgba(245, 54, 54, 0.9)"],"datasource":"RANCHER_MONITORING","editable":true,"format":"percent","gauge":{"maxValue":100,"minValue":0,"show":true,"thresholdLabels":false,"thresholdMarkers":true},"gridPos":{"h":8,"w":6,"x":18,"y":0},"hideTimeOverride":false,"id":2,"interval":null,"links":[],"mappingType":1,"mappingTypes":[{"name":"value to text","value":1},{"name":"range to text","value":2}],"maxDataPoints":100,"nullPointMode":"connected","nullText":null,"postfix":"","postfixFontSize":"50%","prefix":"","prefixFontSize":"50%","rangeMaps":[{"from":"null","text":"N/A","to":"null"}],"sparkline":{"fillColor":"rgba(31, 118, 189, 0.18)","full":false,"lineColor":"rgb(31, 120, 193)","show":true},"tableColumn":"","targets":[{"expr":"max(sum(kube_pod_container_resource_requests_cpu_cores) by (instance)) / min(sum(kube_node_status_allocatable_cpu_cores) by (instance)) * 100","intervalFactor":2,"legendFormat":"","refId":"A","step":240}],"thresholds":"80, 90","title":"CPU Cores","transparent":false,"type":"singlestat","valueFontSize":"110%","valueMaps":[{"op":"=","text":"0","value":"null"}],"valueName":"avg"},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"RANCHER_MONITORING","description":"This represents the total [memory resource requests](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-memory) in the cluster.\nFor comparison the total [allocatable memory](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node-allocatable.md) is also shown.","editable":true,"error":false,"fill":1,"grid":{"threshold1Color":"rgba(216, 200, 27, 0.27)","threshold2Color":"rgba(234, 112, 112, 0.22)"},"gridPos":{"h":8,"w":18,"x":0,"y":8},"id":3,"isNew":false,"legend":{"alignAsTable":false,"avg":false,"current":false,"hideEmpty":false,"hideZero":false,"max":false,"min":false,"rightSide":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"links":[],"nullPointMode":"null","percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"expr":"min(sum(kube_node_status_allocatable_memory_bytes) by (instance))","hide":false,"intervalFactor":2,"legendFormat":"allocatable","refId":"A","step":20},{"expr":"max(sum(kube_pod_container_resource_requests_memory_bytes) by (instance))","hide":false,"intervalFactor":2,"legendFormat":"requested","refId":"B","step":20}],"thresholds":[],"timeFrom":null,"timeShift":null,"title":"Memory","tooltip":{"msResolution":false,"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"bytes","label":"Memory","logBase":1,"show":true},{"format":"short","logBase":1,"show":true}],"yaxis":{"align":false,"alignLevel":null}},{"cacheTimeout":null,"colorBackground":false,"colorValue":false,"colors":["rgba(50, 172, 45, 0.97)","rgba(237, 129, 40, 0.89)","rgba(245, 54, 54, 0.9)"],"datasource":"RANCHER_MONITORING","editable":true,"format":"percent","gauge":{"maxValue":100,"minValue":0,"show":true,"thresholdLabels":false,"thresholdMarkers":true},"gridPos":{"h":8,"w":6,"x":18,"y":8},"hideTimeOverride":false,"id":4,"interval":null,"links":[],"mappingType":1,"mappingTypes":[{"name":"value to text","value":1},{"name":"range to text","value":2}],"maxDataPoints":100,"nullPointMode":"connected","nullText":null,"postfix":"","postfixFontSize":"50%","prefix":"","prefixFontSize":"50%","rangeMaps":[{"from":"null","text":"N/A","to":"null"}],"sparkline":{"fillColor":"rgba(31, 118, 189, 0.18)","full":false,"lineColor":"rgb(31, 120, 193)","show":true},"tableColumn":"","targets":[{"expr":"max(sum(kube_pod_container_resource_requests_memory_bytes) by (instance)) / min(sum(kube_node_status_allocatable_memory_bytes) by (instance)) * 100","intervalFactor":2,"legendFormat":"","refId":"A","step":240}],"thresholds":"80, 90","title":"Memory","transparent":false,"type":"singlestat","valueFontSize":"110%","valueMaps":[{"op":"=","text":"0","value":"null"}],"valueName":"avg"}],"refresh":false,"schemaVersion":16,"style":"dark","tags":[],"templating":{"list":[]},"time":{"from":"now-5m","to":"now"},"timepicker":{"refresh_intervals":["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"],"time_options":["5m","15m","1h","6h","12h","24h","2d","7d","30d"]},"timezone":"browser","title":"Kubernetes Resource Requests","uid":"0MdTILxik","version":1}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{"annotations":{"list":[{"builtIn":1,"datasource":"-- Grafana --","enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations & Alerts","type":"dashboard"}]},"editable":true,"gnetId":null,"graphTooltip":1,"id":26,"iteration":1568019625400,"links":[],"panels":[{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"RANCHER_MONITORING","editable":true,"error":false,"fill":1,"fillGradient":0,"grid":{"threshold1Color":"rgba(216, 200, 27, 0.27)","threshold2Color":"rgba(234, 112, 112, 0.22)"},"gridPos":{"h":7,"w":24,"x":0,"y":0},"id":1,"isNew":false,"legend":{"alignAsTable":true,"avg":true,"current":true,"hideEmpty":false,"hideZero":false,"max":false,"min":false,"rightSide":true,"show":true,"total":false,"values":true},"lines":true,"linewidth":2,"links":[],"nullPointMode":"connected","options":{"dataLinks":[]},"percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"expr":"sum by(container_name) (container_memory_working_set_bytes{namespace=\"$namespace\",container_name!=\"\",container_name=~\"$container\",container_name!=\"POD\",pod_name=\"$pod\"})","interval":"10s","intervalFactor":1,"legendFormat":"Current: {{ container_name }}","metric":"container_memory_working_set_bytes","refId":"A","step":15},{"expr":"kube_pod_container_resource_requests_memory_bytes{namespace=\"$namespace\",pod=\"$pod\",container=~\"$container\"}","interval":"10s","intervalFactor":2,"legendFormat":"Requested: {{ container }}","metric":"kube_pod_container_resource_requests_memory_bytes","refId":"B","step":20},{"expr":"kube_pod_container_resource_limits_memory_bytes{namespace=\"$namespace\",pod=\"$pod\",container=~\"$container\"}","interval":"10s","intervalFactor":2,"legendFormat":"Limit: {{ container }}","metric":"kube_pod_container_resource_limits_memory_bytes","refId":"C","step":20}],"thresholds":[],"timeFrom":null,"timeRegions":[],"timeShift":null,"title":"Memory Usage","tooltip":{"msResolution":true,"shared":true,"sort":0,"value_type":"cumulative"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"bytes","logBase":1,"show":true},{"format":"short","logBase":1,"show":true}],"yaxis":{"align":false,"alignLevel":null}},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"RANCHER_MONITORING","editable":true,"error":false,"fill":1,"fillGradient":0,"grid":{"threshold1Color":"rgba(216, 200, 27, 0.27)","threshold2Color":"rgba(234, 112, 112, 0.22)"},"gridPos":{"h":7,"w":24,"x":0,"y":7},"id":2,"isNew":false,"legend":{"alignAsTable":true,"avg":true,"current":true,"hideEmpty":false,"hideZero":false,"max":false,"min":false,"rightSide":true,"show":true,"total":false,"values":true},"lines":true,"linewidth":2,"links":[],"nullPointMode":"connected","options":{"dataLinks":[]},"percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"expr":"sum by (container_name)(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\",container_name!=\"\",container_name=~\"$container\",container_name!=\"POD\",pod_name=\"$pod\"}[5m]))","intervalFactor":2,"legendFormat":"Current: {{ container_name }}","refId":"A","step":30},{"expr":"kube_pod_container_resource_requests_cpu_cores{namespace=\"$namespace\",pod=\"$pod\",container=~\"$container\"}","interval":"10s","intervalFactor":2,"legendFormat":"Requested: {{ container }}","metric":"kube_pod_container_resource_requests_cpu_cores","refId":"B","step":20},{"expr":"kube_pod_container_resource_limits_cpu_cores{namespace=\"$namespace\",pod=\"$pod\",container=~\"$container\"}","interval":"10s","intervalFactor":2,"legendFormat":"Limit: {{ container }}","metric":"kube_pod_container_resource_limits_memory_bytes","refId":"C","step":20}],"thresholds":[],"timeFrom":null,"timeRegions":[],"timeShift":null,"title":"CPU Usage","tooltip":{"msResolution":true,"shared":true,"sort":0,"value_type":"cumulative"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"percentunit","logBase":1,"show":true},{"format":"short","logBase":1,"show":true}],"yaxis":{"align":false,"alignLevel":null}},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"RANCHER_MONITORING","editable":true,"error":false,"fill":1,"fillGradient":0,"grid":{"threshold1Color":"rgba(216, 200, 27, 0.27)","threshold2Color":"rgba(234, 112, 112, 0.22)"},"gridPos":{"h":7,"w":24,"x":0,"y":14},"id":3,"isNew":false,"legend":{"alignAsTable":true,"avg":true,"current":true,"hideEmpty":false,"hideZero":false,"max":false,"min":false,"rightSide":true,"show":true,"total":false,"values":true},"lines":true,"linewidth":2,"links":[],"nullPointMode":"connected","options":{"dataLinks":[]},"percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"expr":"sort_desc(sum by (pod_name) (rate(container_network_receive_bytes_total{namespace=\"$namespace\",pod_name=\"$pod\",container_name!=\"\"}[5m])))","intervalFactor":2,"legendFormat":"{{ pod_name }}","refId":"A","step":30}],"thresholds":[],"timeFrom":null,"timeRegions":[],"timeShift":null,"title":"Network I/O","tooltip":{"msResolution":true,"shared":true,"sort":0,"value_type":"cumulative"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"bytes","logBase":1,"show":true},{"format":"short","logBase":1,"show":true}],"yaxis":{"align":false,"alignLevel":null}}],"refresh":false,"schemaVersion":19,"style":"dark","tags":[],"templating":{"list":[{"allValue":"","current":{"text":"cattle-system","value":"cattle-system"},"datasource":"RANCHER_MONITORING","definition":"","hide":0,"includeAll":false,"label":"Namespace","multi":false,"name":"namespace","options":[],"query":"label_values(kube_pod_info, namespace)","refresh":1,"regex":"","skipUrlSync":false,"sort":0,"tagValuesQuery":"","tags":[],"tagsQuery":"","type":"query","useTags":false},{"allValue":"","current":{"text":"cattle-node-agent-4kwsc","value":"cattle-node-agent-4kwsc"},"datasource":"RANCHER_MONITORING","definition":"","hide":0,"includeAll":false,"label":"Pod","multi":false,"name":"pod","options":[],"query":"label_values(kube_pod_info{namespace=\"$namespace\"}, pod)","refresh":1,"regex":"","skipUrlSync":false,"sort":0,"tagValuesQuery":"","tags":[],"tagsQuery":"","type":"query","useTags":false},{"allValue":".*","current":{"text":"All","value":"$__all"},"datasource":"RANCHER_MONITORING","definition":"","hide":0,"includeAll":true,"label":"Container","multi":false,"name":"container","options":[],"query":"label_values(kube_pod_container_info{namespace=\"$namespace\", pod=\"$pod\"}, container)","refresh":1,"regex":"","skipUrlSync":false,"sort":0,"tagValuesQuery":"","tags":[],"tagsQuery":"","type":"query","useTags":false}]},"time":{"from":"now-5m","to":"now"},"timepicker":{"refresh_intervals":["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"],"time_options":["5m","15m","1h","6h","12h","24h","2d","7d","30d"]},"timezone":"browser","title":"Pods","uid":"XSOTSYxiz","version":1}
\ No newline at end of file
{{/* vim: set filetype=mustache: */}}
{{- define "app.dashboards.fullname" -}}
{{- $name := include "app.name" . -}}
{{- printf "%s-%s-dashboards" $name .Release.Name -}}
{{- end -}}
{{- define "app.provisionings.fullname" -}}
{{- $name := include "app.name" . -}}
{{- printf "%s-%s-provisionings" $name .Release.Name -}}
{{- end -}}
{{- define "app.dashboards.istio-fullname" -}}
{{- $name := include "app.name" . -}}
{{- printf "%s-%s-%s-dashboards" $name "istio" .Release.Name -}}
{{- end -}}
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.dashboards.fullname" . }}
data:
{{- if eq .Values.level "cluster" }}
{{ (.Files.Glob "dashboards/c_*.json").AsConfig | indent 2 }}
{{- end }}
{{ (.Files.Glob "dashboards/w_*.json").AsConfig | indent 2 }}
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.dashboards.istio-fullname" . }}
data:
{{- if eq .Values.level "cluster" }}
{{ (.Files.Glob "dashboards/istio/c_istio_*.json").AsConfig | indent 2 }}
{{- end }}
{{ (.Files.Glob "dashboards/istio/w_istio_*.json").AsConfig | indent 2 }}
apiVersion: {{ template "deployment_api_version" . }}
kind: Deployment
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
spec:
initContainers:
- name: grafana-init-plugin-json-copy
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
{{- if and .Values.resources .Values.resources.inits }}
resources:
{{ toYaml .Values.resources.inits | indent 10 }}
{{- end }}
volumeMounts:
- name: grafana-nginx
mountPath: /run.sh
subPath: copy-datasource-plugin-json.sh
- name: grafana-static-contents
mountPath: /host
- name: grafana-init-plugin-json-modify
image: {{ template "system_default_registry" . }}{{ .Values.image.tool.repository }}:{{ .Values.image.tool.tag }}
command:
- /run.sh
{{- if and .Values.resources .Values.resources.inits }}
resources:
{{ toYaml .Values.resources.inits | indent 10 }}
{{- end }}
volumeMounts:
- name: grafana-nginx
mountPath: /run.sh
subPath: modify-datasource-plugin-json.sh
- name: grafana-static-contents
mountPath: /host
containers:
- name: grafana
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
env:
- name: GF_AUTH_BASIC_ENABLED
value: "true"
- name: GF_AUTH_ANONYMOUS_ENABLED
value: "true"
{{- if .Values.extraVars }}
{{ toYaml .Values.extraVars | indent 8 }}
{{- end }}
volumeMounts:
- name: grafana-storage
mountPath: /var/lib/grafana
- name: grafana-static-contents
mountPath: /usr/share/grafana/public/app/plugins/datasource/prometheus/plugin.json
subPath: grafana/plugin.json
- name: grafana-dashboards
mountPath: /var/lib/grafana/rancher-dashboards
- name: grafana-istio-dashboards
mountPath: /var/lib/grafana/rancher-istio-dashboards
- name: grafana-provisionings
mountPath: /etc/grafana/provisioning/dashboards/all.yaml
subPath: dashboards.yaml
- name: grafana-provisionings
mountPath: /etc/grafana/provisioning/datasources/all.yaml
subPath: datasources.yaml
ports:
- name: web
containerPort: 3000
protocol: TCP
readinessProbe:
httpGet:
path: /api/health
port: 3000
periodSeconds: 1
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 10
{{- if and .Values.resources .Values.resources.core }}
resources:
{{ toYaml .Values.resources.core | indent 10 }}
{{- end }}
- name: grafana-proxy
image: {{ template "system_default_registry" . }}{{ .Values.image.proxy.repository }}:{{ .Values.image.proxy.tag }}
args:
- nginx
- -g
- daemon off;
- -c
- /nginx/nginx.conf
ports:
- name: http
containerPort: 8080
protocol: TCP
volumeMounts:
- mountPath: /nginx/
name: grafana-nginx
- mountPath: /var/cache/nginx
name: nginx-home
{{- if and .Values.resources .Values.resources.proxy }}
resources:
{{ toYaml .Values.resources.proxy | indent 10 }}
securityContext:
runAsUser: 101
runAsGroup: 101
{{- end }}
nodeSelector:
{{- include "linux-node-selector" . | nindent 8 }}
{{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
{{ (index $pair 0) }}: {{ (index $pair 1) }}
{{- else }}
{{ (index $pair 0) }}: ""
{{- end }}
{{- end }}
{{- if .Values.enabledRBAC }}
serviceAccountName: {{ default (default (include "app.fullname" .) .Values.serviceAccountName) .Values.serviceAccountNameOverride }}
{{- end }}
tolerations:
{{- include "linux-node-tolerations" . | nindent 8 }}
{{- if .Values.tolerations }}
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
securityContext:
runAsUser: 472
runAsGroup: 472
fsGroup: 472
volumes:
- name: grafana-static-contents
emptyDir: {}
- name: grafana-storage
{{- if or .Values.storageSpec .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "app.fullname" . }}
{{- else }}
emptyDir: {}
{{- end }}
- name: grafana-nginx
configMap:
name: {{ template "app.nginx.fullname" . }}
items:
- key: nginx.conf
mode: 438
path: nginx.conf
- key: copy-datasource-plugin-json.sh
mode: 0777
path: copy-datasource-plugin-json.sh
- key: modify-datasource-plugin-json.sh
mode: 0777
path: modify-datasource-plugin-json.sh
- name: grafana-dashboards
configMap:
name: {{ template "app.dashboards.fullname" . }}
- name: grafana-istio-dashboards
configMap:
name: {{ template "app.dashboards.istio-fullname" . }}
- name: grafana-provisionings
configMap:
name: {{ template "app.provisionings.fullname" . }}
- name: nginx-home
emptyDir: {}
apiVersion: v1
kind: Service
metadata:
name: expose-grafana-metrics
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{ .Values.apiGroup }}: "true"
spec:
type: ClusterIP
clusterIP: None
selector:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
ports:
- name: metrics
port: 3000
targetPort: web
\ No newline at end of file
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "app.nginx.fullname" . }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: nginx
data:
copy-datasource-plugin-json.sh: |-
#!/bin/bash
srcpath="/usr/share/grafana/public/app/plugins/datasource/prometheus/plugin.json"
dstpath="/host/grafana/raw-plugin.json"
if [[ -f $srcpath ]] && [[ -d /host ]]; then
mkdir -p /host/grafana
cp -f $srcpath $dstpath
exit 0
fi
exit 1
modify-datasource-plugin-json.sh: |-
#!/bin/sh
srcpath="/host/grafana/raw-plugin.json"
dstpath="/host/grafana/plugin.json"
if [ -f $srcpath ] && [ -d /host ]; then
mkdir -p /host/grafana
token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
cat $srcpath | K8S_BEARERTOKEN="Bearer $token" jq 'to_entries | . + [{"key":"routes","value":[{"path":"api/v1","url":"{{ .Values.prometheusDatasourceURL }}/api/v1","headers":[{"name":"Authorization","content":env.K8S_BEARERTOKEN}]}]}] | from_entries' > $dstpath
exit 0
fi
exit 1
nginx.conf: |-
worker_processes auto;
error_log /dev/stdout warn;
pid /var/cache/nginx/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
log_format main '[$time_local - $status] $remote_addr - $remote_user $request ($http_referer)';
proxy_connect_timeout 10;
proxy_read_timeout 180;
proxy_send_timeout 5;
proxy_buffering off;
proxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=my_zone:100m inactive=1d max_size=10g;
server {
listen 8080;
access_log off;
gzip on;
gzip_min_length 1k;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript image/jpeg image/gif image/png;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
proxy_set_header Host $host;
location /api/dashboards {
proxy_pass http://localhost:3000;
}
location /api/search {
proxy_pass http://localhost:3000;
sub_filter_types application/json;
sub_filter_once off;
sub_filter '"url":"/d' '"url":"d';
}
location / {
proxy_cache my_zone;
proxy_cache_valid 200 302 1d;
proxy_cache_valid 301 30d;
proxy_cache_valid any 5m;
proxy_cache_bypass $http_cache_control;
add_header X-Proxy-Cache $upstream_cache_status;
add_header Cache-Control "public";
proxy_pass http://localhost:3000/;
sub_filter_types text/html;
sub_filter_once off;
sub_filter '"appSubUrl":""' '"appSubUrl":"."';
sub_filter '"url":"/' '"url":"./';
sub_filter ':"/avatar/' ':"avatar/';
if ($request_filename ~ .*\.(?:js|css|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$) {
expires 90d;
}
}
}
}
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.provisionings.fullname" . }}
data:
dashboards.yaml: |+
- name: RANCHER_MONITORING
orgId: 1
folder: ''
type: file
disableDeletion: false
updateIntervalSeconds: 0 #never
options:
path: /var/lib/grafana/rancher-dashboards
- name: RANCHER_ISTIO_MONITORING
orgId: 2
folder: 'istio'
type: file
disableDeletion: false
updateIntervalSeconds: 0 #never
options:
path: /var/lib/grafana/rancher-istio-dashboards
datasources.yaml: |+
apiVersion: 1
datasources:
- name: RANCHER_MONITORING
type: prometheus
access: proxy
basicAuth: false
editable: false
isDefault: true
url: {{ .Values.prometheusDatasourceURL }}
\ No newline at end of file
{{- if or .Values.storageSpec .Values.persistence.enabled -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
spec:
{{- if .Values.storageSpec }}
{{ toYaml .Values.storageSpec | indent 2 }}
{{- else }}
accessModes:
- {{ default "ReadWriteOnce" .Values.persistence.accessMode }}
{{ if and .Values.persistence.storageClass (ne "default" .Values.persistence.storageClass) }}
storageClassName: {{ .Values.persistence.storageClass }}
{{ end }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end }}
{{- end -}}
{{- if and .Values.enabledRBAC (not .Values.serviceAccountName) }}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "app.fullname" . }}
imagePullSecrets:
{{ toYaml .Values.image.pullSecrets | indent 2 }}
{{- end }}
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: access-grafana
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
kubernetes.io/cluster-service: "true"
spec:
type: ClusterIP
sessionAffinity: ClientIP
selector:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
ports:
- name: http
port: 80
targetPort: http
apiVersion: {{ template "operator_api_version" . }}
kind: ServiceMonitor
metadata:
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
source: rancher-monitoring
name: {{ template "app.fullname" . }}
spec:
selector:
matchLabels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
release: {{ .Release.Name }}
{{ .Values.apiGroup }}: "true"
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
endpoints:
- port: metrics
relabelings:
- sourceLabels:
- __meta_kubernetes_pod_host_ip
targetLabel: host_ip
action: replace
regex: (.+)
replacement: $1
- sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: node
action: replace
regex: (.+)
replacement: $1
enabledRBAC: true
## Tolerations for use with node taints
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
##
tolerations: []
# - key: "key"
# operator: "Equal"
# value: "value"
# effect: "NoSchedule"
## Pass extra environment variables to the Grafana container.
##
# extraVars:
# - name: EXTRA_VAR_1
# value: extra-var-value-1
# - name: EXTRA_VAR_2
# value: extra-var-value-2
extraVars:
storageSpec: {}
# storageClassName: default
# accessModes:
# - ReadWriteOnce
# resources:
# requests:
# storage: 2Gi
# selector: {}
## Resource limits & requests
## Ref: https://kubernetes.io/docs/user-guide/compute-resources/
resources:
inits:
limits:
memory: 50Mi
cpu: 50m
requests:
memory: 50Mi
cpu: 50m
core:
limits:
memory: 200Mi
cpu: 200m
requests:
memory: 100Mi
cpu: 100m
proxy:
limits:
memory: 100Mi
cpu: 100m
requests:
memory: 50Mi
cpu: 50m
apiVersion: v1
name: operator-init
version: 0.1.0
appVersion: 0.1.0
tillerVersion: ">=2.7.2-0"
description: Helm chart to initialize Prometheus Operator CRDs
keywords:
- prometheus-operator
- crd
maintainers:
- name: support
email: support@rancher.com
engine: gotpl
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment