Kubernetes Jenkins swap space issue

4/2/2017

Jenkins is failing to build due to "Free Swap Space" being 0. I don't know how to fix that. The build process keeps hanging. Here part of the output:

enter image description here

enter image description here

When I ssh into the instance and docker info I get a WARNING: No swap limit support.

-- Tino
docker
gcloud
jenkins
kubernetes

4 Answers

2/14/2019

Kubernetes strongly recommends to disable swap on nodes, so it's ok that free swap space is shown as 0B.

-- Igor Storozhuk
Source: StackOverflow

4/4/2019

I had this issue with default helm chart provided by helm hub. It turns out that #of executors was actually 0. Increasing that solved.

-- SHM
Source: StackOverflow

4/2/2017

Your screenshot shows "waiting for next available executor" so try increasing the number of executors in jenkins ("Manage Jenkins" -> "Configure System" -> "# of executors").

Also here the info how to create Swapfile (for avoiding out of memory on building large docker containers etc.). The example creates 4G swapfile at location /myswap :

sudo dd if=/dev/zero of=/myswap count=4096 bs=1MiB
sudo chmod 600 /myswap
sudo mkswap /myswap
sudo swapon /myswap

to check swap is working:

swapon -s

enable swap at boot, add line to fstab file:

sudo nano /etc/fstab

Add this line:

/myswap   swap    swap    sw  0   0
-- Oswin Noetzelmann
Source: StackOverflow

5/30/2017

Lack of swap does not prevent building. If you are using kubernetes (given the tag in your question) you need to look at the Jenkins log, it will say why a container could not be created

-- csanchez
Source: StackOverflow