K8S 上部署 Prometheus + Grafana

文章目录

      • 一、使用 Helm 安装 Prometheus
        • 1. 配置源
        • 2. 下载 prometheus 包
        • 3. 安装 prometheus
        • 4. 卸载
      • 二、使用 Helm 安装 Grafana
        • 1. 配置源
        • 2. 安装 grafana
        • 3. 访问
        • 4. 卸载

一、使用 Helm 安装 Prometheus

1. 配置源

  地址:https://artifacthub.io/packages/helm/prometheus-community/prometheus

# 添加repo
$ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
"prometheus-community" has been added to your repositories$ helm repo update prometheus-community
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "prometheus-community" chart repository
Update Complete. ⎈Happy Helming!⎈$ helm search repo prometheus-community/prometheus
NAME                                              	CHART VERSION	APP VERSION	DESCRIPTION                                       
prometheus-community/prometheus                   	25.24.0      	v2.53.1    	Prometheus is a monitoring system and time seri...
prometheus-community/prometheus-adapter           	4.10.0       	v0.11.2    	A Helm chart for k8s prometheus adapter           
prometheus-community/prometheus-blackbox-exporter 	8.17.0       	v0.25.0    	Prometheus Blackbox Exporter                      
prometheus-community/prometheus-cloudwatch-expo...	0.25.3       	0.15.5     	A Helm chart for prometheus cloudwatch-exporter   
prometheus-community/prometheus-conntrack-stats...	0.5.10       	v0.4.18    	A Helm chart for conntrack-stats-exporter         
prometheus-community/prometheus-consul-exporter   	1.0.0        	0.4.0      	A Helm chart for the Prometheus Consul Exporter   
prometheus-community/prometheus-couchdb-exporter  	1.0.0        	1.0        	A Helm chart to export the metrics from couchdb...
prometheus-community/prometheus-druid-exporter    	1.1.0        	v0.11.0    	Druid exporter to monitor druid metrics with Pr...
prometheus-community/prometheus-elasticsearch-e...	6.0.0        	v1.7.0     	Elasticsearch stats exporter for Prometheus       
prometheus-community/prometheus-fastly-exporter   	0.4.0        	v8.1.0     	A Helm chart for the Prometheus Fastly Exporter   
prometheus-community/prometheus-ipmi-exporter     	0.4.0        	v1.8.0     	This is an IPMI exporter for Prometheus.          
prometheus-community/prometheus-json-exporter     	0.13.0       	v0.6.0     	Install prometheus-json-exporter                  
prometheus-community/prometheus-kafka-exporter    	2.10.0       	v1.7.0     	A Helm chart to export the metrics from Kafka i...
prometheus-community/prometheus-memcached-exporter	0.3.3        	v0.14.4    	Prometheus exporter for Memcached metrics         
prometheus-community/prometheus-modbus-exporter   	0.1.2        	0.4.1      	A Helm chart for prometheus-modbus-exporter       
prometheus-community/prometheus-mongodb-exporter  	3.5.0        	0.40.0     	A Prometheus exporter for MongoDB metrics         
prometheus-community/prometheus-mysql-exporter    	2.5.3        	v0.15.1    	A Helm chart for prometheus mysql exporter with...
prometheus-community/prometheus-nats-exporter     	2.17.0       	0.15.0     	A Helm chart for prometheus-nats-exporter         
prometheus-community/prometheus-nginx-exporter    	0.2.1        	0.11.0     	A Helm chart for the Prometheus NGINX Exporter    
prometheus-community/prometheus-node-exporter     	4.37.0       	1.8.1      	A Helm chart for prometheus node-exporter         
prometheus-community/prometheus-opencost-exporter 	0.1.1        	1.108.0    	Prometheus OpenCost Exporter                      
prometheus-community/prometheus-operator          	9.3.2        	0.38.1     	DEPRECATED - This chart will be renamed. See ht...
prometheus-community/prometheus-operator-admiss...	0.14.0       	0.75.1     	Prometheus Operator Admission Webhook             
prometheus-community/prometheus-operator-crds     	13.0.1       	v0.75.0    	A Helm chart that collects custom resource defi...
prometheus-community/prometheus-pgbouncer-exporter	0.3.0        	v0.8.0     	A Helm chart for prometheus pgbouncer-exporter    
prometheus-community/prometheus-pingdom-exporter  	2.5.0        	20190610-1 	A Helm chart for Prometheus Pingdom Exporter      
prometheus-community/prometheus-pingmesh-exporter 	0.4.0        	v1.2.1     	Prometheus Pingmesh Exporter                      
prometheus-community/prometheus-postgres-exporter 	6.0.1        	v0.15.0    	A Helm chart for prometheus postgres-exporter     
prometheus-community/prometheus-pushgateway       	2.14.0       	v1.9.0     	A Helm chart for prometheus pushgateway           
prometheus-community/prometheus-rabbitmq-exporter 	1.12.0       	v0.29.0    	Rabbitmq metrics exporter for prometheus          
prometheus-community/prometheus-redis-exporter    	6.3.0        	v1.61.0    	Prometheus exporter for Redis metrics             
prometheus-community/prometheus-smartctl-exporter 	0.10.0       	v0.12.0    	A Helm chart for Kubernetes                       
prometheus-community/prometheus-snmp-exporter     	5.5.0        	v0.26.0    	Prometheus SNMP Exporter                          
prometheus-community/prometheus-sql-exporter      	0.1.0        	v0.5.4     	Prometheus SQL Exporter                           
prometheus-community/prometheus-stackdriver-exp...	4.5.1        	v0.15.1    	Stackdriver exporter for Prometheus               
prometheus-community/prometheus-statsd-exporter   	0.13.1       	v0.26.1    	A Helm chart for prometheus stats-exporter        
prometheus-community/prometheus-systemd-exporter  	0.3.0        	0.6.0      	A Helm chart for prometheus systemd-exporter      
prometheus-community/prometheus-to-sd             	0.4.2        	0.5.2      	Scrape metrics stored in prometheus format and ...
prometheus-community/prometheus-windows-exporter  	0.3.1        	0.25.1     	A Helm chart for prometheus windows-exporter
2. 下载 prometheus 包
# 拉包
$ helm pull prometheus-community/prometheus$ ll
total 88
drwxr-xr-x 2 root   root    4096 Jul 16 03:12 ./
drwxrwxr-x 9 ubuntu ubuntu  4096 Jul 16 03:10 ../
-rw-r--r-- 1 root   root   80137 Jul 16 03:12 prometheus-25.24.0.tgz# 解包
$ tar -zxvf prometheus-25.24.0.tgz 
prometheus/Chart.yaml
prometheus/Chart.lock
prometheus/values.yaml
prometheus/values.schema.json
prometheus/templates/NOTES.txt
prometheus/templates/_helpers.tpl
prometheus/templates/clusterrole.yaml
prometheus/templates/clusterrolebinding.yaml
prometheus/templates/cm.yaml
prometheus/templates/deploy.yaml
prometheus/templates/extra-manifests.yaml
prometheus/templates/headless-svc.yaml
prometheus/templates/ingress.yaml
prometheus/templates/network-policy.yaml
prometheus/templates/pdb.yaml
prometheus/templates/psp.yaml
prometheus/templates/pvc.yaml
prometheus/templates/rolebinding.yaml
prometheus/templates/service.yaml
prometheus/templates/serviceaccount.yaml
prometheus/templates/sts.yaml
prometheus/templates/vpa.yaml
prometheus/.helmignore
prometheus/README.md
prometheus/ci/01-automount-sa-token-values.yaml
prometheus/ci/02-config-reloader-deployment-values.yaml
prometheus/ci/03-config-reloader-sts-values.yaml
prometheus/ci/04-extra-manifest-values.yaml
prometheus/ci/05-server-deployment-values.yaml
prometheus/ci/06-server-sts-values.yaml
prometheus/ci/07-meta-labels-values.yaml
prometheus/ci/08-sts-pvc-retention-policy-values.yaml
prometheus/ci/09-standalone-deployment-values.yaml
prometheus/ci/10-namespaced-sd-values.yaml
prometheus/ci/11-default-values.yaml
prometheus/charts/alertmanager/Chart.yaml
prometheus/charts/alertmanager/values.yaml
prometheus/charts/alertmanager/values.schema.json
prometheus/charts/alertmanager/templates/NOTES.txt
prometheus/charts/alertmanager/templates/_helpers.tpl
prometheus/charts/alertmanager/templates/configmap.yaml
prometheus/charts/alertmanager/templates/ingress.yaml
prometheus/charts/alertmanager/templates/ingressperreplica.yaml
prometheus/charts/alertmanager/templates/pdb.yaml
prometheus/charts/alertmanager/templates/serviceaccount.yaml
prometheus/charts/alertmanager/templates/serviceperreplica.yaml
prometheus/charts/alertmanager/templates/services.yaml
prometheus/charts/alertmanager/templates/statefulset.yaml
prometheus/charts/alertmanager/templates/tests/test-connection.yaml
prometheus/charts/alertmanager/.helmignore
prometheus/charts/alertmanager/README.md
prometheus/charts/alertmanager/ci/config-reload-values.yaml
prometheus/charts/kube-state-metrics/Chart.yaml
prometheus/charts/kube-state-metrics/values.yaml
prometheus/charts/kube-state-metrics/templates/NOTES.txt
prometheus/charts/kube-state-metrics/templates/_helpers.tpl
prometheus/charts/kube-state-metrics/templates/ciliumnetworkpolicy.yaml
prometheus/charts/kube-state-metrics/templates/clusterrolebinding.yaml
prometheus/charts/kube-state-metrics/templates/crs-configmap.yaml
prometheus/charts/kube-state-metrics/templates/deployment.yaml
prometheus/charts/kube-state-metrics/templates/extra-manifests.yaml
prometheus/charts/kube-state-metrics/templates/kubeconfig-secret.yaml
prometheus/charts/kube-state-metrics/templates/networkpolicy.yaml
prometheus/charts/kube-state-metrics/templates/pdb.yaml
prometheus/charts/kube-state-metrics/templates/podsecuritypolicy.yaml
prometheus/charts/kube-state-metrics/templates/psp-clusterrole.yaml
prometheus/charts/kube-state-metrics/templates/psp-clusterrolebinding.yaml
prometheus/charts/kube-state-metrics/templates/rbac-configmap.yaml
prometheus/charts/kube-state-metrics/templates/role.yaml
prometheus/charts/kube-state-metrics/templates/rolebinding.yaml
prometheus/charts/kube-state-metrics/templates/service.yaml
prometheus/charts/kube-state-metrics/templates/serviceaccount.yaml
prometheus/charts/kube-state-metrics/templates/servicemonitor.yaml
prometheus/charts/kube-state-metrics/templates/stsdiscovery-role.yaml
prometheus/charts/kube-state-metrics/templates/stsdiscovery-rolebinding.yaml
prometheus/charts/kube-state-metrics/templates/verticalpodautoscaler.yaml
prometheus/charts/kube-state-metrics/.helmignore
prometheus/charts/kube-state-metrics/README.md
prometheus/charts/prometheus-node-exporter/Chart.yaml
prometheus/charts/prometheus-node-exporter/values.yaml
prometheus/charts/prometheus-node-exporter/templates/NOTES.txt
prometheus/charts/prometheus-node-exporter/templates/_helpers.tpl
prometheus/charts/prometheus-node-exporter/templates/clusterrole.yaml
prometheus/charts/prometheus-node-exporter/templates/clusterrolebinding.yaml
prometheus/charts/prometheus-node-exporter/templates/daemonset.yaml
prometheus/charts/prometheus-node-exporter/templates/endpoints.yaml
prometheus/charts/prometheus-node-exporter/templates/extra-manifests.yaml
prometheus/charts/prometheus-node-exporter/templates/networkpolicy.yaml
prometheus/charts/prometheus-node-exporter/templates/podmonitor.yaml
prometheus/charts/prometheus-node-exporter/templates/psp-clusterrole.yaml
prometheus/charts/prometheus-node-exporter/templates/psp-clusterrolebinding.yaml
prometheus/charts/prometheus-node-exporter/templates/psp.yaml
prometheus/charts/prometheus-node-exporter/templates/rbac-configmap.yaml
prometheus/charts/prometheus-node-exporter/templates/service.yaml
prometheus/charts/prometheus-node-exporter/templates/serviceaccount.yaml
prometheus/charts/prometheus-node-exporter/templates/servicemonitor.yaml
prometheus/charts/prometheus-node-exporter/templates/verticalpodautoscaler.yaml
prometheus/charts/prometheus-node-exporter/.helmignore
prometheus/charts/prometheus-node-exporter/README.md
prometheus/charts/prometheus-node-exporter/ci/port-values.yaml
prometheus/charts/prometheus-pushgateway/Chart.yaml
prometheus/charts/prometheus-pushgateway/values.yaml
prometheus/charts/prometheus-pushgateway/templates/NOTES.txt
prometheus/charts/prometheus-pushgateway/templates/_helpers.tpl
prometheus/charts/prometheus-pushgateway/templates/deployment.yaml
prometheus/charts/prometheus-pushgateway/templates/extra-manifests.yaml
prometheus/charts/prometheus-pushgateway/templates/ingress.yaml
prometheus/charts/prometheus-pushgateway/templates/networkpolicy.yaml
prometheus/charts/prometheus-pushgateway/templates/pdb.yaml
prometheus/charts/prometheus-pushgateway/templates/pushgateway-pvc.yaml
prometheus/charts/prometheus-pushgateway/templates/secret.yaml
prometheus/charts/prometheus-pushgateway/templates/service.yaml
prometheus/charts/prometheus-pushgateway/templates/serviceaccount.yaml
prometheus/charts/prometheus-pushgateway/templates/servicemonitor.yaml
prometheus/charts/prometheus-pushgateway/templates/statefulset.yaml
prometheus/charts/prometheus-pushgateway/.helmignore
prometheus/charts/prometheus-pushgateway/README.md
3. 安装 prometheus
$ helm install prometheus ./ \-n prometheus \--create-namespace \--set server.ingress.enabled=true \--set server.ingress.hosts='{prometheus.k8s.local}' \--set server.ingress.paths='{/}' \--set server.ingress.pathType=Prefix \--set alertmanager.ingress.enabled=true \--set alertmanager.ingress.hosts='{alertmanager.k8s.local}' \--set alertmanager.ingress.paths='{/}' \--set alertmanager.ingress.pathType=Prefix \--set grafana.ingress.enabled=true \--set grafana.ingress.hosts='{grafana.k8s.local}' \--set grafana.ingress.paths='{/}' \--set grafana.ingress.pathType=Prefix
Error: INSTALLATION FAILED: values don't meet the specifications of the schema(s) in the following chart(s):
alertmanager:
- ingress.hosts.0: Invalid type. Expected: object, given: string# 原因:上面的参数有问题
$ helm install prometheus ./ \-n prometheus \--create-namespace
NAME: prometheus
LAST DEPLOYED: Tue Jul 16 03:55:13 2024
NAMESPACE: prometheus
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The Prometheus server can be accessed via port 80 on the following DNS name from within your cluster:
prometheus-server.prometheus.svc.cluster.localGet the Prometheus server URL by running these commands in the same shell:export POD_NAME=$(kubectl get pods --namespace prometheus -l "app.kubernetes.io/name=prometheus,app.kubernetes.io/instance=prometheus" -o jsonpath="{.items[0].metadata.name}")kubectl --namespace prometheus port-forward $POD_NAME 9090The Prometheus alertmanager can be accessed via port 9093 on the following DNS name from within your cluster:
prometheus-alertmanager.prometheus.svc.cluster.localGet the Alertmanager URL by running these commands in the same shell:export POD_NAME=$(kubectl get pods --namespace prometheus -l "app.kubernetes.io/name=alertmanager,app.kubernetes.io/instance=prometheus" -o jsonpath="{.items[0].metadata.name}")kubectl --namespace prometheus port-forward $POD_NAME 9093
#################################################################################
######   WARNING: Pod Security Policy has been disabled by default since    #####
######            it deprecated after k8s 1.25+. use                        #####
######            (index .Values "prometheus-node-exporter" "rbac"          #####
###### .          "pspEnabled") with (index .Values                         #####
######            "prometheus-node-exporter" "rbac" "pspAnnotations")       #####
######            in case you still need it.                                #####
#################################################################################The Prometheus PushGateway can be accessed via port 9091 on the following DNS name from within your cluster:
prometheus-prometheus-pushgateway.prometheus.svc.cluster.localGet the PushGateway URL by running these commands in the same shell:export POD_NAME=$(kubectl get pods --namespace prometheus -l "app=prometheus-pushgateway,component=pushgateway" -o jsonpath="{.items[0].metadata.name}")kubectl --namespace prometheus port-forward $POD_NAME 9091For more information on running Prometheus, visit:
https://prometheus.io/$ kubectl get pods,svc,ingress -n prometheus
NAME                                                    READY   STATUS    RESTARTS   AGE
pod/prometheus-alertmanager-0                           0/1     Pending   0          90s
pod/prometheus-kube-state-metrics-649c959fbc-rjq5v      1/1     Running   0          90s
pod/prometheus-prometheus-node-exporter-7jdb2           1/1     Running   0          90s
pod/prometheus-prometheus-node-exporter-p6lm4           1/1     Running   0          90s
pod/prometheus-prometheus-node-exporter-t4hcn           1/1     Running   0          90s
pod/prometheus-prometheus-pushgateway-879d6dd6c-wh7x5   1/1     Running   0          90s
pod/prometheus-server-75d49659f-krzp9                   0/2     Pending   0          90sNAME                                          TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/prometheus-alertmanager               ClusterIP   10.68.34.56     <none>        9093/TCP   90s
service/prometheus-alertmanager-headless      ClusterIP   None            <none>        9093/TCP   90s
service/prometheus-kube-state-metrics         ClusterIP   10.68.156.120   <none>        8080/TCP   90s
service/prometheus-prometheus-node-exporter   ClusterIP   10.68.161.251   <none>        9100/TCP   90s
service/prometheus-prometheus-pushgateway     ClusterIP   10.68.229.83    <none>        9091/TCP   90s
service/prometheus-server                     ClusterIP   10.68.120.158   <none>        80/TCP     90s$ kubectl get pvc -n prometheus
NAME                                STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
prometheus-server                   Pending                                                     8m57s
storage-prometheus-alertmanager-0   Pending                                                     8m57s# 有些服务一直处在 Pending,原因是存储卷的问题,改为 nfs 就好使
$ helm install prometheus prometheus-community/prometheus -n prometheus --create-namespace --set server.persistentVolume.storageClass=nfs --set alertmanager.persistence.storageClass=nfs$ kubectl get pods,svc,ingress -n prometheus
NAME                                                    READY   STATUS    RESTARTS   AGE
pod/prometheus-alertmanager-0                           1/1     Running   0          55s
pod/prometheus-kube-state-metrics-649c959fbc-zf9zw      1/1     Running   0          55s
pod/prometheus-prometheus-node-exporter-9mz4q           1/1     Running   0          55s
pod/prometheus-prometheus-node-exporter-cpz26           1/1     Running   0          55s
pod/prometheus-prometheus-node-exporter-h2w68           1/1     Running   0          55s
pod/prometheus-prometheus-pushgateway-879d6dd6c-qqr4z   1/1     Running   0          55s
pod/prometheus-server-75d49659f-s624q                   2/2     Running   0          55sNAME                                          TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/prometheus-alertmanager               ClusterIP   10.68.150.157   <none>        9093/TCP   55s
service/prometheus-alertmanager-headless      ClusterIP   None            <none>        9093/TCP   55s
service/prometheus-kube-state-metrics         ClusterIP   10.68.130.219   <none>        8080/TCP   55s
service/prometheus-prometheus-node-exporter   ClusterIP   10.68.199.239   <none>        9100/TCP   55s
service/prometheus-prometheus-pushgateway     ClusterIP   10.68.171.40    <none>        9091/TCP   55s
service/prometheus-server                     ClusterIP   10.68.196.144   <none>        80/TCP     55s
$ kubectl get pvc -n prometheus
NAME                                STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
prometheus-server                   Bound    pvc-570e1a01-aecc-4d03-82fd-ed195a1266df   8Gi        RWO            nfs            58s
storage-prometheus-alertmanager-0   Bound    pvc-8c19e194-ff8c-4cc7-8bea-142b1adce5ac   2Gi        RWO            nfs            58s

  最终自定义的参数执行:

