-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c83ab18
commit 02a5260
Showing
16 changed files
with
593 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
hidden_* | ||
hidden_* | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#kubectl create -f https://raw.githubusercontent.com/verfio/fortio-operator/master/deploy/fortio.yaml | ||
|
||
echo "start sending requests" | ||
kubectl run -i --tty load-generator --rm --image=docker.io/fortio/fortio --restart=Never -- load -allow-initial-errors -qps $1 -t 0 -connection-reuse 0:0 -c 32 - http://demo-webserver:8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
service: | ||
type: NodePort | ||
nodePort: 30002 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
helm repo add grafana https://grafana.github.io/helm-charts | ||
helm install grafana grafana/grafana -n monitoring --values config.yaml | ||
echo "Login data:" | ||
kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo |
336 changes: 336 additions & 0 deletions
336
k8s-autoscaling/deployments/grafana/service-dashboard.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,336 @@ | ||
{ | ||
"annotations": { | ||
"list": [ | ||
{ | ||
"builtIn": 1, | ||
"datasource": { | ||
"type": "grafana", | ||
"uid": "-- Grafana --" | ||
}, | ||
"enable": true, | ||
"hide": true, | ||
"iconColor": "rgba(0, 211, 255, 1)", | ||
"name": "Annotations & Alerts", | ||
"type": "dashboard" | ||
} | ||
] | ||
}, | ||
"editable": true, | ||
"fiscalYearStartMonth": 0, | ||
"graphTooltip": 0, | ||
"id": 5, | ||
"links": [], | ||
"liveNow": false, | ||
"panels": [ | ||
{ | ||
"datasource": { | ||
"type": "prometheus", | ||
"uid": "d5414744-c248-426b-b9d7-e66f3bd8de8c" | ||
}, | ||
"fieldConfig": { | ||
"defaults": { | ||
"color": { | ||
"mode": "palette-classic" | ||
}, | ||
"custom": { | ||
"axisCenteredZero": false, | ||
"axisColorMode": "text", | ||
"axisLabel": "", | ||
"axisPlacement": "auto", | ||
"barAlignment": 0, | ||
"drawStyle": "line", | ||
"fillOpacity": 0, | ||
"gradientMode": "none", | ||
"hideFrom": { | ||
"legend": false, | ||
"tooltip": false, | ||
"viz": false | ||
}, | ||
"insertNulls": false, | ||
"lineInterpolation": "linear", | ||
"lineWidth": 1, | ||
"pointSize": 5, | ||
"scaleDistribution": { | ||
"type": "linear" | ||
}, | ||
"showPoints": "auto", | ||
"spanNulls": false, | ||
"stacking": { | ||
"group": "A", | ||
"mode": "none" | ||
}, | ||
"thresholdsStyle": { | ||
"mode": "off" | ||
} | ||
}, | ||
"mappings": [], | ||
"thresholds": { | ||
"mode": "absolute", | ||
"steps": [ | ||
{ | ||
"color": "green", | ||
"value": null | ||
} | ||
] | ||
} | ||
}, | ||
"overrides": [] | ||
}, | ||
"gridPos": { | ||
"h": 7, | ||
"w": 24, | ||
"x": 0, | ||
"y": 0 | ||
}, | ||
"id": 5, | ||
"options": { | ||
"legend": { | ||
"calcs": [], | ||
"displayMode": "list", | ||
"placement": "bottom", | ||
"showLegend": true | ||
}, | ||
"tooltip": { | ||
"mode": "single", | ||
"sort": "none" | ||
} | ||
}, | ||
"targets": [ | ||
{ | ||
"datasource": { | ||
"type": "prometheus", | ||
"uid": "d5414744-c248-426b-b9d7-e66f3bd8de8c" | ||
}, | ||
"editorMode": "code", | ||
"expr": "sum(rate(seminar_http_requests_total{kubernetes_pod_name=~\"demo-webserver.*\"}[2m])) by (kubernetes_pod_name)", | ||
"instant": false, | ||
"legendFormat": "__auto", | ||
"range": true, | ||
"refId": "A" | ||
} | ||
], | ||
"title": "AVG HTTP Requests/s", | ||
"type": "timeseries" | ||
}, | ||
{ | ||
"datasource": { | ||
"type": "prometheus", | ||
"uid": "d5414744-c248-426b-b9d7-e66f3bd8de8c" | ||
}, | ||
"fieldConfig": { | ||
"defaults": { | ||
"color": { | ||
"fixedColor": "orange", | ||
"mode": "palette-classic" | ||
}, | ||
"custom": { | ||
"axisCenteredZero": false, | ||
"axisColorMode": "text", | ||
"axisLabel": "", | ||
"axisPlacement": "auto", | ||
"barAlignment": 0, | ||
"drawStyle": "line", | ||
"fillOpacity": 0, | ||
"gradientMode": "none", | ||
"hideFrom": { | ||
"legend": false, | ||
"tooltip": false, | ||
"viz": false | ||
}, | ||
"insertNulls": false, | ||
"lineInterpolation": "smooth", | ||
"lineStyle": { | ||
"fill": "solid" | ||
}, | ||
"lineWidth": 1, | ||
"pointSize": 5, | ||
"scaleDistribution": { | ||
"type": "linear" | ||
}, | ||
"showPoints": "auto", | ||
"spanNulls": false, | ||
"stacking": { | ||
"group": "A", | ||
"mode": "none" | ||
}, | ||
"thresholdsStyle": { | ||
"mode": "off" | ||
} | ||
}, | ||
"mappings": [], | ||
"thresholds": { | ||
"mode": "absolute", | ||
"steps": [ | ||
{ | ||
"color": "green", | ||
"value": null | ||
}, | ||
{ | ||
"color": "red", | ||
"value": 80 | ||
} | ||
] | ||
} | ||
}, | ||
"overrides": [] | ||
}, | ||
"gridPos": { | ||
"h": 8, | ||
"w": 24, | ||
"x": 0, | ||
"y": 7 | ||
}, | ||
"id": 2, | ||
"maxDataPoints": 100, | ||
"options": { | ||
"legend": { | ||
"calcs": [], | ||
"displayMode": "list", | ||
"placement": "bottom", | ||
"showLegend": true | ||
}, | ||
"tooltip": { | ||
"mode": "single", | ||
"sort": "none" | ||
} | ||
}, | ||
"pluginVersion": "10.1.5", | ||
"targets": [ | ||
{ | ||
"datasource": { | ||
"type": "prometheus", | ||
"uid": "d5414744-c248-426b-b9d7-e66f3bd8de8c" | ||
}, | ||
"disableTextWrap": false, | ||
"editorMode": "code", | ||
"expr": "sum by(pod) (rate(container_cpu_usage_seconds_total{pod=~\"demo-webserver.*\"}[2m])) *1000", | ||
"format": "time_series", | ||
"fullMetaSearch": false, | ||
"includeNullMetadata": true, | ||
"intervalFactor": 1, | ||
"legendFormat": "", | ||
"range": true, | ||
"refId": "A", | ||
"useBackend": false | ||
} | ||
], | ||
"title": "CPU Usage", | ||
"transformations": [], | ||
"type": "timeseries" | ||
}, | ||
{ | ||
"datasource": { | ||
"type": "prometheus", | ||
"uid": "d5414744-c248-426b-b9d7-e66f3bd8de8c" | ||
}, | ||
"fieldConfig": { | ||
"defaults": { | ||
"color": { | ||
"mode": "palette-classic" | ||
}, | ||
"custom": { | ||
"axisCenteredZero": false, | ||
"axisColorMode": "text", | ||
"axisLabel": "", | ||
"axisPlacement": "auto", | ||
"barAlignment": 0, | ||
"drawStyle": "line", | ||
"fillOpacity": 0, | ||
"gradientMode": "none", | ||
"hideFrom": { | ||
"legend": false, | ||
"tooltip": false, | ||
"viz": false | ||
}, | ||
"insertNulls": false, | ||
"lineInterpolation": "linear", | ||
"lineWidth": 1, | ||
"pointSize": 5, | ||
"scaleDistribution": { | ||
"type": "linear" | ||
}, | ||
"showPoints": "auto", | ||
"spanNulls": false, | ||
"stacking": { | ||
"group": "A", | ||
"mode": "none" | ||
}, | ||
"thresholdsStyle": { | ||
"mode": "off" | ||
} | ||
}, | ||
"mappings": [], | ||
"thresholds": { | ||
"mode": "absolute", | ||
"steps": [ | ||
{ | ||
"color": "green", | ||
"value": null | ||
}, | ||
{ | ||
"color": "red", | ||
"value": 80 | ||
} | ||
] | ||
} | ||
}, | ||
"overrides": [] | ||
}, | ||
"gridPos": { | ||
"h": 8, | ||
"w": 24, | ||
"x": 0, | ||
"y": 15 | ||
}, | ||
"id": 4, | ||
"maxDataPoints": 100, | ||
"options": { | ||
"legend": { | ||
"calcs": [], | ||
"displayMode": "list", | ||
"placement": "bottom", | ||
"showLegend": true | ||
}, | ||
"tooltip": { | ||
"mode": "single", | ||
"sort": "none" | ||
} | ||
}, | ||
"pluginVersion": "10.1.5", | ||
"targets": [ | ||
{ | ||
"datasource": { | ||
"type": "prometheus", | ||
"uid": "d5414744-c248-426b-b9d7-e66f3bd8de8c" | ||
}, | ||
"editorMode": "code", | ||
"expr": "sum by (pod) (rate(container_memory_usage_bytes{pod=~\"demo-webserver.*\"}[2m])) / 1024", | ||
"format": "time_series", | ||
"intervalFactor": 1, | ||
"legendFormat": "", | ||
"range": true, | ||
"refId": "A" | ||
} | ||
], | ||
"title": "Memory Usage", | ||
"type": "timeseries" | ||
} | ||
], | ||
"refresh": "5s", | ||
"schemaVersion": 38, | ||
"style": "dark", | ||
"tags": [], | ||
"templating": { | ||
"list": [] | ||
}, | ||
"time": { | ||
"from": "now-5m", | ||
"to": "now" | ||
}, | ||
"timepicker": {}, | ||
"timezone": "", | ||
"title": "Demo Webserver", | ||
"uid": "c19c0e7e-18c9-424f-95e9-66abcaeb62e4", | ||
"version": 10, | ||
"weekStart": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
global: | ||
scrape_interval: 15s | ||
evaluation_interval: 15s | ||
alertmanager: | ||
enabled: false | ||
kube-state-metrics: | ||
enabled: true | ||
prometheus-node-exporter: | ||
enabled: true | ||
prometheus-pushgateway: | ||
enabled: false | ||
server: | ||
service: | ||
type: NodePort | ||
nodePort: 30001 | ||
extraScrapeConfigs: > | ||
- job_name: demo-webserver | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keep | ||
regex: demo-webserver | ||
- source_labels: [__meta_kubernetes_namespace] | ||
action: replace | ||
target_label: kubernetes_namespace | ||
- source_labels: [__meta_kubernetes_pod_name] | ||
action: replace | ||
target_label: kubernetes_pod_name | ||
static_configs: | ||
- targets: ['localhost:8080'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | ||
helm repo update | ||
helm install prometheus prometheus-community/prometheus --values config.yaml -n monitoring |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sudo ufw allow 30001 | ||
kubectl port-forward svc/prometheus-server -n monitoring --address 0.0.0.0 30001:80 |
Oops, something went wrong.