$ oc -n openshift-monitoring get configmap cluster-monitoring-config
The OKD installation program provides only a low number of configuration options before installation. Configuring most OKD framework components, including the cluster monitoring stack, happens after the installation.
This section explains which monitoring components can be configured and how to prepare for configuring the monitoring stack.
|
This table shows the monitoring components you can configure and the keys used to specify the components in the cluster-monitoring-config
config map.
Component | cluster-monitoring-config config map key |
---|---|
Prometheus Operator |
|
Prometheus |
|
Alertmanager |
|
Thanos Querier |
|
kube-state-metrics |
|
monitoring-plugin |
|
openshift-state-metrics |
|
Telemeter client |
|
Metrics Server |
|
Different configuration changes to the
Each procedure that requires a change in the config map includes its expected outcome. |
You can configure the core OKD monitoring components by creating and updating the cluster-monitoring-config
config map in the openshift-monitoring
project. The Cluster Monitoring Operator (CMO) then configures the core components of the monitoring stack.
You have access to the cluster as a user with the cluster-admin
cluster role.
You have installed the OpenShift cli (oc
).
Check whether the cluster-monitoring-config
ConfigMap
object exists:
$ oc -n openshift-monitoring get configmap cluster-monitoring-config
If the ConfigMap
object does not exist:
Create the following YAML manifest. In this example the file is called cluster-monitoring-config.yaml
:
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-monitoring-config
namespace: openshift-monitoring
data:
config.yaml: |
Apply the configuration to create the ConfigMap
object:
$ oc apply -f cluster-monitoring-config.yaml
As a cluster administrator, you can monitor all core OKD and user-defined projects.
You can also grant developers and other users different permissions for core platform monitoring. You can grant the permissions by assigning one of the following monitoring roles or cluster roles:
Name | Description | Project |
---|---|---|
|
Users with this role have the ability to access Thanos Querier API endpoints. Additionally, it grants access to the core platform Prometheus API and user-defined Thanos Ruler API endpoints. |
|
|
Users with this role can manage |
|
|
Users with this role can manage the Alertmanager API for core platform monitoring. They can also manage alert silences in the Administrator perspective of the OKD web console. |
|
|
Users with this role can monitor the Alertmanager API for core platform monitoring. They can also view alert silences in the Administrator perspective of the OKD web console. |
|
|
Users with this cluster role have the same access rights as |
Must be bound with |
You can grant users permissions for the openshift-monitoring
project or their own projects, by using the OKD web console.
You have access to the cluster as a user with the cluster-admin
cluster role.
The user account that you are assigning the role to already exists.
In the Administrator perspective of the OKD web console, go to User Management → RoleBindings → Create binding.
In the Binding Type section, select the Namespace Role Binding type.
In the Name field, enter a name for the role binding.
In the Namespace field, select the project where you want to grant the access.
The monitoring role or cluster role permissions that you grant to a user by using this procedure apply only to the project that you select in the Namespace field. |
Select a monitoring role or cluster role from the Role Name list.
In the Subject section, select User.
In the Subject Name field, enter the name of the user.
Select Create to apply the role binding.
You can grant users permissions for the openshift-monitoring
project or their own projects, by using the OpenShift cli (oc
).
Whichever role or cluster role you choose, you must bind it against a specific project as a cluster administrator. |
You have access to the cluster as a user with the cluster-admin
cluster role.
The user account that you are assigning the role to already exists.
You have installed the OpenShift cli (oc
).
To assign a monitoring role to a user for a project, enter the following command:
$ oc adm policy add-role-to-user <role> <user> -n <namespace> --role-namespace <namespace> (1)
1 | Substitute <role> with the wanted monitoring role, <user> with the user to whom you want to assign the role, and <namespace> with the project where you want to grant the access. |
To assign a monitoring cluster role to a user for a project, enter the following command:
$ oc adm policy add-cluster-role-to-user <cluster-role> <user> -n <namespace> (1)
1 | Substitute <cluster-role> with the wanted monitoring cluster role, <user> with the user to whom you want to assign the cluster role, and <namespace> with the project where you want to grant the access. |