1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/virt-configure-ksm-cli.adoc
2025-11-18 16:29:25 +01:00

77 lines
2.1 KiB
Plaintext

// Module included in the following assembly:
//
// * virt/virtual_machines/advanced_vm_management/virt-activating-ksm.adoc
//
:_mod-docs-content-type: PROCEDURE
[id="virt-configure-ksm-cli_{context}"]
= Configuring KSM activation by using the CLI
[role="_abstract"]
You can enable or disable {VirtProductName}'s kernel samepage merging (KSM) activation feature by editing the `HyperConverged` custom resource (CR). Use this method if you want {VirtProductName} to activate KSM on only a subset of nodes.
.Prerequisites
* You have installed the {oc-first}.
.Procedure
. Open the `HyperConverged` CR in your default editor by running the following command:
+
[source,terminal,subs="attributes+"]
----
$ oc edit hyperconverged kubevirt-hyperconverged -n {CNVNamespace}
----
. Edit the `ksmConfiguration` stanza:
* To enable the KSM activation feature for all nodes, set the `nodeLabelSelector` value to `{}`. For example:
+
[source,yaml,subs="attributes+"]
----
apiVersion: hco.kubevirt.io/v1beta1
kind: HyperConverged
metadata:
name: kubevirt-hyperconverged
namespace: {CNVNamespace}
spec:
configuration:
ksmConfiguration:
nodeLabelSelector: {}
# ...
----
* To enable the KSM activation feature on a subset of nodes, edit the `nodeLabelSelector` field. Add syntax that matches the nodes where you want {VirtProductName} to enable KSM. For example, the following configuration allows {VirtProductName} to enable KSM on nodes where both `<first_example_key>` and `<second_example_key>` are set to `"true"`:
+
[source,yaml,subs="attributes+"]
----
apiVersion: hco.kubevirt.io/v1beta1
kind: HyperConverged
metadata:
name: kubevirt-hyperconverged
namespace: {CNVNamespace}
spec:
configuration:
ksmConfiguration:
nodeLabelSelector:
matchLabels:
<first_example_key>: "true"
<second_example_key>: "true"
# ...
----
* To disable the KSM activation feature, delete the `ksmConfiguration` stanza. For example:
+
[source,yaml,subs="attributes+"]
----
apiVersion: hco.kubevirt.io/v1beta1
kind: HyperConverged
metadata:
name: kubevirt-hyperconverged
namespace: {CNVNamespace}
spec:
configuration:
# ...
----
. Save the file.