Page MenuHomePhabricator

kubernetes[2023-2024].codfw.wmnet,kubernetes[1023-1024].eqiad.wmnet are using devicemapper instead of overlay2
Closed, ResolvedPublic

Description

I have deployed a dummy composer.json change for operations/mediawiki-conifg https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/899520/ at 17:08 UTC. scap sync-file complained about two hosts apparently lacking disk space for docker:

  • kubernetes2024.codfw.wmnet
  • kubernetes2023.codfw.wmnet

30 other hosts passed.

The scap log:

17:08:47 Started build-and-push-container-images
17:08:47 K8s images build/push output redirected to /home/hashar/scap-image-build-and-push-log
17:09:18 Finished build-and-push-container-images (duration: 00m 31s)
17:09:18 Started docker pull on k8s nodes
17:09:20 /usr/bin/sudo /usr/local/sbin/mediawiki-image-download 2023-03-22-170848-publish (ran as mwdeploy@kubernetes2024.codfw.wmnet) returned [1]: Pulling 'docker-registry.discovery.wmnet/restricted/mediawiki-multiversion:2023-03-22-170848-publish'...
2023-03-22-170848-publish: Pulling from restricted/mediawiki-multiversion
9de111b16008: Already exists
964ebfc63afa: Already exists
f9de14c7a77f: Already exists
56c6914cdb94: Already exists
7bd4663e5aae: Already exists
e79af0e96b66: Already exists
6114120c137e: Already exists
751c94d154a3: Already exists
7eca0ef77dd8: Already exists
65465e168060: Already exists
a236a7a5dd45: Already exists
5b2629c18e04: Already exists
63b22ce2b978: Already exists
fcb7d3666d71: Pulling fs layer
230e673dfa99: Pulling fs layer
5cfe7f47f649: Pulling fs layer
fcb7d3666d71: Verifying Checksum
fcb7d3666d71: Download complete
230e673dfa99: Verifying Checksum
230e673dfa99: Download complete
5cfe7f47f649: Download complete
failed to register layer: devmapper: Thin Pool has 94446 free data blocks which is less than minimum required 163840 free data blocks. Create more free space in thin pool or use dm.min_free_space option to change behavior

17:09:20 /usr/bin/sudo /usr/local/sbin/mediawiki-image-download 2023-03-22-170848-publish (ran as mwdeploy@kubernetes2023.codfw.wmnet) returned [1]: Pulling 'docker-registry.discovery.wmnet/restricted/mediawiki-multiversion:2023-03-22-170848-publish'...
2023-03-22-170848-publish: Pulling from restricted/mediawiki-multiversion
9de111b16008: Already exists
964ebfc63afa: Already exists
f9de14c7a77f: Already exists
56c6914cdb94: Already exists
7bd4663e5aae: Already exists
e79af0e96b66: Already exists
6114120c137e: Already exists
751c94d154a3: Already exists
7eca0ef77dd8: Already exists
65465e168060: Already exists
a236a7a5dd45: Already exists
5b2629c18e04: Already exists
63b22ce2b978: Already exists
fcb7d3666d71: Pulling fs layer
230e673dfa99: Pulling fs layer
5cfe7f47f649: Pulling fs layer
5cfe7f47f649: Verifying Checksum
5cfe7f47f649: Download complete
230e673dfa99: Verifying Checksum
230e673dfa99: Download complete
fcb7d3666d71: Download complete
failed to register layer: devmapper: Thin Pool has 115148 free data blocks which is less than minimum required 163840 free data blocks. Create more free space in thin pool or use dm.min_free_space option to change behavior

17:09:24 docker_pull_k8s: 100% (in-flight: 0; ok: 30; fail: 2; left: 0)         
17:09:24 2 K8s nodes failed to pull the multiversion image
17:09:24 Finished docker pull on k8s nodes (duration: 00m 05s)

Event Timeline

kubernetes[2023-2024].codfw.wmnet,kubernetes[1023-1024].eqiad.wmnet are using devicemapper instead of overlay2 for some reason.

I've cleaned up some space so these messages won't re-appear for a bit, but we need to fix the underlying issue.

This is not a train blocker, as it only means we are not scheduling pods from new images on these hosts.

Clement_Goubert renamed this task from Kubernetes hosts lack free space when pulling MediaWiki images to kubernetes[2023-2024].codfw.wmnet,kubernetes[1023-1024].eqiad.wmnet are using devicemapper instead of overlay2 .Mar 22 2023, 6:27 PM
Clement_Goubert triaged this task as High priority.

Thank you Clément for the quick assessment :]

