github.com/qsunny/k8s@v0.0.0-20220101153623-e6dca256d5bf/heapster-1.3.0/docs/influxdb.md (about)

     1  # Run Heapster in a Kubernetes cluster with an InfluxDB backend and a Grafana UI
     2  
     3  ### Setup a Kubernetes cluster
     4  [Bring up a Kubernetes cluster](https://github.com/kubernetes/kubernetes), if you haven't already.
     5  Ensure that you are able to interact with the cluster via `kubectl` (this may be `kubectl.sh` if using
     6  the local-up-cluster in the Kubernetes repository).
     7  
     8  ### Start all of the pods and services
     9  
    10  In order to deploy Heapster and InfluxDB, you will need to create the Kubernetes resources
    11  described by the contents of [deploy/kube-config/influxdb](../deploy/kube-config/influxdb).
    12  
    13  If you're running a different architecture than amd64, you should correct the image architecture 
    14  for the `grafana-deployment.yaml` and the `influxdb-deployment.yaml`.
    15  
    16  Ensure that you have a valid checkout of Heapster and are in the root directory of
    17  the Heapster repository, and then run
    18  
    19  ```shell
    20  $ kubectl create -f deploy/kube-config/influxdb/
    21  ```
    22  
    23  Grafana service by default requests for a LoadBalancer. If that is not available in your cluster, consider changing that to NodePort. Use the external IP assigned to the Grafana service,
    24  to access Grafana.
    25  The default user name and password is 'admin'.
    26  Once you login to Grafana, add a datasource that is InfluxDB. The URL for InfluxDB will be `http://localhost:8086`. Database name is 'k8s'. Default user name and password is 'root'.
    27  Grafana documentation for InfluxDB [here](http://docs.grafana.org/datasources/influxdb/).
    28  
    29  Take a look at the [storage schema](storage-schema.md) to understand how metrics are stored in InfluxDB.
    30  
    31  Grafana is set up to auto-populate nodes and pods using templates.
    32  
    33  The Grafana web interface can also be accessed via the api-server proxy. The URL should be visible in `kubectl cluster-info` once the above resources are created.
    34  
    35  ## Troubleshooting guide
    36  
    37  See also the [debugging documentation](debugging.md).
    38  
    39  1. If the Grafana service is not accessible, it might not be running. Use `kubectl` to verify that the `heapster` and `influxdb & grafana` pods are alive.
    40      ```
    41      $ kubectl get pods --namespace=kube-system
    42      ...
    43      monitoring-grafana-927606581-0tmdx        1/1       Running   0          6d
    44      monitoring-influxdb-3276295126-joqo2      1/1       Running   0          15d
    45      ...
    46      
    47      $ kubectl get services --namespace=kube-system monitoring-grafana monitoring-influxdb
    48      ```
    49  
    50  1. If you find InfluxDB to be using up a lot of CPU or memory, consider placing resource restrictions on the `InfluxDB & Grafana` pod. You can add `cpu: <millicores>` and `memory: <bytes>` in the [Controller Spec](../deploy/kube-config/influxdb/influxdb-grafana-controller.yaml) and relaunch the controllers by running `kubectl apply -f deploy/kube-config/influxdb/influxdb-grafana-controller.yaml` and deleting and old influxdb pods.