溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

k8s實(shí)踐18:helm部署安裝grafana配置測(cè)試

發(fā)布時(shí)間:2020-07-30 09:46:44 來(lái)源:網(wǎng)絡(luò) 閱讀:1288 作者:am2012 欄目:系統(tǒng)運(yùn)維
grafana部署配置測(cè)試

grafana官網(wǎng)地址

1.helm部署grafana

部署很簡(jiǎn)單,見(jiàn)下

[root@k8s-node1 prometheus-grafana]# helm install stable/grafana --generate-name
NAME: grafana-1577432108
LAST DEPLOYED: Fri Dec 27 15:35:11 2019
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get your 'admin' user password by running:

   kubectl get secret --namespace default grafana-1577432108 -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-1577432108.default.svc.cluster.local

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

     export POD_NAME=$(kubectl get pods --namespace default -l "app=grafana,release=grafana-1577432108" -o jsonpath="{.items[0].metadata.name}")
     kubectl --namespace default 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.                            #####
#################################################################################

注意這條:

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

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

服務(wù)起來(lái)了

[root@k8s-node1 ~]# kubectl get svc,pod |grep grafana

service/grafana-1577432108                         ClusterIP   10.254.172.86    <none>        80/TCP          132m
pod/grafana-1577432108-65b987fdc6-dlhpb                         1/1     Running   1          132m

2.配置web訪問(wèn)

配置Ingress文件,讀取執(zhí)行,然后做host解析即可通過(guò)grafana-server訪問(wèn)web.

[root@k8s-node1 prometheus-grafana]# cat grafana-server-ingress.yaml 
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: grafana-server
  namespace: default
spec:
  rules:
  - host: grafana-server
    http:
      paths:
      - path: /
        backend:
          serviceName: grafana-1577432108
          servicePort: 80

k8s實(shí)踐18:helm部署安裝grafana配置測(cè)試

3.登錄

看前面第1部的注意,登錄密碼通過(guò)那個(gè)提示來(lái)獲取.

[root@k8s-node1 prometheus-grafana]# kubectl get secret --namespace default grafana-1577432108 -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
sLJq2G4tBSiJcEHSobRoRiDRbCNXxT5qASQJkzF6

用戶名是:admin
密碼是:sLJq2G4tBSiJcEHSobRoRiDRbCNXxT5qASQJkzF6

登錄成功,圖示見(jiàn)下:

k8s實(shí)踐18:helm部署安裝grafana配置測(cè)試

4.添加數(shù)據(jù)源

添加prometheus源

k8s實(shí)踐18:helm部署安裝grafana配置測(cè)試

http url是prometheus service的地址

[root@k8s-node1 prometheus-grafana]# kubectl get svc |grep server
prometheus-1577263826-server               ClusterIP   10.254.132.104   <none>        80/TCP          47h

保存配置.再點(diǎn)擊dashboard.

k8s實(shí)踐18:helm部署安裝grafana配置測(cè)試

再import,就可以看到圖形界面了

k8s實(shí)踐18:helm部署安裝grafana配置測(cè)試

5.選一個(gè)自己喜歡的想用的個(gè)性參數(shù)更多的界面

去grafana網(wǎng)站下載模板json文件導(dǎo)入即可.

監(jiān)控節(jié)點(diǎn)模板

k8s實(shí)踐18:helm部署安裝grafana配置測(cè)試

監(jiān)控pod容器模板1

k8s實(shí)踐18:helm部署安裝grafana配置測(cè)試

k8s實(shí)踐18:helm部署安裝grafana配置測(cè)試

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI