I'm using docker and kubernetes to deploy a daemonsent. In the daemonset yaml, I set the ephemeral-storage as below:
resources:
requests:
ephemeral-storage: "100Gi"
I applied this yaml, no error happened, everything looks fine. However, the tricky thing is, my filesystem only has 55 GiB available capacity.
$ df -h | egrep -v "overlay|tmpfs|shm"
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 250G 196G 55G 79% / <--------
/dev/sdh2 1014M 221M 794M 22% /boot
/dev/sdh1 200M 12M 189M 6% /boot/efi
/dev/mapper/centos-home 1.6T 39M 1.6T 1% /home
Logged in the container, same thing:
# df -h
Filesystem Size Used Avail Use% Mounted on
overlay 250G 196G 55G 79% /
tmpfs 64M 0 64M 0% /dev
...
How did that happen? Why k8s thought the container can request 100 GiB ephemeral-storage?
When I set the requests
to 200 GiB in the yaml and re-applied it, then the pod is showing in Terminating
state, describe it, found below events:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 20s default-scheduler 0/1 nodes are available: 1 Insufficient ephemeral-storage.
Which makes sense.
But still, why 100 GiB requests worked?
software versions:
$ docker version
Client: Docker Engine - Community
Version: 19.03.5
API version: 1.40
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:25:41 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.5
API version: 1.40 (minimum version 1.12)
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:24:18 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.10
GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
runc:
Version: 1.0.0-rc8+dev
GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
docker-init:
Version: 0.18.0
GitCommit: fec3683
[root@mc100]~/code/mc-log/deploy
$
[root@mc100]~/code/mc-log/deploy
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.3", GitCommit:"b3cbbae08ec52a7fc73d334838e18d17e8512749", GitTreeState:"clean", BuildDate:"2019-11-13T11:23:11Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.3", GitCommit:"b3cbbae08ec52a7fc73d334838e18d17e8512749", GitTreeState:"clean", BuildDate:"2019-11-13T11:13:49Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}