Skip to content

Commit

Permalink
update cnl-quickstart with Prometheus and Grafana
Browse files Browse the repository at this point in the history
  • Loading branch information
xannz committed Nov 6, 2024
1 parent 691007b commit 75229b1
Show file tree
Hide file tree
Showing 13 changed files with 590 additions and 3 deletions.
9 changes: 8 additions & 1 deletion charts/cnl-quickstart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1
version: 0.1.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand All @@ -31,3 +31,10 @@ dependencies:
repository: https://argoproj.github.io/argo-helm
version: 7.6.12
condition: argo-cd.enabled
- name: kube-prometheus-stack
repository: https://prometheus-community.github.io/helm-charts
version: 65.8.1
- name: monitoring
repository: file://subcharts/monitoring
condition: monitoring.enabled
version: 0.1.0
Binary file added charts/cnl-quickstart/charts/argo-cd-7.6.12.tgz
Binary file not shown.
Binary file added charts/cnl-quickstart/charts/kafka-0.1.0.tgz
Binary file not shown.
3 changes: 2 additions & 1 deletion charts/cnl-quickstart/site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ afterInstallationManual: |
namespaces:
- kafka
- argocd
- argocd
- prometheus
24 changes: 24 additions & 0 deletions charts/cnl-quickstart/subcharts/monitoring/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: cnl-quickstart-monitoring
description: Deploys common used cloud native tools for Cloud Native Lab

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0"
10 changes: 10 additions & 0 deletions charts/cnl-quickstart/subcharts/monitoring/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts.
*/}}
{{- define "monitoring.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
labels:
app: strimzi
namespace: {{ template "monitoring.namespace" . }}
spec:
replicas: 1
selector:
matchLabels:
name: grafana
template:
metadata:
labels:
name: grafana
spec:
containers:
- name: grafana
image: grafana/grafana:9.5.18
ports:
- name: grafana
containerPort: 3000
protocol: TCP
volumeMounts:
- name: grafana-data
mountPath: /var/lib/grafana
- name: grafana-logs
mountPath: /var/log/grafana
readinessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 15
periodSeconds: 20
volumes:
- name: grafana-data
emptyDir: {}
- name: grafana-logs
emptyDir: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: grafana
labels:
app: strimzi
namespace: {{ template "monitoring.namespace" . }}
spec:
ports:
- name: grafana
port: 3000
targetPort: 3000
protocol: TCP
nodePort: 32000 # Port for demo purposes
selector:
name: grafana
type: NodePort
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: v1
kind: Secret
metadata:
name: additional-scrape-configs
namespace: {{ template "monitoring.namespace" . }}
type: Opaque
stringData:
prometheus-additional.yaml: |
- job_name: kubernetes-cadvisor
honor_labels: true
scrape_interval: 10s
scrape_timeout: 10s
metrics_path: /metrics/cadvisor
scheme: https
kubernetes_sd_configs:
- role: node
namespaces:
names: []
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
relabel_configs:
- separator: ;
regex: __meta_kubernetes_node_label_(.+)
replacement: $1
action: labelmap
- separator: ;
regex: (.*)
target_label: __address__
replacement: kubernetes.default.svc:443
action: replace
- source_labels: [__meta_kubernetes_node_name]
separator: ;
regex: (.+)
target_label: __metrics_path__
replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor
action: replace
- source_labels: [__meta_kubernetes_node_name]
separator: ;
regex: (.*)
target_label: node_name
replacement: $1
action: replace
- source_labels: [__meta_kubernetes_node_address_InternalIP]
separator: ;
regex: (.*)
target_label: node_ip
replacement: $1
action: replace
metric_relabel_configs:
- source_labels: [container, __name__]
separator: ;
regex: POD;container_(network).*
target_label: container
replacement: $1
action: replace
- source_labels: [container]
separator: ;
regex: POD
replacement: $1
action: drop
- source_labels: [container]
separator: ;
regex: ^$
replacement: $1
action: drop
- source_labels: [__name__]
separator: ;
regex: container_(network_tcp_usage_total|tasks_state|memory_failures_total|network_udp_usage_total)
replacement: $1
action: drop
- job_name: kubernetes-nodes-kubelet
scrape_interval: 10s
scrape_timeout: 10s
scheme: https
kubernetes_sd_configs:
- role: node
namespaces:
names: []
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- target_label: __address__
replacement: kubernetes.default.svc:443
- source_labels: [__meta_kubernetes_node_name]
regex: (.+)
target_label: __metrics_path__
replacement: /api/v1/nodes/${1}/proxy/metrics
Loading

0 comments on commit 75229b1

Please sign in to comment.