exporter 是用来收集数据的,要监测不同的东西,就需要有不同的 exporter。比如要监测
mysql,需要创建一个 mysql 的 exporter,要监测 pod 则需要 pod 的 exporter,要监测
kube-proxy 则需要一个 kube-proxy 的 exporter 等等。
[root@vms61 prometheus-operator]# helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
[root@vms61 prometheus-operator]# helm install mon .
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
NAME: mon
LAST DEPLOYED: Sat Oct 17 13:59:52 2020
NAMESPACE: chap11-helm
STATUS: deployed
REVISION: 1
NOTES:
The Prometheus Operator has been installed. Check its status by running:
kubectl --namespace chap11-helm get pods -l "release=mon"
Visit https://github.com/coreos/prometheus-operator for instructions on how
to create & configure Alertmanager and Prometheus instances using the Operator.
[root@vms61 prometheus-operator]# kubectl get pods
NAME READY STATUS RESTARTS AGE
alertmanager-mon-prometheus-operator-alertmanager-0 0/2 ContainerCreating 0 15s
mon-grafana-f9bfc447d-7s9bb 0/2 PodInitializing 0 41s
mon-kube-state-metrics-568976749-4rwsc 1/1 Running 0 41s
mon-prometheus-node-exporter-bmjhn 1/1 Running 0 41s
mon-prometheus-node-exporter-d2tj8 1/1 Running 0 41s
mon-prometheus-node-exporter-hz7gz 1/1 Running 0 41s
mon-prometheus-operator-operator-f5d8c8b49-dnhct 2/2 Running 0 41s
prometheus-mon-prometheus-operator-prometheus-0 0/3 ContainerCreating 0 5s
[root@vms61 prometheus-operator]# kubectl get pods
NAME READY STATUS RESTARTS AGE
alertmanager-mon-prometheus-operator-alertmanager-0 2/2 Running 0 4m43s
mon-grafana-f9bfc447d-7s9bb 2/2 Running 0 5m9s
mon-kube-state-metrics-568976749-4rwsc 1/1 Running 0 5m9s
mon-prometheus-node-exporter-bmjhn 1/1 Running 0 5m9s
mon-prometheus-node-exporter-d2tj8 1/1 Running 0 5m9s
mon-prometheus-node-exporter-hz7gz 1/1 Running 0 5m9s
mon-prometheus-operator-operator-f5d8c8b49-dnhct 2/2 Running 0 5m9s
prometheus-mon-prometheus-operator-prometheus-0 3/3 Running 1 4m33s
[root@vms61 prometheus-operator]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
alertmanager-operated ClusterIP None <none> 9093/TCP,9094/TCP,9094/UDP 5m54s
mon-grafana ClusterIP 10.104.98.81 <none> 80/TCP 6m21s
mon-kube-state-metrics ClusterIP 10.106.52.226 <none> 8080/TCP 6m20s
mon-prometheus-node-exporter ClusterIP 10.101.70.99 <none> 9100/TCP 6m20s
mon-prometheus-operator-alertmanager ClusterIP 10.101.189.189 <none> 9093/TCP 6m20s
mon-prometheus-operator-operator ClusterIP 10.100.215.55 <none> 8080/TCP,443/TCP 6m21s
mon-prometheus-operator-prometheus ClusterIP 10.105.9.119 <none> 9090/TCP 6m21s
prometheus-operated ClusterIP None <none> 9090/TCP 5m44s
[root@vms61 prometheus-operator]# kubectl edit svc mon-grafana
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
annotations:
meta.helm.sh/release-name: mon
meta.helm.sh/release-namespace: chap11-helm
creationTimestamp: "2020-10-17T06:00:14Z"
labels:
app: grafana
app.kubernetes.io/managed-by: Helm
chart: grafana-4.3.0
heritage: Helm
release: mon
name: mon-grafana
namespace: chap11-helm
resourceVersion: "830868"
selfLink: /api/v1/namespaces/chap11-helm/services/mon-grafana
uid: 360e9f2b-ba84-4409-9aa9-be6027be1f36
spec:
clusterIP: 10.104.98.81
ports:
- name: service
port: 80
protocol: TCP
targetPort: 3000
selector:
app: grafana
release: mon
sessionAffinity: None
type: NodePort
status:
loadBalancer: {}
那么账号密码怎么查看呢?
[root@vms61 prometheus-operator]# kubectl get sa
NAME SECRETS AGE
default 1 2d2h
mon-grafana 1 11m
mon-grafana-test 1 11m
mon-kube-state-metrics 1 11m
mon-prometheus-node-exporter 1 11m
mon-prometheus-operator-alertmanager 1 11m
mon-prometheus-operator-operator 1 11m
mon-prometheus-operator-prometheus 1 11m
[root@vms61 prometheus-operator]# kubectl get secrets mon-grafana -o yaml
[root@vms61 prometheus-operator]# echo YWRtaW4= | base64 -d
admin
[root@vms61 prometheus-operator]# echo cHJvbS1vcGVyYXRvcg== | base64 -d
prom-operator
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。