Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 3a05e6e

Browse files
author
Gianluca Arbezzano
committed
Swapoff command does not get persisted
As you know kubelet requires swap to be off in order to run successfully. I was using the command `swapoff -a` but it does not work after a reboot because the swap turns on again. This PR fixes the issue modifying the fstab file.
1 parent 15f329f commit 3a05e6e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

templates/cluster-template.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ spec:
2929
- 'kubectl --kubeconfig /etc/kubernetes/admin.conf create secret generic -n kube-system packet-cloud-config --from-literal=cloud-sa.json=''{"apiKey": "{{ .apiKey }}","projectID": "f2a2d7ad-886e-4207-bf38-10ebdf49cf84"}'''
3030
- kubectl apply --kubeconfig /etc/kubernetes/admin.conf -f https://raw.githubusercontent.com/packethost/packet-ccm/master/deploy/releases/v1.0.0/deployment.yaml
3131
preKubeadmCommands:
32+
- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
3233
- swapoff -a
34+
- mount -a
3335
- apt-get -y update
3436
- DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https curl
3537
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
@@ -144,7 +146,9 @@ spec:
144146
template:
145147
spec:
146148
preKubeadmCommands:
149+
- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
147150
- swapoff -a
151+
- mount -a
148152
- apt-get -y update
149153
- DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https curl
150154
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

0 commit comments

Comments
 (0)