github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/applications/loki-stack-fluentbit/README.md (about)

     1  # Overview
     2  
     3  ## Introduction of components
     4  
     5  Loki is a horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by [Prometheus](https://prometheus.io/). It is designed to be very cost effective and easy to operate. It does not index the contents of the logs, but rather a set of labels for each log stream.
     6  
     7  Fluent Bit is a fast Log Processor and Forwarder for Linux, Windows, Embedded Linux, MacOS and BSD family operating systems. It's part of the Graduated Fluentd Ecosystem and a CNCF sub-project.
     8  
     9  This image base on  longhorn:latest, flunent-bit can collect logs and longhorn provide storage to save logs in persistent volume.
    10  
    11  The fluentbit-loki-stack component include:
    12  
    13  * 1 DaemonSet for fluent-bit.
    14  * 1 DaemonSet for node-exporter.
    15  * 1 StatefulSet replica for loki server which requests "50Gi" storage.
    16  * 1 Deployment replica for grafana.
    17  * 1 Deployment replica for kube-state-metrics.
    18  * 1 Deployment replica for alertmanager.
    19  * 1 Deployment replica for pushgateway.
    20  * 1 Deployment replica for prometheus-server.
    21  
    22  ## How to use it
    23  
    24  ### Browser the dashboard
    25  
    26  * You can browser it in cluster.
    27  
    28    1. Run ``kubectl get svc -n fluentbit-loki-stack-system | grep grafana`` To get pod IP address.
    29  
    30    ```
    31       # kubectl get svc -n fluentbit-loki-stack-system | grep grafana
    32       fluentbit-loki-stack-grafana                    ClusterIP   10.96.1.50    <none>        80/TCP     37s
    33    ```
    34  
    35    2. you can easily browser the dashboard in you cluster network.
    36  
    37  * You can forward the container port to NodePort.
    38  
    39    1. Run this command ``kubectl port-forward -n fluentbit-loki-stack-system svc/loki-grafana 3000:80``
    40    2. Then you can browser the dashboard from outside of cluster network.
    41  
    42  ### Get the user-name and password
    43  
    44  * you should be required to input username and password when you access to the dashboard.
    45  
    46  * you can get the  username with these command.
    47  
    48    ```
    49    kubectl get secret -n fluentbit-loki-stack-system fluentbit-loki-stack-grafana -o jsonpath="{.data.admin-user}" | base64 --decode ; echo
    50    kubectl get secret -n fluentbit-loki-stack-system fluentbit-loki-stack-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
    51    ```
    52  
    53  ## How to rebuild it use helm
    54  
    55  Kubefile:
    56  
    57  ```
    58  FROM longhorn:latest
    59  
    60  CMD helm repo add grafana https://grafana.github.io/helm-charts
    61  CMD helm repo update
    62  
    63  CMD helm install fluentbit-loki-stack grafana/loki-stack \
    64   	--create-namespace --namespace fluentbit-loki-stack-system \
    65  	--set fluent-bit.enabled=true \
    66  	--set promtail.enabled=false \
    67  	--set grafana.enabled=true \
    68  	--set prometheus.enabled=true \
    69  	--set prometheus.alertmanager.persistentVolume.enabled=false \
    70  	--set prometheus.server.persistentVolume.enabled=false \
    71  	--set loki.persistence.enabled=true \
    72  	--set loki.persistence.storageClassName=longhorn \
    73  	--set loki.persistence.size=50Gi
    74  ```
    75  
    76  run below command to build it
    77  
    78  ```
    79  sealer build -t {Your Image Name} -f Kubefile -m cloud .
    80  ```
    81  
    82  More parameters see [official document here](https://longhorn.io/docs/1.2.3/).