Recipes - Rook-Ceph and Rafay - Rafay Product Documentation

Monitor

Monitor Ceph Cluster

In this part, you will setup and access the Ceph Dashboard to monitor and manage the Ceph Cluster.


Step 1: Install Prometheus Operator

In order for the Ceph Dashboard to be used to its full potential and display cluster metrics, Prometheus is needed to pass those metrics to the dashboard.

In this step, you will install the Prometheus Operator into the Kubernetes cluster as a custom cluster add-on. The add-on will then be added to the existing custom cluster blueprint.


Step 2: Install Prometheus Server

In this step, you will install a Prometheus Server into the Kubernetes cluster as a custom cluster add-on. The add-on will then be added to the existing custom cluster blueprint.

apiVersion: v1
kind: ServiceAccount
metadata:
  name: prometheus
  namespace: rook-ceph # namespace:cluster
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: prometheus
aggregationRule:
  clusterRoleSelectors:
  - matchLabels:
      rbac.ceph.rook.io/aggregate-to-prometheus: "true"
rules: []
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: prometheus-rules
  labels:
    rbac.ceph.rook.io/aggregate-to-prometheus: "true"
rules:
- apiGroups: [""]
  resources:
  - nodes
  - services
  - endpoints
  - pods
  verbs: ["get", "list", "watch"]
- apiGroups: [""]
  resources:
  - configmaps
  verbs: ["get"]
- nonResourceURLs: ["/metrics"]
  verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: prometheus
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: prometheus
subjects:
- kind: ServiceAccount
  name: prometheus
  namespace: rook-ceph # namespace:cluster
---
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
  name: rook-prometheus
  namespace: rook-ceph # namespace:cluster
  labels:
    prometheus: rook-prometheus
spec:
  serviceAccountName: prometheus
  serviceMonitorSelector:
    matchLabels:
      team: rook
  ruleSelector:
    matchLabels:
      role: alert-rules
      prometheus: rook-prometheus
  resources:
    requests:
      memory: 400Mi
---
apiVersion: v1
kind: Service
metadata:
  name: rook-prometheus
  namespace: rook-ceph # namespace:cluster
spec:
  type: NodePort
  ports:
  - name: web
    nodePort: 30900
    port: 9090
    protocol: TCP
    targetPort: web
  selector:
    prometheus: rook-prometheus

Step 3: Update Rook Ceph Operator add-on

In this step, you will update the Rook Ceph Operator add-on to enable needed monitoring components of the Rook Ceph Helm chart.

monitoring:
  # -- Enable monitoring. Requires Prometheus to be pre-installed.
  # Enabling will also create RBAC rules to allow Operator to create ServiceMonitors
  enabled: true

Step 4: Update Rook Ceph Cluster add-on

In this step, you will update the Rook Ceph Cluster add-on to enable needed monitoring components and dashboard of the Rook Ceph Helm chart.

toolbox:
  enabled: true
monitoring:
  enabled: true
cephClusterSpec:
  dashboard:
    enabled: true

Step 5: Update Blueprint

In this step, you will update the previously created blueprint by adding the newly created and updated add-ons.


Step 6: Apply Blueprint

In this step, you will apply the previously updated blueprint to the cluster. Applying the blueprint will install Prometheus and the Ceph monitoring components.


Step 7: Retrieve Prometheus Server Endpoint

In this step, you will retrieve the Prometheus server endpoint. This endpoint will be used in a cluster override to update the Helm values of the Ceph Cluster add-on. The Ceph dashboard will use this endpoint to retrieve metrics from the Prometheus server.

echo "http://$(kubectl -n rook-ceph -o jsonpath={.status.hostIP} get pod prometheus-rook-prometheus-0):30900"

Step 8: Create Cluster Override

In this step, you will create a cluster override which will assign a cluster specific value to the Ceph Cluster Helm chart. In this case, you will be assigning the Prometheus server endpoint in the cluster to the Ceph Dashboard.

cephClusterSpec:
  dashboard:
    enabled: true
    prometheusEndpoint: <UPDATE ENDPOINT>
    prometheusEndpointSSLVerify: false

Step 9: Apply Blueprint

In this step, you will apply the blueprint to the cluster again to allow the cluster override to take effect.


Step 10: Enable Ceph Orchestrator

In this step, you will enable the Ceph Orchestrator to enable additional functionality within the dashboard.

ceph mgr module enable rook
ceph orch set backend rook

You can verify the orchestrator is enabled by running the following command:

ceph orch status

Step 11: Access Ceph Dashboard

In this step, you will access the Ceph dashboard using port forwarding for simplicity. It is advised to expose the dashboard via ingress or a load balancer.

kubectl -n rook-ceph get secret rook-ceph-dashboard-password -o jsonpath="{['data']['password']}" | base64 --decode && echo
kubectl port-forward service/rook-ceph-mgr-dashboard 28016:8443 -n rook-ceph

Once you are logged in, you will see the dashboard.


Recap

Congratulations! You have successfully enabled monitoring of the Ceph cluster using the Ceph dashboard and Prometheus.