contrib/kube-prometheus: Add sample-app for showing custom metrics with HPA
Use interval in ServiceMonitor endpoint Reintroduce updated dpeloy.sh & teardown.sh
This commit is contained in:
7
experimental/custom-metrics-api/deploy.sh
Normal file
7
experimental/custom-metrics-api/deploy.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
kubectl apply -n monitoring custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml
|
||||
kubectl apply -n monitoring custom-metrics-apiservice.yaml
|
||||
kubectl apply -n monitoring custom-metrics-cluster-role.yaml
|
||||
kubectl apply -n monitoring custom-metrics-configmap.yaml
|
||||
kubectl apply -n monitoring hpa-custom-metrics-cluster-role-binding.yaml
|
67
experimental/custom-metrics-api/sample-app.yaml
Normal file
67
experimental/custom-metrics-api/sample-app.yaml
Normal file
@@ -0,0 +1,67 @@
|
||||
kind: ServiceMonitor
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
metadata:
|
||||
name: sample-app
|
||||
labels:
|
||||
app: sample-app
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample-app
|
||||
endpoints:
|
||||
- port: http
|
||||
interval: 5s
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: sample-app
|
||||
labels:
|
||||
app: sample-app
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 8080
|
||||
targetPort: 8080
|
||||
selector:
|
||||
app: sample-app
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sample-app
|
||||
labels:
|
||||
app: sample-app
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample-app
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample-app
|
||||
spec:
|
||||
containers:
|
||||
- image: luxas/autoscale-demo:v0.1.2
|
||||
name: metrics-provider
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
---
|
||||
kind: HorizontalPodAutoscaler
|
||||
apiVersion: autoscaling/v2beta1
|
||||
metadata:
|
||||
name: sample-app
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: sample-app
|
||||
minReplicas: 1
|
||||
maxReplicas: 10
|
||||
metrics:
|
||||
- type: Pods
|
||||
pods:
|
||||
metricName: http_requests
|
||||
targetAverageValue: 500m
|
7
experimental/custom-metrics-api/teardown.sh
Normal file
7
experimental/custom-metrics-api/teardown.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
kubectl delete -n monitoring custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml
|
||||
kubectl delete -n monitoring custom-metrics-apiservice.yaml
|
||||
kubectl delete -n monitoring custom-metrics-cluster-role.yaml
|
||||
kubectl delete -n monitoring custom-metrics-configmap.yaml
|
||||
kubectl delete -n monitoring hpa-custom-metrics-cluster-role-binding.yaml
|
Reference in New Issue
Block a user