k8s 部署 metribeat 实现 kibana 可视化 es 多集群监控指标
apiVersion: v1
kind: ConfigMap
metadata:
name: metribeat-config
namespace: kube-system
data:
metribeat.yml: |-
metricbeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
setup.kibana:
host: "kibana.kube-system.svc:5601"
output.elasticsearch:
hosts: ["http://elasticsearch.monitoring.svc:9200"]
username: "elastic"
password: "changeme"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: metribeat
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
k8s-app: metribeat
template:
metadata:
labels:
k8s-app: metribeat
spec:
serviceAccountName: metribeat
containers:
- name: metribeat
image: docker.elastic.co/beats/metribeat:7.10.0
args: [
"-c", "/usr/share/metribeat/config/metribeat.yml",
"-e",
"-d", "publish"
]
resources:
limits:
memory: 200Mi
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- name: config
mountPath: /usr/share/metribeat/config
- name: elastic-ca-certs
mountPath: /usr/share/metribeat/config/elastic-stack-ca.crt
readOnly: true
volumes:
- name: config
configMap:
name: metribeat-config
items:
- key: metribeat.yml
path: metribeat.yml
- name: elastic-ca-certs
configMap:
name: elastic-stack-ca
items:
- key: elastic-stack-ca.crt
path: elastic-stack-ca.crt
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: metribeat
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: metribeat-read-es-binding
subjects:
- kind: ServiceAccount
name: metribeat
namespace: kube-system
roleRef:
kind: ClusterRole
name:
评论已关闭