Configuring Kubernetes monitoring profile


Monitor the performance and metrics of your Kubernetes cluster, namespaces, and workloads. For details about what attributes are collected in monitoring, see Monitor-types-and-attributes.

To configure Kubernetes cluster monitoring

  1. Perform one of the following actions:
    1. In BMC Helix Operations Managementselect Configuration > Monitoring Policies > Create Policy.
    2. In TrueSight Operations Management, Select Configuration > Infrastructure Policies > Create Policy.
  2. Click Add Monitoring Configuration.
  3. From the Monitoring Solution list, select Kubernetes.
  4. From the Monitor Profile and Monitor Type lists, select Kubernetes.
  5. In the Kubernetes Monitoring Configuration section, click Add.

The following table lists the fields that are displayed on the Kubernetes Cluster Details page:

Field

Description

Kubernetes Cluster Details

Master Node

Enter the hostname or the IP address of the Kubernetes master node or load balancer. To get the master hostname (API server) or IP address, run the kubectl cluster-info command on the cluster.

  • If you are using Helix Monitor Agent, you can specify any name to identify the cluster. The cluster instance will be created by the specified name.
  • If you are using Helix Monitor Agent and you want to use a single policy to monitor multiple clusters, you must define the environment variable BMC_K8S_KM_CLUSTER_NAME.

For example, BMC_K8S_KM_CLUSTER_NAME = Prod_Cluster

Port Number

Enter the port number to connect to the Kubernetes master node. The default port number is 6443.

To get the master node port, run the kubectl cluster-info command on the cluster.

Authentication Type

Select the authentication type to connect to the Kubernetes cluster.

  • Certificate based
  • Token based

If you are using Helix Monitor Agent, use Token based.

Client Certificate File Path (.pfx)

(For certificate-based authentication)

Enter the absolute path of the client certificate file on the PATROL Agent server. The certificate file must be in the .pfx format.

Use this sample script to create the .pfx client certificate for Kubernetes monitoring.

For example,

./create-certificate.sh <certificate_name> <certificate_password>

Where,

  • <certificate_name>: The name of the certificate to be created.
  • <certificate_password>: The password to protect the certificate's private key.

Important:

The client certificate file must reside on the host where the PATROL Agent is running.

BMC PATROL default account must have read permission for the client certificate file.

For example:

  • C:\cert\client-cert.pfx
  • /opt/bmc/cert/client-cert.pfx

Client Certificate Password

(For certificate-based authentication)

Enter the password to access the client certificate file.

Authentication Token

(For token-based authentication)

Enter the bearer token to connect to the Kubernetes cluster. Use this sample script to create a service account and get the bearer token. 

For example,

./create-service-account.sh <Service_account_name> <namespace> <cluster_role>

Where,

  • <Service_account_name>: The name of the service account to be created.
  • <namespace>: The namespace in which the service account will be created.
  • <cluster_role>: The cluster role to be assigned to the service account. Make sure the cluster role has the required permissions.

If you are using Helix Monitor Agent and want to auto-discover cluster entities, keep this field blank. For auto-discovery, make sure the service account has the required permissions.

Proxy Server Configuration

Use Proxy Configuration

Select this option to enable communication through a proxy server.

Server Name

Enter the name or the IP address of the proxy server that is being used to route the HTTP requests.

Port

Enter the proxy server port number that is being used to connect to the specified proxy server.

User Name

Enter the username to log in to the proxy server.

Password

Enter the password to the specified proxy server.

Object Filtering

Namespace Filter Type

Select whether to Include or Exclude the Kubernetes cluster namespaces from monitoring.

Namespace Filter

Enter the Kubernetes cluster namespace name that you want to include or exclude from monitoring.

You can enter the exact Kubernetes cluster namespace name or a regular expression matching multiple namespaces. To add multiple entries, enter a pipe-separated list of the namespaces.

Filtering examples:

Example 1

To filter a single namespace MyNamespace, enter the following name:
MyNamespace

Example 2

