Questo contenuto non è disponibile nella lingua selezionata.
Chapter 21. Requesting CRI-O and Kubelet profiling data by using the Node Observability Operator
The Node Observability Operator collects and stores the CRI-O and Kubelet profiling data of worker nodes. You can query the profiling data to analyze the CRI-O and Kubelet performance trends and debug the performance related issues.
The Node Observability Operator is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
21.1. Workflow of the Node Observability Operator Copia collegamentoCollegamento copiato negli appunti!
The following workflow outlines on how to query the profiling data using the Node Observability Operator:
- Install the Node Observability Operator in the OpenShift Container Platform cluster.
-
Create a custom resource to enable the CRI-O profiling on the worker nodes of your choice.
NodeObservability - Run the profiling query to generate the profiling data.
21.2. Installing the Node Observability Operator Copia collegamentoCollegamento copiato negli appunti!
The Node Observability Operator is not installed in OpenShift Container Platform by default. You can install the Node Observability Operator by using the OpenShift Container Platform CLI or the web console.
21.2.1. Installing the Node Observability Operator using the CLI Copia collegamentoCollegamento copiato negli appunti!
You can install the Node Observability Operator by using the OpenShift CLI (oc).
Prerequisites
- You have installed the OpenShift CLI (oc).
-
You have access to the cluster with privileges.
cluster-admin
Procedure
Confirm that the Node Observability Operator is available by running the following command:
$ oc get packagemanifests -n openshift-marketplace node-observability-operatorExample output
NAME CATALOG AGE node-observability-operator Red Hat Operators 9hCreate the
namespace by running the following command:node-observability-operator$ oc new-project node-observability-operatorCreate an
object YAML file:OperatorGroupcat <<EOF | oc apply -f - apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: node-observability-operator namespace: node-observability-operator spec: targetNamespaces: [] EOFCreate a
object YAML file to subscribe a namespace to an Operator:Subscriptioncat <<EOF | oc apply -f - apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: node-observability-operator namespace: node-observability-operator spec: channel: alpha name: node-observability-operator source: redhat-operators sourceNamespace: openshift-marketplace EOF
Verification
View the install plan name by running the following command:
$ oc -n node-observability-operator get sub node-observability-operator -o yaml | yq '.status.installplan.name'Example output
install-dt54wVerify the install plan status by running the following command:
$ oc -n node-observability-operator get ip <install_plan_name> -o yaml | yq '.status.phase'is the install plan name that you obtained from the output of the previous command.<install_plan_name>Example output
COMPLETEVerify that the Node Observability Operator is up and running:
$ oc get deploy -n node-observability-operatorExample output
NAME READY UP-TO-DATE AVAILABLE AGE node-observability-operator-controller-manager 1/1 1 1 40h
21.2.2. Installing the Node Observability Operator using the web console Copia collegamentoCollegamento copiato negli appunti!
You can install the Node Observability Operator from the OpenShift Container Platform web console.
Prerequisites
-
You have access to the cluster with privileges.
cluster-admin - You have access to the OpenShift Container Platform web console.
Procedure
- Log in to the OpenShift Container Platform web console.
-
In the Administrator’s navigation panel, expand Operators
OperatorHub. - In the All items field, enter Node Observability Operator and select the Node Observability Operator tile.
- Click Install.
On the Install Operator page, configure the following settings:
- In the Update channel area, click alpha.
- In the Installation mode area, click A specific namespace on the cluster.
- From the Installed Namespace list, select node-observability-operator from the list.
- In the Update approval area, select Automatic.
- Click Install.
Verification
-
In the Administrator’s navigation panel, expand Operators
Installed Operators. - Verify that the Node Observability Operator is listed in the Operators list.
21.3. Creating the Node Observability custom resource Copia collegamentoCollegamento copiato negli appunti!
You must create and run the
NodeObservability
NodeObservability
Creating a
NodeObservability
Kubelet profiling is enabled by default.
The CRI-O unix socket of the node is mounted on the agent pod, which allows the agent to communicate with CRI-O to run the pprof request. Similarly, the
kubelet-serving-ca
Prerequisites
- You have installed the Node Observability Operator.
- You have installed the OpenShift CLI (oc).
-
You have access to the cluster with privileges.
cluster-admin
Procedure
Log in to the OpenShift Container Platform CLI by running the following command:
$ oc login -u kubeadmin https://<HOSTNAME>:6443Switch back to the
namespace by running the following command:node-observability-operator$ oc project node-observability-operatorCreate a CR file named
that contains the following text:nodeobservability.yamlapiVersion: nodeobservability.olm.openshift.io/v1alpha1 kind: NodeObservability metadata: name: cluster1 spec: labels: node-role.kubernetes.io/worker: "" type: crio-kubelet- 1
- You must specify the name as
clusterbecause there should be only oneNodeObservabilityCR per cluster.
Run the
CR:NodeObservabilityoc apply -f nodeobservability.yamlExample output
nodeobservability.olm.openshift.io/cluster createdReview the status of the
CR by running the following command:NodeObservability$ oc get nob/cluster -o yaml | yq '.status.conditions'Example output
conditions: conditions: - lastTransitionTime: "2022-07-05T07:33:54Z" message: 'DaemonSet node-observability-ds ready: true NodeObservabilityMachineConfig ready: true' reason: Ready status: "True" type: ReadyCR run is completed when the reason isNodeObservabilityand the status isReady.True
21.4. Running the profiling query Copia collegamentoCollegamento copiato negli appunti!
To run the profiling query, you must create a
NodeObservabilityRun
/run/node-observability
You can request only one profiling query at any point of time.
Prerequisites
- You have installed the Node Observability Operator.
-
You have created the custom resource (CR).
NodeObservability -
You have access to the cluster with privileges.
cluster-admin
Procedure
Create a
resource file namedNodeObservabilityRunthat contains the following text:nodeobservabilityrun.yamlapiVersion: nodeobservability.olm.openshift.io/v1alpha1 kind: NodeObservabilityRun metadata: name: nodeobservabilityrun spec: nodeObservabilityRef: name: clusterTrigger the profiling query by running the
resource:NodeObservabilityRun$ oc apply -f nodeobservabilityrun.yamlReview the status of the
by running the following command:NodeObservabilityRun$ oc get nodeobservabilityrun nodeobservabilityrun -o yaml | yq '.status.conditions'Example output
conditions: - lastTransitionTime: "2022-07-07T14:57:34Z" message: Ready to start profiling reason: Ready status: "True" type: Ready - lastTransitionTime: "2022-07-07T14:58:10Z" message: Profiling query done reason: Finished status: "True" type: FinishedThe profiling query is complete once the status is
and type isTrue.FinishedRetrieve the profiling data from the container’s
path by running the following bash script:/run/node-observabilityfor a in $(oc get nodeobservabilityrun nodeobservabilityrun -o yaml | yq .status.agents[].name); do echo "agent ${a}" mkdir -p "/tmp/${a}" for p in $(oc exec "${a}" -c node-observability-agent -- bash -c "ls /run/node-observability/*.pprof"); do f="$(basename ${p})" echo "copying ${f} to /tmp/${a}/${f}" oc exec "${a}" -c node-observability-agent -- cat "${p}" > "/tmp/${a}/${f}" done done