配置Grafana用于prometheus

网友投稿 240 2022-11-10

配置Grafana用于prometheus

安装Grafana$ docker pull grafana/grafana:5.3.41、准备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 grafanagrafana-bbfd776d6-w9xf7 1/1 Running 1 111mgrafana-chown-26wmr 0/1 Completed 0 111m$ kubectl logs grafana-bbfd776d6-w9xf7 -n kube-ops4、创建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 grafanagrafana NodePort 10.107.208.176 3000:31171/TCP

未完待续

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:嵌入式微处理器ARM7202触摸屏接口设计
下一篇:Centos7深入了解文件系统与日志文件(三)日志文件
相关文章

 发表评论

暂时没有评论,来抢沙发吧~