-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
After switching to OVN-K we observed increase in memory resource and one way to tackle it to have swap enabled on the node. This PR is try to do following. - Enable only `NodeSwap` feature gate instead complete Tech preview features. - https://docs.openshift.com/container-platform/4.15/rest_api/config_apis/featuregate-config-openshift-io-v1.html - Add `swapaccount=1` to kernel argument which is required for the swap - https://docs.openshift.com/container-platform/4.15/nodes/nodes/nodes-nodes-managing.html#nodes-nodes-swap-memory_nodes-nodes-managing - Add swap feature to kubelet config - Add systemd unit file to create swap and enable it - Extend the disk size by 4GB because that much of space used for swap
- Loading branch information
1 parent
47ff542
commit 2a8f953
Showing
5 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: machineconfiguration.openshift.io/v1 | ||
kind: KubeletConfig | ||
metadata: | ||
name: swap-config | ||
spec: | ||
machineConfigPoolSelector: | ||
matchLabels: | ||
pools.operator.machineconfiguration.openshift.io/master: "" | ||
kubeletConfig: | ||
failSwapOn: false | ||
memorySwap: | ||
swapBehavior: UnlimitedSwap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: machineconfiguration.openshift.io/v1 | ||
kind: MachineConfig | ||
metadata: | ||
labels: | ||
machineconfiguration.openshift.io/role: master | ||
name: 99-kernel-swapcount-arg | ||
spec: | ||
config: | ||
ignition: | ||
version: 3.4.0 | ||
kernelArguments: | ||
- swapaccount=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
apiVersion: machineconfiguration.openshift.io/v1 | ||
kind: MachineConfig | ||
metadata: | ||
labels: | ||
machineconfiguration.openshift.io/role: master | ||
name: 99-openshift-machineconfig-master-swap-service | ||
spec: | ||
config: | ||
ignition: | ||
version: 3.4.0 | ||
systemd: | ||
units: | ||
- contents: | | ||
[Unit] | ||
Description=Create 4GB swap partition | ||
Before=var-crc-swapfile1.swap | ||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStart=/usr/bin/mkdir -p /var/crc | ||
ExecStart=/usr/bin/fallocate -l 4096m /var/crc/swapfile1 | ||
ExecStart=/usr/bin/chmod 600 /var/crc/swapfile1 | ||
ExecStart=/usr/sbin/mkswap /var/crc/swapfile1 | ||
[Install] | ||
WantedBy=multi-user.target | ||
enabled: false | ||
name: swap-partition.service | ||
- contents: | | ||
[Unit] | ||
Description=Turn on the swap | ||
[Swap] | ||
What=/var/crc/swapfile1 | ||
[Install] | ||
WantedBy=multi-user.target | ||
enabled: false | ||
name: var-crc-swapfile1.swap | ||
networkd: {} | ||
passwd: {} | ||
storage: {} | ||
osImageURL: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: config.openshift.io/v1 | ||
kind: FeatureGate | ||
metadata: | ||
name: cluster | ||
spec: | ||
customNoUpgrade: | ||
enabled: | ||
- NodeSwap | ||
- BuildCSIVolumes | ||
featureSet: CustomNoUpgrade | ||
status: | ||
featureGates: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters