Last active
November 20, 2019 07:33
-
-
Save thxCode/da84d0b2b5845d70e986c48aa81d4e72 to your computer and use it in GitHub Desktop.
Prometheus relatived
This file contains hidden or 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
kind: ServiceMonitor | |
apiVersion: monitoring.coreos.com/v1 | |
metadata: | |
name: hpa-app | |
namespace: kube-public | |
labels: | |
app: hpa-app | |
spec: | |
namespaceSelector: | |
matchNames: | |
- kube-public | |
selector: | |
matchLabels: | |
app: hpa-app | |
endpoints: | |
- port: http |
This file contains hidden or 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: hpa-app | |
namespace: kube-public | |
labels: | |
app: hpa-app | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: hpa-app | |
template: | |
metadata: | |
labels: | |
app: hpa-app | |
spec: | |
containers: | |
- image: luxas/autoscale-demo:v0.1.2 | |
name: metrics-provider | |
ports: | |
- name: http | |
containerPort: 8080 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: hpa-app | |
namespace: kube-public | |
labels: | |
app: hpa-app | |
spec: | |
selector: | |
app: hpa-app | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 8080 | |
name: http |
This file contains hidden or 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
kind: HorizontalPodAutoscaler | |
apiVersion: autoscaling/v2beta1 | |
metadata: | |
name: hpa-app | |
namespace: kube-public | |
spec: | |
scaleTargetRef: | |
# point the HPA at the sample application | |
# you created above | |
apiVersion: apps/v1 | |
kind: Deployment | |
name: hpa-app | |
# autoscale between 1 and 10 replicas | |
minReplicas: 1 | |
maxReplicas: 10 | |
metrics: | |
# use a "Pods" metric, which takes the average of the | |
# given metric across all pods controlled by the autoscaling target | |
- type: Pods | |
pods: | |
# use the metric that you used above: pods/http_requests | |
metricName: http_requests | |
# target 500 milli-requests per second, | |
# which is 1 request every two seconds | |
targetAverageValue: 500m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment