-
Notifications
You must be signed in to change notification settings - Fork 177
/
memory.yaml
59 lines (59 loc) · 2.08 KB
/
memory.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
###########################################################
## This file has the configuration for
## - A namespace called 0-eldada for isolation
## - A pod with an ubuntu container installed with some basic tools like vim, curl.
## This container runs a script that holds a block of memory for a given time with
## an optional gap between memory block runs.
##
## Deploy: kubectl apply -f memory.yaml
## Update (force replacing with new config): kubectl apply -f memory.yaml --force
## Terminal access: kubectl exec -it pod-memory -- bash
## Remove: kubectl delete -f memory.yaml
###########################################################
apiVersion: v1
kind: Namespace
metadata:
name: 0-eldada
---
apiVersion: v1
kind: Pod
metadata:
name: pod-memory
namespace: 0-eldada
spec:
securityContext:
runAsUser: 1000
fsGroup: 1000
containers:
- name: container-memory
image: eldada.jfrog.io/docker/ubuntu-with-tools:22.10
command:
- 'bash'
- '-c'
- >
echo "#######################################";
echo "### Downloading memory.sh";
curl -f -s -o ./memory.sh https://raw.githubusercontent.com/eldada/command-examples/master/scripts/memory.sh;
echo "### Running memory.sh";
bash ./memory.sh --mb ${MEMORY_TO_USE_MB} --wait ${TIME_TO_HOLD} --restart ${RESTART} --gap ${GAP} || exit 1;
echo "Sleeping forever...";
while true; do date; sleep 10; done
env:
## Actual memory used in the container will be MEMORY_TO_USE_MB + other system processes
- name: MEMORY_TO_USE_MB
value: "500"
- name: TIME_TO_HOLD
value: "60"
- name: RESTART
value: "true"
- name: GAP
value: "45"
## WARNING: Need to set a limit twice as much as the required memory (MEMORY_TO_USE_MB) to avoid an OOMKill.
## This is due to a spike in memory usage during the actual creation of the memory blob.
# resources:
# limits:
# cpu: "2"
# memory: 2000Mi
# requests:
# cpu: 5m
# memory: 50Mi