minishift / minishift-centos-iso

CentOS based ISO as an alternative for boot2docker ISO
GNU Lesser General Public License v3.0
40 stars 33 forks source link

Disable swap and allow enabling using a settings file/Minishift command #205

Open gbraad opened 6 years ago

gbraad commented 6 years ago

It seems that with later versions of OpenShift, swap needs to be disabled. See: https://github.com/minishift/minishift/issues/1922#issuecomment-360832745

This means that handle-user-data should not perform swapon, However, we should allow Minishift to change this behaviour... for instance by setting a config file /mnt/sda1/minishift/instanceconfig which contains a ENABLESWAP=true option, and a way to trigger this part with a script or command, much like handle-user-data and/or set-ipaddress does.

praveenkumar commented 6 years ago

I am also interested how the older version of OpenShift perform when the swap is disabled, if they work as expected then we might disable it permanently without putting another script to enable it.

praveenkumar commented 6 years ago

Below is what we have as part of available partitions.

$ lsblk 
NAME                                                                                   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                                                                                      8:0    0  19.5G  0 disk 
|-sda1                                                                                   8:1    0  18.6G  0 part /mnt/sda1
`-sda2                                                                                   8:2    0  1000M  0 part [SWAP]
sr0                                                                                     11:0    1   330M  0 rom  /run/initramfs/live
loop0                                                                                    7:0    0    16K  1 loop 
loop1                                                                                    7:1    0   4.1M  1 loop 
`-live-osimg-min                                                                       253:2    0    10G  1 dm   
loop2                                                                                    7:2    0 277.7M  1 loop 
loop3                                                                                    7:3    0    10G  1 loop 
|-live-rw                                                                              253:0    0    10G  0 dm   /
|-live-base                                                                            253:1    0    10G  1 dm   
`-live-osimg-min                                                                       253:2    0    10G  1 dm   
gbraad commented 6 years ago

@praveenkumar not so sure about this... I remember having seen a ton of OOM errors before when the swap did NOT mount on a restart.

praveenkumar commented 6 years ago

@gbraad Ack, I will hold it till we can test out 3.9.0 bits (currently downloading those bits are not working from release page).

sosiouxme commented 6 years ago

The change is just that the kubelet now refuses to start when swap is enabled. But I don't think anything else has changed, practically speaking, with v3.8.

The logic behind this is for real cluster usage, you don't want to be swapping; you want to allocate pods with an accurate idea of the resources available to actually run and use memory pressure to affect scheduling pods accordingly. That's kind of irrelevant on a single-node test cluster, so it might be valid to simply configure the kubelet to start anyway when swap is disabled.

On the other hand, if you're getting OOMs without swap enabled, maybe that's a sign you really do need more real memory as a default for the VM instead of swap.

Whatever the outcome is, IMHO there's no need to have different defaults for v3.6 vs v3.8+.

gbraad commented 6 years ago

However, if no different defaults it means we have to deploy v3.8 with skipping the swap check.