亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

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

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

配置Grafana用于prometheus

發布時間:2020-07-23 16:29:44 來源:網絡 閱讀:573 作者:dongyali521521 欄目:云計算

安裝Grafana
$ docker pull grafana/grafana:5.3.4
1、準備pvc

apiVersion: v1
kind: PersistentVolume
metadata:
  name: grafana
spec:
  capacity:
    storage: 1Gi
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  nfs:
    server: 192.168.1.244
    path: /data/k8s
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: grafana
  namespace: kube-ops
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

2、修改/var/lib/grafana目錄的權限

apiVersion: batch/v1
kind: Job
metadata:
  name: grafana-chown
  namespace: kube-ops
spec:
  template:
    spec:
      restartPolicy: Never
      containers:
      - name: grafana-chown
        command: ["chown", "-R", "472:472", "/var/lib/grafana"]
        image: busybox
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - name: storage
          subPath: grafana
          mountPath: /var/lib/grafana
      volumes:
      - name: storage
        persistentVolumeClaim:
          claimName: grafana

3、創建grafana pod

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: grafana
  namespace: kube-ops
  labels:
    app: grafana
spec:
  revisionHistoryLimit: 10
  template:
    metadata:
      labels:
        app: grafana
    spec:
      containers:
      - name: grafana
        image: grafana/grafana:5.3.4
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 3000
          name: grafana
        env:
        - name: GF_SECURITY_ADMIN_USER
          value: admin         #登錄用戶名
        - name: GF_SECURITY_ADMIN_PASSWORD
          value: admin321        #登錄密碼
        readinessProbe:
          failureThreshold: 10
          httpGet:
            path: /api/health
            port: 3000
            scheme: HTTP
          initialDelaySeconds: 60
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 30
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /api/health
            port: 3000
            scheme: HTTP
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        resources:
          limits:
            cpu: 100m
            memory: 256Mi
          requests:
            cpu: 100m
            memory: 256Mi
        volumeMounts:
        - mountPath: /var/lib/grafana
          subPath: grafana
          name: storage
      securityContext:
        fsGroup: 472
        runAsUser: 472
      volumes:
      - name: storage
        persistentVolumeClaim:
          claimName: grafana

$ kubectl get pod -n kube-ops |grep grafana
grafana-bbfd776d6-w9xf7 1/1 Running 1 111m
grafana-chown-26wmr 0/1 Completed 0 111m
$ kubectl logs grafana-bbfd776d6-w9xf7 -n kube-ops
4、創建svc

apiVersion: v1
kind: Service
metadata:
  name: grafana
  namespace: kube-ops
  labels:
    app: grafana
spec:
  type: NodePort
  ports:
    - port: 3000
  selector:
    app: grafana

$ kubectl get svc -n kube-ops |grep grafana
grafana NodePort 10.107.208.176 <none> 3000:31171/TCP

使用grafana
1、基本配置
http://192.168.1.243:31171
使用grafana pod環境變量中設置的用戶名和密碼登錄
點擊Add data source進入添加數據源界面----數據源名字----數據源類型: Prometheus----url:http://prometheus:9090 ----訪問模式:server
訪問模式是用來控制如何處理對數據源的請求的,分兩種
服務器(Server)訪問模式(默認)
瀏覽器(Browser)訪問模式
導入dashboard:點擊左側加號----import----Grafana.com Dashboard:輸入162
導入配置好的dashboard:點擊左側加號----import----upload .json file----選擇本地文件mydashboard.json
2、安裝k8s插件grafana-kubernetes-app
要安裝這個插件,需要到 grafana 的 Pod 里面去執行安裝命令
$ kubectl get pods -n kube-ops |grep grafana
grafana-bbfd776d6-w9xf7 1/1 Running 1
$ kubectl exec -it grafana-bbfd776d6-w9xf7 bash
grafana-kubernetes-app6d6-w9xf7:/usr/share/grafana$ grafana-cli plugins install grafana-kubernetes-app
$ kubectl delete -f grafana-deploy.yaml
$ kubectl apply -f grafana-deploy.yaml
重新打開garfana
http://192.168.1.243:31171
點擊Installed Apps下面的----kubernetes----enable----點擊鏈接Connect to your Kubernetes Cluster and deploy metric exporters,進入kubernetes / Cluster Config配置界面

未完待續

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

陇南市| 宝应县| 温泉县| 灵宝市| 丰台区| 新疆| 嘉祥县| 秀山| 兴安县| 东丽区| 长垣县| 轮台县| 慈溪市| 织金县| 彩票| 黄浦区| 竹溪县| 城固县| 南开区| 开化县| 宜兴市| 辉南县| 黔西| 库车县| 湟源县| 平凉市| 乐亭县| 漾濞| 大理市| 吉木乃县| 习水县| 于都县| 白玉县| 平阴县| 平谷区| 内江市| 浦东新区| 屏南县| 贡山| 沅陵县| 碌曲县|