Published on

Kubernetes Pod Evicted


Today I wrote the configuration and deployed my app to Kubernetes. Everything seemed fine: the container was created and tried starting up but ended up getting Evicted. I double checked my deployment configuration and realised I had left out the resources section (this is at the same level as env in your deployment).

The issue was fixed as soon as I added a resources section similar to the below:

apiVersion: apps/v1
kind: Deployment
      cpu: 500m
      memory: 512Mi
      cpu: 500m
      memory: 512Mi

Originally as I did not specify the resources to use the Kubernetes scheduler treated this deployment/pod as best effort. Best effort means that Kubernetes will try give my app resources but it does not know how much to allocate as you did not specify it.

By updating my deployment as above it tells the Kubernetes scheduler to guarantee that the container gets the requested resources as the requests and limits sections are the same.

You can read more about this over here.