$ helm install prometheus prometheus-community/prometheus -n prometheus --create-namespace --set server.persistentVolume.storageClass=nfs --set alertmanager.persistence.storageClass=nfs --set server.service.type=NodePort --set alertmanager.service.type=NodePort --set server.service.nodePort=31203 --set alertmanager.service.nodePort=31757root@k8s-master01:/home/ubuntu# kubectl get svc -n prometheus
NAME                                  TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
prometheus-alertmanager               NodePort    10.68.18.91     <none>        9093:31757/TCP   21s
prometheus-alertmanager-headless      ClusterIP   None            <none>        9093/TCP         21s
prometheus-kube-state-metrics         ClusterIP   10.68.181.212   <none>        8080/TCP         21s
prometheus-prometheus-node-exporter   ClusterIP   10.68.215.203   <none>        9100/TCP         21s
prometheus-prometheus-pushgateway     ClusterIP   10.68.69.2      <none>        9091/TCP         21s
prometheus-server                     NodePort    10.68.254.104   <none>        80:31203/TCP     21s
4. 卸载
$ helm uninstall prometheus -n prometheus
release "prometheus" uninstalledkubectl delete pod -n prometheus `kubectl get pod -n prometheus |awk 'NR>1{print $1}'` --force
kubectl patch ns prometheus -p '{"metadata":{"finalizers":null}}'$ kubectl delete ns prometheus --force
Warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
namespace "prometheus" force deleted

