Created
April 12, 2019 14:45
-
-
Save mlafeldt/9e7f7363610f5026a6a754ecde6f6616 to your computer and use it in GitHub Desktop.
HPA based on CPU
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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx | |
namespace: ae-ops-testing | |
labels: | |
app: nginx | |
spec: | |
# replicas: 1 | |
selector: | |
matchLabels: | |
app: nginx | |
template: | |
metadata: | |
labels: | |
app: nginx | |
spec: | |
containers: | |
- name: nginx | |
image: nginx:1.7.9 | |
ports: | |
- containerPort: 80 | |
resources: | |
requests: | |
memory: "64Mi" | |
cpu: "250m" | |
limits: | |
memory: "128Mi" | |
cpu: "500m" | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nginx | |
namespace: ae-ops-testing | |
labels: | |
app: nginx | |
spec: | |
ports: | |
- port: 80 | |
protocol: TCP | |
selector: | |
app: nginx | |
--- | |
kind: ServiceMonitor | |
apiVersion: monitoring.coreos.com/v1 | |
metadata: | |
name: nginx | |
namespace: ae-ops-testing | |
labels: | |
prometheus: kube-prometheus | |
spec: | |
selector: | |
matchLabels: | |
app: nginx | |
endpoints: | |
- port: http | |
namespaceSelector: | |
matchNames: | |
- ae-ops-testing | |
--- | |
kind: HorizontalPodAutoscaler | |
apiVersion: autoscaling/v2beta1 | |
metadata: | |
name: nginx | |
namespace: ae-ops-testing | |
spec: | |
scaleTargetRef: | |
apiVersion: apps/v1 | |
kind: Deployment | |
name: nginx | |
minReplicas: 1 | |
maxReplicas: 10 | |
metrics: | |
- type: Pods | |
pods: | |
metricName: cpu_usage | |
targetAverageValue: 10m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment