标签:body explore code class syn plugin 初始化 解析 测试
通过heml去部署Loki,要先安装heml:
|
1
2
3
4
5
6
7
8
|
wget https://get.helm.sh/helm-v2.16.9-linux-amd64.tar.gz tar -xf helm-v2.16.9-linux-amd64.tar.gz -C /usr/local/mv linux-amd64/ helmcat > /etc/profile.d/helm.sh <<EOFexport PATH=$PATH:/usr/local/helmEOFsource /etc/profile.d/helm.sh |
为tiller赋予权限:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
cat > helm-rbac.yaml <<EOFapiVersion: v1kind: ServiceAccountmetadata: name: tiller namespace: kube-system---apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata: name: tillerroleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-adminsubjects: - kind: ServiceAccount name: tiller namespace: kube-systemEOFkubectl apply -f helm-rbac.yaml |
初始化tiller:
|
1
|
helm init --service-account tiller |
查看版本:
|
1
2
3
|
$ helm versionClient: &version.Version{SemVer:"v2.16.9", GitCommit:"8ad7037828e5a0fca1009dabe290130da6368e39", GitTreeState:"clean"}Server: &version.Version{SemVer:"v2.16.3", GitCommit:"1ee0254c86d4ed6887327dabed7aa7da29d7eb0d", GitTreeState:"clean"} |
安装Loki:
先测试heml源:
|
1
|
helm search |
添加Loki源:
|
1
|
helm repo add loki https://grafana.github.io/loki/charts |
查找Loki:
|
1
2
3
4
5
6
|
$ helm search lokiNAME CHART VERSION APP VERSION DESCRIPTION loki/loki 0.30.1 v1.5.0 Loki: like Prometheus, but for logs. loki/loki-stack 0.38.1 v1.5.0 Loki: like Prometheus, but for logs. loki/fluent-bit 0.1.4 v1.5.0 Uses fluent-bit Loki go plugin for gathering logs and sen...loki/promtail 0.23.2 v1.5.0 Responsible for gathering logs and sending them to Loki |
安装:选择 loki/loki-stack 这个包,安装了就全都有了包括Loki和promtail
|
1
|
helm upgrade --install loki loki/loki-stack --namespace monitoring |
在grafana中添加数据源:
Configuration->Data Source:选择Loki后在URL中填写k8s的dns解析地址或NodePort方式都可以。
|
1
|
http://loki:3100 |
在左侧栏Explore中可查询日志等操作。

完
标签:body explore code class syn plugin 初始化 解析 测试
原文地址:https://www.cnblogs.com/ccielife/p/13382897.html