Skip to content

Instantly share code, notes, and snippets.

@abhioncbr
Created March 24, 2020 23:28
Show Gist options
  • Save abhioncbr/a6033f5d5b6291a0022fbd97c3672f29 to your computer and use it in GitHub Desktop.
Save abhioncbr/a6033f5d5b6291a0022fbd97c3672f29 to your computer and use it in GitHub Desktop.
---
apiVersion: v1
kind: Namespace
metadata:
name: evict-example
---
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-priority
namespace: evict-example
value: 1000000
globalDefault: false
description: "This priority class should be used for XYZ service pods only."
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
namespace: evict-example
name: pod-with-defined-resources-example
spec:
selector:
matchLabels:
app: pod-with-defined-resources-example
replicas: 3 # tells deployment to run 3 pods matching the template
template:
metadata:
labels:
app: pod-with-defined-resources-example
spec:
priorityClassName: high-priority
containers:
- name: pod-with-defined-resources-example
image: abhioncbr/pod-evict:latest
imagePullPolicy: IfNotPresent
resources:
requests:
memory: "570Mi"
cpu: "100m"
limits:
memory: "570Mi"
cpu: "100m"
---
apiVersion: v1 # for versions before 1.9.0 use apps/v1beta2
kind: Pod
metadata:
namespace: evict-example
name: pod-oom-killed-example
spec:
restartPolicy: Never
containers:
- name: pod-oom-killed-example
image: abhioncbr/pod-evict:latest
imagePullPolicy: IfNotPresent
resources:
requests:
memory: "10Mi"
cpu: "100m"
limits:
memory: "10Mi"
cpu: "100m"
---
apiVersion: v1 # for versions before 1.9.0 use apps/v1beta2
kind: Pod
metadata:
namespace: evict-example
name: pod-evict-burstable-example
spec:
restartPolicy: Never
containers:
- name: pod-evict-burstable-example
image: abhioncbr/pod-evict:latest
imagePullPolicy: IfNotPresent
resources:
requests:
memory: "30Mi"
cpu: "100m"
limits:
memory: "1000Mi"
cpu: "100m"
---
apiVersion: v1 # for versions before 1.9.0 use apps/v1beta2
kind: Pod
metadata:
namespace: evict-example
name: pod-evict-best-effort-example
spec:
restartPolicy: Never
containers:
- name: pod-evict-best-effort-example
image: abhioncbr/pod-evict:latest
imagePullPolicy: IfNotPresent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment