CPU and Memory Stress in Kubernetes

357 views Asked by At

I created a simple pod with resource limits. The expectation is that the pod gets evicted when it uses more memory than the limit specified. To test this, how do I artificially fill the pod memory? I can stress CPU with dd if=/dev/zero of=/dev/null, but not memory. Can someone help me with this please? I tried with stress utility, but no luck.

apiVersion: v1
kind: Pod
metadata:
  name: nginx     # Name of our pod  
  labels:
    env: test
spec:
  containers:
  - name: nginx
    image: nginx:1.7.1  # Image version
    resources:
      requests:
        cpu: 100m
        memory: 256Mi
      limits:
        cpu: 100m
        memory: 256Mi
0

There are 0 answers