Rancher 部署Grafana+项目监控并集成LDAP

业务服务暴露了prometheus的指标,现需要获取该指标值,并用grafana进行展示,并集成ldap验证登入grafana

1、启动监控

在rancher对应的业务的项目下启用监控,工具 -> 监控。在服务列表中能够找到两个服务,这两个服务都可以访问prometheus数据。

http://access-prometheus
http://expose-prometheus:8080

2、部署Grafana

镜像

grafana/grafana:6.5.1

密文:grafana

GF_SECURITY_ADMIN_PASSWORD=admin123

环境变量

添加变量,声明ldap配置文件

GF_AUTH_LDAP_CONFIG_FILE=/opt/ldap.toml
GF_AUTH_LDAP_ENABLED=true

添加附加资源

类型:Secret,源:grafana,键:All

数据卷

添加PVC

pvc-grafana-data        //pvc
/var/lib/grafana        //容器路径

添加配置映射 /opt/ldap.toml

# To troubleshoot and get more log info enable ldap debug logging in grafana.ini
# [log]
# filters = ldap:debug

[[servers]]
# Ldap server host (specify multiple hosts space separated)
host = "172.16.5.123"
# Default port is 389 or 636 if use_ssl = true
port = 389
# Set to true if ldap server supports TLS
use_ssl = false
# Set to true if connect ldap server with STARTTLS pattern (create connection in insecure, then upgrade to secure connection with TLS)
start_tls = false
# set to true if you want to skip ssl cert validation
ssl_skip_verify = false
# set to the path to your root CA certificate or leave unset to use system defaults
# root_ca_cert = "/path/to/certificate.crt"
# Authentication against LDAP servers requiring client certificates
# client_cert = "/path/to/client.crt"
# client_key = "/path/to/client.key"

# Search user bind dn
bind_dn = "cn=manager,dc=tencent,dc=cn"
# Search user bind password
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
bind_password = 'admin123'

# User search filter, for example "(cn=%s)" or "(sAMAccountName=%s)" or "(uid=%s)"
search_filter = "(uid=%s)"

# An array of base dns to search through
search_base_dns = ["ou=员工,dc=tencent,dc=cn"]

## For Posix or LDAP setups that does not support member_of attribute you can define the below settings
## Please check grafana LDAP docs for examples
group_search_filter = "(&(objectClass=posixGroup)(memberUid=%s))"
group_search_base_dns = ["ou=部门,dc=tencent,dc=cn"]
group_search_filter_user_attribute = "uid"

# Specify names of the ldap attributes your ldap uses
[servers.attributes]
name = "givenName"
surname = "sn"
username = "cn"
member_of = "cn"
email =  "email"

# Map ldap groups to grafana org roles
[[servers.group_mappings]]
group_dn = "cn=admins,ou=groups,dc=grafana,dc=org"
org_role = "Admin"
# To make user an instance admin  (Grafana Admin) uncomment line below
# grafana_admin = true
# The Grafana organization database id, optional, if left out the default org (id 1) will be used
# org_id = 1

[[servers.group_mappings]]
group_dn = "cn=users,ou=groups,dc=grafana,dc=org"
org_role = "Editor"

[[servers.group_mappings]]
# If you want to match all (or no ldap groups) then you can use wildcard
group_dn = "*"
org_role = "Viewer"

grafana集成LDAP参考:https://grafana.com/docs/grafana/latest/auth/ldap/

3、配置Grafana

添加数据源,因为grafana服务和该启用监控的项目不在用一个namespace,使用如下两个地址都可以访问。

http://access-prometheus.cattle-prometheus-p-jtkrp
http://expose-prometheus.metrics-prometheus-p-jtkrp:8080

如果grafana和该项目不在同一个集群,则需要对access-prometheus再配置ingress暴露到集群外访问。

4、说明

1、如果收集整个集群的POD占用资源等数据,需要访问RancherSystem 项目中cattle-prometheus命名空间下的access-prometheusexpose-prometheus-metrics 服务。

2、集成LDAP后,账号设置admin角色后,每次登入都会被重置权限。可以创建 Team,并赋予相关权限。

原文地址:https://www.cnblogs.com/weavepub/p/12360754.html

时间: 2024-08-27 02:41:09

Rancher 部署Grafana+项目监控并集成LDAP的相关文章

利用rancher部署监控系统并实现存储持久化

