乐趣区

关于helm:helm部署安装grafana-及-配置测试

add repo

helm repo add stable http://mirror.azure.cn/kubernetes/charts

helm repo update
helm repo list
[root@vm2 ~]# helm repo list
NAME                    URL                                                   
stable                  http://mirror.azure.cn/kubernetes/charts              
aliyun                  https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
prometheus-community    https://prometheus-community.github.io/helm-charts    
ingress-nginx           https://kubernetes.github.io/ingress-nginx            
bitnami                 https://charts.bitnami.com/bitnami 

install grafana

helm install stable/grafana --generate-name -n monitor
ization.k8s.io/v1 RoleBinding
NAME: grafana-xxxxxx8
LAST DEPLOYED: Mon Jun 19 11:05:01 2023
NAMESPACE: monitor
STATUS: deployed
REVISION: 1
NOTES:
*******************
****DEPRECATED*****
*******************
* The chart is deprecated. Future development has been moved to https://github.com/grafana/helm2-grafana

1. Get your 'admin' user password by running:

   kubectl get secret --namespace monitor grafana-16xxx8 -o jsonpath="{.data.admin-password}" | base64 --decode ; echo

2. The Grafana server can be accessed via port 80 on the following DNS name from within your cluster:

   grafana-1687143898.monitor.svc.cluster.local

   Get the Grafana URL to visit by running these commands in the same shell:

     export POD_NAME=$(kubectl get pods --namespace monitor -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=grafana-xxxxxxxx8" -o jsonpath="{.items[0].metadata.name}")
     kubectl --namespace monitor port-forward $POD_NAME 3000

3. 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.                            #####
#################################################################################

ingress yaml

cat grafana-server-ingress.yaml 
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: grafana-server
  namespace: monitor
spec:
  rules:
  - host: grafana.test.com
    http:
      paths:
      - path: /
        backend:
          serviceName: grafana-1xxxxxx8
          servicePort: 80
kubectl get secret --namespace monitor grafana-168xxxxx98 -o jsonpath="{.data.admin-password}" | base64 --decode ; echo

获取 web 页面 admin 明码

add Prometheus datasource

查看 Prometheus 的 svc 名字

退出移动版