To filter namespaces ProdNamespace and QANamespace, enter the following regular expression:
ProdNamespace|QANamespace

Example 3

To filter all the namespaces that start with the word Test, enter the following regular expression:
Test.*

Enable Containers Monitoring

Select this option if you want to monitor containers. The KM discovers the containers below the pod instances.

Job Monitoring Configuration

Enable Job Monitoring

Select the checkbox to enable job monitoring in the Kubernetes environment.

Job Filter Type

Select whether to Include or Exclude the Kubernetes cluster jobs from monitoring.

Job Filter

Enter the Kubernetes cluster job name that you want to include or exclude from monitoring.

You can enter the exact Kubernetes cluster job name or a regular expression matching multiple job names. To add multiple entries, enter a pipe-separated list of the job names.

Filtering examples:

Example 1

To filter a single job Job1, enter the following name:
Job1

Example 2

To filter namespaces Job1 and Job2, enter the following regular expression:
Job1|Job2

Example 3

To filter all the jobs that start with the word Job, enter the following regular expression:
Job.*

Enable Monitoring of job pods

Select the checkbox to monitor the pods for the filtered Kubernetes jobs.

Administration

JVM Arguments

Enter the additional Java Virtual Machine arguments for the Java collector. 

Example

For Java memory settings, enter Xms256m -Xmx1024m.

Set the following JVM arguments to use host names instead of IP addresses as identifiers:

  • -DuseNodeLabelName: Set to any field name from the available labels that you want to use for the node instance name.

    • To use the 'name' field from labels, use the following variable:
      -DuseNodeLabelName=name
    • To use the 'kubernetes.io/hostname' field from labels, use the following variable:
      -DuseNodeLabelName=kubernetes.io/hostname

  • -DuseNodeLabelInSID:  Set to 1 to use the selected label value in the instance ID (SID) of the node instance or 0 to unset.

    Important

    If your monitoring process works correctly and you set -DuseNodeLabelInSID=1, then the new instances will be created with the label, and previous performance (history) data for the node instance will be lost.

Important

If your monitoring process is functioning correctly and you make changes in policy for JVM arguments, you must restart the PATROL Agent service for those changes to take effect.

Enable Logging

Select the checkbox to enable the debug. The log files are located at <PATROL_HOME>/k8s/log on the PATROL Agent server.

Log Level

Select the debug log level. These levels are used to control the logging output.

  • FINE
  • FINER
  • FINEST

FINEST level logs each debug log record.

Important:

If debug is disabled, the log file contains only warning-level log records.

Device Mapping

  • Node–Select one of the following options to enable device mapping of nodes: 
    • Node nameName of the node set in Kubernetes Cluster.
    • Host nameName of the host returned by the API.
    • Reverse DNS lookupFQDN by resolving the DNS from its IP address.
    • NoneDisable Node device mapping.

The KM creates the node device based on the selection. If device mapping is disabled by selecting None, the nodes are displayed as instances in their respective hierarchy under the PATROL Agent device.

  • Pod-Select the checkbox to enable device mapping of pods. The KM creates the device by using the name and the IP address of the pod. If device mapping is disabled for pods, the pods are displayed as instances in TrueSight in their respective hierarchy under the PATROL Agent device.
  • Container-Select the check box to enable device mapping of containers. The KM creates the container device by concatenating pod and container names; for example, <pod-name>-<container-name>. If device mapping is disabled for containers on the device page, the containers are displayed as instances in their respective hierarchy under the PATROL Agent device.

Important:

If you modify this field, restart the PATROL Agent to apply the changes.

JAVA Home

Enter the path to the JRE directory on the PATROL Agent server.

For example, if the JAVA location on the PATROL Agent server is /usr/java/jdk1.8.0_45/jre/bin/java, specify /usr/java/jdk1.8.0_45/jre as the value in this field.

 If the specified path does not exist or if this field is left blank, the KM searches for the JRE in the following order:

  1. <PATROL_HOME>/openjdk directory
  2. <PATROL_HOME>/jre64 directory


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*