Jxadro
Jxadro

Reputation: 1637

Control the size of the containers

In kubernetes I can currently limit the CPU and Memory of the containers, but what about the hard disk size of the containers.

For example, how could I avoid that someone runs a container in my k8s worker node that stores internally .jpg files making this container grow and grow with the time.

Not talking about Persistent Volume and Persistent Volume Claim. I'm talking that if someone makes an error in the container and write inside the container filesystem I want to control it.

Is there a way to limit the amount of disk used by the containers?

Thank you.

Upvotes: 2

Views: 636

Answers (1)

Janos Lenart
Janos Lenart

Reputation: 27080

There is some support for this; the tracking issues are #361, #362 and #363. You can define requests and/or limits on the resource called ephemeral-storage, like so (for a Pod/PodTemplate):

spec:
  containers:
  - name: foo
    resources:
      requests:
        ephemeral-storage: 50Mi
      limits:
        ephemeral-storage: 50Mi

The page Reserve Compute Resources for System Daemons has some additional information on this feature.

Upvotes: 2

Related Questions