Skip to content

Instantly share code, notes, and snippets.

@FutureSharks
Created November 15, 2016 09:37
Show Gist options
  • Save FutureSharks/ce0d9e9b030e96689dbfc452ad2aa866 to your computer and use it in GitHub Desktop.
Save FutureSharks/ce0d9e9b030e96689dbfc452ad2aa866 to your computer and use it in GitHub Desktop.
Kubernetes configuration to demonstrate problem with pod and cluster node autoscaling
# For this Github issue:
# https://github.com/kubernetes/kubernetes/issues/34772
#
apiVersion: v1
kind: Service
metadata:
name: my-app
labels:
name: my-app
spec:
type: ClusterIP
ports:
- name: http
port: 80
targetPort: 8000
protocol: TCP
selector:
name: my-app
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 4
strategy:
rollingUpdate:
maxUnavailable: 50%
maxSurge: 50%
revisionHistoryLimit: 8
template:
metadata:
labels:
name: my-app
spec:
containers:
- name: my-app
image: ubuntu:16.04
command: [ "/bin/bash", "-c" ]
args: [ "apt update; apt install stress; stress --cpu 1 --io 1 & sleep 999999" ]
resources:
requests:
cpu: 550m
ports:
- containerPort: 8000
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: my-app
namespace: default
spec:
scaleTargetRef:
apiVersion: extensions/v1beta1
kind: Deployment
name: my-app
minReplicas: 4
maxReplicas: 300
targetCPUUtilizationPercentage: 40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment