k8s实践18:helm部署安装grafana配置测试-创新互联
grafana部署配置测试
grafana官网地址
专注于为中小企业提供做网站、网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业四平免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了超过千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。1.helm部署grafana
部署很简单,见下
[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
服务起来了
[root@k8s-node1 ~]# kubectl get svc,pod |grep grafana
service/grafana-1577432108 ClusterIP 10.254.172.86 80/TCP 132m
pod/grafana-1577432108-65b987fdc6-dlhpb 1/1 Running 1 132m
2.配置web访问
配置Ingress文件,读取执行,然后做host解析即可通过grafana-server访问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
3.登录
看前面第1部的注意,登录密码通过那个提示来获取.
[root@k8s-node1 prometheus-grafana]# kubectl get secret --namespace default grafana-1577432108 -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
sLJq2G4tBSiJcEHSobRoRiDRbCNXxT5qASQJkzF6
用户名是:admin
密码是:sLJq2G4tBSiJcEHSobRoRiDRbCNXxT5qASQJkzF6登录成功,图示见下:
4.添加数据源
添加prometheus源
http url是prometheus service的地址
[root@k8s-node1 prometheus-grafana]# kubectl get svc |grep server
prometheus-1577263826-server ClusterIP 10.254.132.104 80/TCP 47h
保存配置.再点击dashboard.
再import,就可以看到图形界面了
5.选一个自己喜欢的想用的个性参数更多的界面
去grafana网站下载模板json文件导入即可.
监控节点模板
监控pod容器模板1
本文题目:k8s实践18:helm部署安装grafana配置测试-创新互联
文章出自:http://scjbc.cn/article/dgoiio.html