In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Install Grafana
$docker pull grafana/grafana:5.3.4
1. Prepare pvc
ApiVersion: v1kind: PersistentVolumemetadata: name: grafanaspec: capacity: storage: 1Gi accessModes:-ReadWriteOnce persistentVolumeReclaimPolicy: Recycle nfs: server: 192.168.1.244 path: / data/k8s---apiVersion: v1kind: PersistentVolumeClaimmetadata: name: grafana namespace: kube-opsspec: accessModes:-ReadWriteOnce resources: requests: storage: 1Gi
2. Modify the permissions of the / var/lib/grafana directory
ApiVersion: batch/v1kind: Jobmetadata: name: grafana-chown namespace: kube-opsspec: template: spec: restartPolicy: Never containers:-name: grafana-chown command: ["chown", "- R", "472" "/ var/lib/grafana"] image: busybox imagePullPolicy: IfNotPresent volumeMounts:-name: storage subPath: grafana mountPath: / var/lib/grafana volumes:-name: storage persistentVolumeClaim: claimName: grafana
3. Create grafana pod
ApiVersion: extensions/v1beta1kind: Deploymentmetadata: name: grafana namespace: kube-ops labels: app: grafanaspec: revisionHistoryLimit: 10 template: metadata: labels: app: grafanaspec: containers:-name: grafana image: grafana/grafana:5.3.4 imagePullPolicy: IfNotPresent ports:-containerPort: 3000 name: grafana env:-name: GF_SECURITY_ADMIN_ USER value: admin # login user name-name: GF_SECURITY_ADMIN_PASSWORD value: admin321 # login password 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: 472runAsUser: 472volumes:-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. Create svc
ApiVersion: v1kind: Servicemetadata: name: grafana namespace: kube-ops labels: app: grafanaspec: type: NodePort ports:-port: 3000 selector: app: grafana
$kubectl get svc-n kube-ops | grep grafana
Grafana NodePort 10.107.208.176 3000:31171/TCP
Use grafana
1. Basic configuration
Http://192.168.1.243:31171
Log in with the username and password set in the grafana pod environment variable
Click Add data source to enter the add data source interface-data source name-data source type: Prometheus----url: http://prometheus:9090-access mode: server
Access patterns are used to control how requests to data sources are handled. There are two types of access patterns.
Server (Server) access mode (default)
Browser (Browser) access mode
Import dashboard: click the plus sign on the left-import----Grafana.com Dashboard: enter 162,
Import the configured dashboard: click the plus sign on the left-import----upload .json file---- to select the local file mydashboard.json
2. Install the k8s plug-in grafana-kubernetes-app
To install this plug-in, you need to execute the installation command in the Pod of grafana
$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
Reopen garfana
Http://192.168.1.243:31171
Click the link Connect to your Kubernetes Cluster and deploy metric exporters under Installed Apps-kubernetes----enable---- to enter the kubernetes / Cluster Config configuration interface
to be continued
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.