Mentioned in SAL (#wikimedia-operations) [2023-03-22T20:32:42Z] <akosiaris> reboot kubernetes1023 for a test once more, ⚓ T332803

configuration looked fine, a drain, stop of docker, delete of /var/lib/docker and reboot fixed it for kubernetes1023. Now... why did it happened and just on those 2 nodes? Adding @elukey and @jijiki that imaged those nodes.

Mentioned in SAL (#wikimedia-operations) [2023-03-22T20:37:40Z] <akosiaris> uncordon reboot kubernetes1023. It was drained previously for ⚓ T332803

I have a theory about this. Role was applied to already imaged nodes, but without a full re-image. The end result was, docker started but the overlay module wasn't whitelisted by profile::base::overlayfs: true due to the lack of a reboot. Docker fell back to devicemapper. Pods got assigned and the /var/lib/docker directory got "locked" to being devicemapper even after the overlay module was enabled. Our configuration[1] is minimal and as far as the storage/graph driver goes, it sticks with defaults which supports this theory.

[1]

{
  "bridge": "none",
  "iptables": false,
  "ip-masq": false,
  "log-opts": {
    "max-size": "100m"
  },
  "live-restore": true
}

I have a theory about this. Role was applied to already imaged nodes, but without a full re-image. The end result was, docker started but the overlay module wasn't whitelisted by profile::base::overlayfs: true due to the lack of a reboot. Docker fell back to devicemapper. Pods got assigned and the /var/lib/docker directory got "locked" to being devicemapper even after the overlay module was enabled. Our configuration[1] is minimal and as far as the storage/graph driver goes, it sticks with defaults which supports this theory.

[1]

{
  "bridge": "none",
  "iptables": false,
  "ip-masq": false,
  "log-opts": {
    "max-size": "100m"
  },
  "live-restore": true
}

yep that sounds all correct. If you now have overlay2 supported, you should just get the node out of k8s rotation, stop docker, clean its whole directory, restart docker. That should fix it AFAIR.

Alex I think that your theory is correct, I definitely applied the role without rebooting IIRC, didn't check the docker settings. Should we have an alarm to identify this corner case?

Mentioned in SAL (#wikimedia-operations) [2023-03-23T07:42:43Z] <elukey> clean up docker on kubernetes1024 (cordon + stop kubelet + docker + clean /var/lib/docker/*) and reboot to enable overlay2 - T332803

Mentioned in SAL (#wikimedia-operations) [2023-03-23T07:54:35Z] <elukey> clean up docker and reboot kubernetes2023 to enable overlay2 - T332803

Mentioned in SAL (#wikimedia-operations) [2023-03-23T08:20:59Z] <elukey> clean up docker and reboot kubernetes2024 to enable overlay2 - T332803

All nodes should be running overlay now :)

Before closing - should we add an alarm for this use case?

All nodes should be running overlay now :)

Awesome thanks! Happy that my theory is probably correct :-)

Before closing - should we add an alarm for this use case?

What are we going to alert on though? Parsing docker info and alert if it using devicemapper? There's the following issues:

  • For all of kubernetes we are forcibly moving away from Docker as past 1.24 it is not a supported Container Runtime Engine. So whatever we implement, will probably be docker specific and will be a wasted effort (for production at least) down the line.
  • Devicemapper is a deprecated storage engine anyway and disabled in docker 23.x (see https://docs.docker.com/engine/deprecated/). It should not be used anyway in our environment.

It's quite possibly better to just force overlay2 in our config. If the config doesn't match the data directory, docker should fail to start (IIRC) and we 'll get an alert anyway then.

It's quite possibly better to just force overlay2 in our config. If the config doesn't match the data directory, docker should fail to start (IIRC) and we 'll get an alert anyway then.

That sounds good to me tbh. and easiest to implement as well.

Ack makes sense, let's do it :)

Change 902318 had a related patch set uploaded (by JMeybohm; author: JMeybohm):

[operations/puppet@production] k8s: Force docker storage-driver to overlay2

https://gerrit.wikimedia.org/r/902318

Change 902318 merged by JMeybohm:

[operations/puppet@production] k8s: Force docker storage-driver to overlay2

https://gerrit.wikimedia.org/r/902318

JMeybohm claimed this task.

profile::docker::engine now forces overlay2 storage_driver in docker config (in case there has not explicitly been selected something else).

Change 903329 had a related patch set uploaded (by Ahmon Dancy; author: Ahmon Dancy):

[operations/puppet@production] k8s: Use storage-driver instead of storage_driver

https://gerrit.wikimedia.org/r/903329

Change 903329 merged by JMeybohm:

[operations/puppet@production] k8s: Use storage-driver instead of storage_driver

https://gerrit.wikimedia.org/r/903329