'Access Denied You are not authorized to access Monitoring

I have an elasticSearch cluster with 3 master and 2 data nodes. In addition, I have another node with KIbana and ElasticSearch (role=[] --coordinating-node)

The cluster is working, and I can launch the KIbana UI. However, I see the following error when I access stack monitoring

Access Denied You are not authorized to access Monitoring. To use Monitoring, you need the privileges granted by both the kibana_admin and monitoring_user roles.

If you are attempting to access a dedicated monitoring cluster, this might be because you are logged in as a user that is not configured on the monitoring cluster.

ElasticSearch 8.1 KIbana 8.1 I am logged in as the elastic superuser



Solution 1:[1]

You need to add remote_cluster_clientrole to the nodes.

Example using ECK

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: elasticsearch
  namespace: elastic-system
spec:
  version: 8.1.0
  nodeSets:
  - name: default
    config:
      node.roles: ["master", "data", "ingest", "ml", "remote_cluster_client"]

Solution 2:[2]

I solved the problem by adding new role (remote_cluster_client) in es cluster node.

Example:

node.roles: [ master , data , remote_cluster_client ]

Solution 3:[3]

This is how I fixed this

add monitoring.ui.ccs.enabled: false in your kibana.yaml

from the Doc here https://www.elastic.co/guide/en/kibana/8.0/monitoring-settings-kb.html

monitoring.ui.ccs.enabled Set to true (default) to enable cross-cluster search of your monitoring data. >The remote_cluster_client role must exist on each node.

so if you don't have remote_cluster_client role on every node, this needs to be false.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Camil
Solution 2
Solution 3 maxisam