Skip to content

Instantly share code, notes, and snippets.

@KramKroc
Last active June 9, 2020 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KramKroc/d0a03a40136a36c841a6c76fe6002c39 to your computer and use it in GitHub Desktop.
Save KramKroc/d0a03a40136a36c841a6c76fe6002c39 to your computer and use it in GitHub Desktop.
Playing with k8s envs
apiVersion: v1
kind: Pod
metadata:
name: dapi-envars-resourcefieldref-2
spec:
containers:
- name: test-container-2
image: k8s.gcr.io/busybox:1.24
command: [ "sh", "-c"]
args:
- while true; do
echo -en '\n';
printenv MY_CPU_REQUEST MY_CPU_LIMIT;
printenv MY_MEM_REQUEST MY_MEM_LIMIT;
sleep 10;
done;
resources:
requests:
memory: "16Mi"
cpu: "100m"
limits:
memory: "32Mi"
cpu: "125m"
env:
- name: MY_CPU_REQUEST
valueFrom:
resourceFieldRef:
containerName: test-container
resource: requests.cpu
- name: MY_CPU_LIMIT
valueFrom:
resourceFieldRef:
containerName: test-container
resource: limits.cpu
- name: MY_MEM_REQUEST
valueFrom:
resourceFieldRef:
containerName: test-container
resource: requests.memory
- name: MY_MEM_LIMIT
valueFrom:
resourceFieldRef:
containerName: test-container
resource: limits.memory
restartPolicy: Never
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment