-
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
Showing
5 changed files
with
32 additions
and
20 deletions.
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
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,26 @@ | ||
#!/bin/bash | ||
|
||
# Check metrics from example-app | ||
|
||
set -euxo pipefail | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
NS=example-app | ||
|
||
# Deploy app | ||
kubectl apply -f "$DIR"/manifests/ | ||
kubectl rollout status deployment example-app -n "$NS" --timeout=300s | ||
kubectl get podmonitor -n "$NS" | ||
|
||
# Deploy pod to check metrics are available | ||
kubectl delete pod -l run=curl -n "$NS" --force --grace-period=0 || true | ||
kubectl run -n "$NS" --image=curlimages/curl:8.12.1 curl -- sleep infinity | ||
kubectl wait --for=condition=Ready pod -l run=curl -n "$NS" --timeout=300s | ||
kubectl exec -n "$NS" -it curl -- curl -Lk "http://example-app.$NS:8080/metrics" | ||
|
||
# TODO: Check metrics are available in Prometheus | ||
PROM_URL="prometheus-stack-kube-prom-prometheus.monitoring" | ||
kubectl exec -n "$NS" -it curl -- curl -G http://$PROM_URL:9090/api/v1/targets/metadata \ | ||
--data-urlencode 'match_target={namespace="example-app"}' \ | ||
--data-urlencode 'limit=2' | grep "$NS" |
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,3 +1,8 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: example-app | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
|
This file was deleted.
Oops, something went wrong.