二、使用 Helm 安装 Grafana

1. 配置源

  地址:https://artifacthub.io/packages/helm/grafana/grafana

$ helm repo add grafana https://grafana.github.io/helm-charts
"grafana" has been added to your repositories$ helm repo update grafana
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "grafana" chart repository
Update Complete. ⎈Happy Helming!⎈$ helm search repo grafana/grafana
NAME                          	CHART VERSION	APP VERSION	DESCRIPTION                                       
grafana/grafana               	8.3.4        	11.1.0     	The leading tool for querying and visualizing t...
grafana/grafana-agent         	0.41.0       	v0.41.1    	Grafana Agent                                     
grafana/grafana-agent-operator	0.4.0        	0.41.1     	A Helm chart for Grafana Agent Operator           
grafana/grafana-sampling      	0.1.1        	v0.40.2    	A Helm chart for a layered OTLP tail sampling a...
2. 安装 grafana
$ helm install grafana grafana/grafana -n grafana --create-namespace
NAME: grafana
LAST DEPLOYED: Tue Jul 16 06:01:14 2024
NAMESPACE: grafana
STATUS: deployed
REVISION: 1
NOTES:
1. Get your 'admin' user password by running:kubectl get secret --namespace grafana grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo2. The Grafana server can be accessed via port 80 on the following DNS name from within your cluster:grafana.grafana.svc.cluster.localGet the Grafana URL to visit by running these commands in the same shell:export POD_NAME=$(kubectl get pods --namespace grafana -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=grafana" -o jsonpath="{.items[0].metadata.name}")kubectl --namespace grafana port-forward $POD_NAME 30003. Login with the password from step 1 and the username: admin
#################################################################################
######   WARNING: Persistence is disabled!!! You will lose your data when   #####
######            the Grafana pod is terminated.                            #####
#################################################################################$ kubectl get all -o wide -n grafana
NAME                           READY   STATUS    RESTARTS   AGE     IP              NODE        NOMINATED NODE   READINESS GATES
pod/grafana-5b6798c77d-jlkvt   1/1     Running   0          2m37s   172.20.58.239   worker-02   <none>           <none>NAME              TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE     SELECTOR
service/grafana   ClusterIP   10.68.48.202   <none>        80/TCP    2m37s   app.kubernetes.io/instance=grafana,app.kubernetes.io/name=grafanaNAME                      READY   UP-TO-DATE   AVAILABLE   AGE     CONTAINERS   IMAGES                             SELECTOR
deployment.apps/grafana   1/1     1            1           2m37s   grafana      docker.io/grafana/grafana:11.1.0   app.kubernetes.io/instance=grafana,app.kubernetes.io/name=grafanaNAME                                 DESIRED   CURRENT   READY   AGE     CONTAINERS   IMAGES                             SELECTOR
replicaset.apps/grafana-5b6798c77d   1         1         1       2m37s   grafana      docker.io/grafana/grafana:11.1.0   app.kubernetes.io/instance=grafana,app.kubernetes.io/name=grafana,pod-template-hash=5b6798c77d

  最终自定义的参数执行:

$ helm install grafana grafana/grafana -n grafana --create-namespace --set service.type=NodePort --set service.nodePort=31830$ kubectl get svc -n grafana
NAME      TYPE       CLUSTER-IP    EXTERNAL-IP   PORT(S)        AGE
grafana   NodePort   10.68.140.2   <none>        80:31830/TCP   40s
3. 访问

  web 访问:https://yourIp:31830

  账号:admin,密码通过下面命令获取 0D0NfEWWFx9qsBiKR8PuFVxf6PPa9o8YGhZZaNXY

$ kubectl get secret --namespace grafana grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
0D0NfEWWFx9qsBiKR8PuFVxf6PPa9o8YGhZZaNXY

在这里插入图片描述
在这里插入图片描述

4. 卸载
$ helm uninstall grafana -n grafana
release "grafana" uninstalledkubectl delete pod -n grafana `kubectl get pod -n grafana|awk 'NR>1{print $1}'` --force
kubectl patch ns grafana -p '{"metadata":{"finalizers":null}}'
kubectl delete ns grafana --force

参考:【云原生】Prometheus+Grafana on K8s 环境部署

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/48965.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

[路由器]IP-MAC的绑定与取消

背景&#xff1a;当公司的网络不想与外部人员进行共享&#xff0c;可以在路由器页面配置IP-MAC的绑定&#xff0c;让公司内部人员的手机和电脑的mac&#xff0c;才能接入到公司。第一步&#xff1a;在ARP防护中&#xff0c;启动IP-MAC绑定选项&#xff0c;必须启动仅允许IP-MAC…

linux、windows、macos清空本地DNS缓存

文章目录 Linux&#xff1a;Windows&#xff1a;macOS&#xff1a; Linux&#xff1a; 对于使用systemd的操作系统&#xff08;如CentOS 7、Ubuntu 16.04&#xff09;&#xff0c;可以使用以下命令重启systemd-resolved服务来清除缓存&#xff1a; sudo systemctl restart sys…

【ELK】window下ELK的安装与部署

ELK的安装与部署 1. 下载2. 配置&启动2.1 elasticsarch2.1.1 生成证书2.1.2 生成秘钥2.1.3 将凭证迁移到指定目录2.1.4 改配置2.1.5 启动2.1.6 访问测试2.1.7 生成kibana账号 2.2 kibana2.2.1 改配置2.2.2 启动2.2.3 访问测试 2.3 logstash2.3.1 改配置2.3.2 启动 2.4 file…

你了解你的GD32 MCU系统主频是多少吗 ?

系统时钟是GD32 MCU的时基&#xff0c;可以理解为系统的心跳&#xff0c;片上所有的外设以及CPU最原始的时钟都来自于系统时钟&#xff0c;因而明确当前系统时钟是多少非常重要&#xff0c;只有明确了系统时钟&#xff0c;才能够实现准确的定时、准确的采样间隔以及准确的通信速…

通过QT基于C++实现串口通信

1.软件下载 本文所用到的所有软件都在以下连接可以下载 QT下载&#xff08;注意下载路径最好全英&#xff0c;不要出现中文容易有bug&#xff09; 链接&#xff1a;https://pan.baidu.com/s/1XCPlTBQ8fBOKBYO-H0mSVg?pwdm28f 提取码&#xff1a;m28f 串口工具下载 链接&…

二十、Qt位置相关函数

目录 一、函数概述 二、函数实践 三、总结 一、函数概述 Qt 提供了很多关于获取窗体位置及显示区域大小的函数&#xff0c;如 x()、y()和 pos()、react()、size()、geometry()等&#xff0c;统称为“位置相关函数”或“位置函数”&#xff0c; 如下图所示是几种主要的位置函数…

JS 鼠标拖动实现移动滚动条的滚动效果

效果 现在很多场景都以移动端为基本开发&#xff0c;比如说需要隐藏滚动条&#xff0c;在pc上实现鼠标拖动和手机触摸拖动差不多的效果。 实现 以mdn的overflow属性中范例为基础&#xff0c;内容溢出时候可使用overflow: auto;和overflow: scroll;实现滚动效果。 要实现鼠标…

华为防火墙总部与分支机构建立IPsec VPN涉及NAT穿越

一、IPsec VPN基本概念 1、隧道建立方式&#xff1a;分为手动建立和IKE自动协商&#xff0c;手动建立需要人为配置指定所有IPsec建立的所有参数信息&#xff0c;不支持为动态地址的发起方&#xff0c;实际网络中很少应用&#xff1b;IKE协议是基于密钥管理协议ISAKMP框架设计而…

一文看懂AI的 Transformer 架构!

1 AI的转换器是啥&#xff1f; 转换器&#xff0c;一种将输入序列转换或更改为输出序列的神经网络架构。它们通过学习上下文和跟踪序列组件之间的关系来做到这一点。例如&#xff0c;请考虑以下输入序列&#xff1a;“天空是什么颜色的&#xff1f;” 转换器模型会使用内部数学…

C4D2024软件下载+自学C4D 从入门到精通【学习视频教程全集】+【素材笔记】

软件介绍与下载&#xff1a; 链接&#xff1a; 链接&#xff1a;https://pan.baidu.com/s/1n8cripcv6ZTx4TBNj5N04g?pwdhfg5 提取码&#xff1a;hfg5 基础命令的讲解&#xff1a; 掌握软件界面和基础操作界面。学习常用的基础命令&#xff0c;如建模、材质、灯光、摄像机…

TypeScript体操(一):从基础到进阶

目录 前言Utility Types 是什么&#xff1f;常用 Utility Types前置知识typeofkeyoftypeof 和 keyof 的区别never 关键字extends 关键字结合条件判断infer 类型推断&#xff08;模式匹配&#xff09;判断是与非判断两个类型是否相等或兼容 循环递归嵌套字符串数组协变&#xff…

NMEA2000在船舶控制系统中航空插头插座组件特性

NMEA2000在船舶控制系统中的应用概述 NMEA2000协议是船舶电子设备之间通信的国际标准&#xff0c;广泛应用于船舶导航、监控和自动化系统。它基于CAN&#xff08;Controller Area Network&#xff09;总线技术&#xff0c;以确保在恶劣环境下的可靠性和效率。NMEA2000协议定义了…

英语语法第八课副词

文章目录 1、副词分类1.1 时间副词&#xff0c;表示时间或频率1.2 地点副词&#xff0c;表示地点或位置1.3 方式副词&#xff0c;表示行为方式1.4 程度副词&#xff0c;表示动作程度1.5 疑问副词&#xff0c;引导特殊疑问句1.6 强调副词&#xff0c;强调形容词或动词1.7 连接副…

隐语隐私计算实训营「联邦学习」第 5 课:基于隐私保护的机器学习算法介绍

【隐私计算实训营】是蚂蚁集团隐语开源社区出品的线上课程&#xff0c;自实训营上线以来&#xff0c;获得行业内外广泛关注&#xff0c;吸引上千余名开发者报名参与。本次暑期夏令营课程中&#xff0c;除了最新上线的「联邦学习系列」&#xff0c;还包含了「隐私保护数据分析」…

Java项目实战springboot校园失物招领系统

✌网站介绍&#xff1a;✌10年项目辅导经验、专注于计算机技术领域学生项目实战辅导。 ✌服务范围&#xff1a;Java(SpringBoo/SSM)、Python、PHP、Nodejs、爬虫、数据可视化、小程序、安卓app、大数据等设计与开发。 ✌服务内容&#xff1a;免费功能设计、免费提供开题答辩P…

3D建模软件--犀牛Rhino for Mac

Mac分享吧 文章目录 效果一、下载软件二、开始安装1、双击运行软件&#xff0c;将其从左侧拖入右侧文件夹中&#xff0c;等待安装完毕2、应用程序显示软件图标&#xff0c;表示安装成功 三、运行测试安装完成&#xff01;&#xff01;&#xff01; 效果 一、下载软件 下载软件…

初学Mybatis之配置解析

MyBatis 中文网配置教程 mybatis-config.xml 环境配置&#xff08;environments&#xff09; 尽管可以配置多个环境&#xff0c;但每个 SqlSessionFactory 实例只能选择一种环境 可以有多个 enviroment&#xff0c;但是 enviroments default&#xff08;默认&#xff09;只…

动态规划题目:单词拆分/三角形最小路径和 - leetcode

动态规划思想 / 步骤 &#xff1a; 先将 当前要求 总结成一个 精炼的 小问题 &#xff0c; 然后 将 求解题目 转换为 求解N个 小问题 &#xff0c; 每个小问题的 求解过程相同 &#xff0c;但是 过程涉及 的 数据 是不同的 &#xff0c; 例如第三个 小问…

c++网络编程实战——开发基于ftp协议的文件传输模块(二) 配置ftp服务与手动执行ftp命令

配置FTP服务 一.前言 博主的环境是阿里云服务器&#xff0c;操作系统版本为 ubuntu20.04,一下所有操作都基于以上环境下进行的操作&#xff0c;同时为了简化操作我将开放同一个云服务器的不同端口&#xff0c;让它同时充当服务端和客户端&#xff0c;大家如果想测试效果更好且…

WPF串口通讯程序

目录 一 设计原型 二 后台源码 一 设计原型 二 后台源码 using HardwareCommunications; using System.IO.Ports; using System.Windows;namespace PortTest {/// <summary>/// Interaction logic for MainWindow.xaml/// </summary>public partial class MainW…