一.背景 通过rancher来管理k8s集群是一个非常不错的选择,其自带的应用商店非常丰富,对于某些应用可以帮助我们快速实现,以下记录了利用rancher快速部署prometheus监控系统,并实现持久化存储. 二.实现步骤 Rancher版本:v2.2.2共享存储:ceph RBD(v13.2.5 mimic版) 1.准备存储类 Rancher应用商店提供的应用只能通过调用存储类实现持久存储,所以我们先要准备一个存储类.存储类可以实现PV的动态创建,根据自己需求提前准备好共享存储,K8S存储类

在Marathon 上部署 cAdvisor + InfluxDB + Grafana Docker监控

关于 Docker 容器的监控,google cAdvisor 是个很好的工具,但是它默认只显示实时数据,不储存历史数据.为了存储和显示历史数据.自定义展示图,可以把将cAdvisor与InfluxDB.Grafana 集成起来. 需要的镜像: tutum/influxdb google/cadvisor grafana/grafana 安装:有8台mesos-slave,都需要运行一个cAdvisor docker实例对docker进行监控,然后需要运行一个InfluxDB docker实例存

[经验交流] 在 Mesos Marathon 上部署 cAdvisor + InfluxDB + Grafana Docker监控

关于 Docker 容器的监控,google cAdvisor 是个很好的工具,但是它默认只显示实时数据,不储存历史数据.为了存储和显示历史数据.自定义展示图,可以把将cAdvisor与InfluxDB.Grafana 集成起来,国外的专家 Brian Christner 写了一篇文章”How to setup Docker Monitoring“,描述了部署方法. Brian 的方法是手动运行 docker run 命令进行部署,为了能在 Mesos Marathon 平台上自动部署,我对他的

部署点评Cat监控项目

在项目中监控代码运行的状况,可以采用点评的Cat项目来监控整个项目,但是按照官方的文档来部署cat,总会遇到各种问题,讲解的也不够简明清楚,现在用一个单机来部署运行cat监控项目. 首先,到项目的Git网页下载整个项目: https://github.com/dianping/cat 接着就是进入这个项目的目录,运行打包安装命令: mvn clean install -DskipTests  (需要maven) 执行完成后,运行 CAT 安装插件命令: mvn cat:install 会提示输入

部署点评Cat监控项目(转)

原文地址: 在项目中监控代码运行的状况,可以采用点评的Cat项目来监控整个项目,但是按照官方的文档来部署cat,总会遇到各种问题,讲解的也不够简明清楚,现在用一个单机来部署运行cat监控项目. 首先,到项目的git网页下载整个项目: https://github.com/dianping/cat 接着就是进入这个项目的目录,运行打包安装命令: mvn clean install -DskipTests  (需要maven) 执行完成后,运行 CAT 安装插件命令: mvn cat:install

Zeppelin集成LDAP的部署和实践

环境信息: Zeppelin版本:0.7.0 Kylin版本:1.6.0 Zeppelin部署: 1.      修改$ZEPPELIN_HOME/conf/shiro.ini文件,配置Zeppelin集成LDAP: ### A sample for configuring LDAP DirectoryRealm ldapRealm = org.apache.zeppelin.realm.LdapGroupRealm ## search base for ldap groups (onlyrel

使用JspStudy集成环境快速部署jsp项目

1. 安装jdk 本人网盘资源:https://yunpan.cn/ckZLNbqxkDYYe (提取码:b5e8) 去jdk官网下载最新的jdk: http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u2-download-1377129.html 2. 配置环境变量: 1) 系统变量→新建 JAVA_HOME 变量 . 变量值填写jdk的安装目录(本人是 C:\Program Files\Java\jdk1.8.0_91)

k8s+Prometheus+Grafana的监控部署

一.安装部署k8s集群 可以参考https://www.cnblogs.com/liugp/p/12115945.html 二.Prometheus+Grafana的监控部署 2.1.master/node节点环境部署 在[master]可以进行安装部署安装git,并下载相关yaml文件 https://gitee.com/liugpwwwroot/k8s-prometheus-grafana.git 在[node]节点下载监控所需镜像(非必须) docker pull prom/node-ex

ldap配置系列二:jenkins集成ldap

ldap配置系列二:jenkins集成ldap jenkins简介 jenkins是一个独立的.开放源码的自动化服务器,它可以用于自动化与构建.测试.交付或部署软件相关的各种任务. jenkins官方文档: https://jenkins.io/doc/ jenkins安装 jenkins下载地址: https://jenkins.io/download/ # jdk1.8下载 [[email protected]_0_15_centos local]# wget http://download