Skip to content

Commit 6e3e2fa

Browse files
owen-dEd Welch
and
Ed Welch
authored
Ksonnet docs (#2503)
* adds jsonnet-libs/k8s-alpha, redirects tanka install docs * removes vendor dir from loki ksonnet * docs for non-GA tanka requirement * Update docs/sources/installation/tanka.md Co-authored-by: Ed Welch <[email protected]> Co-authored-by: Ed Welch <[email protected]>
1 parent 3486889 commit 6e3e2fa

File tree

4 files changed

+72
-93
lines changed

4 files changed

+72
-93
lines changed

docs/sources/installation/tanka.md

+6
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ Download and install the Loki and Promtail module using `jb`:
3030

3131
```bash
3232
go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
33+
jb init
3334
jb install github.com/grafana/loki/production/ksonnet/loki
3435
jb install github.com/grafana/loki/production/ksonnet/promtail
3536
```
3637

38+
Note: As of 2020-08-13 we use some as of yet non GA features, please override the `lib/k.libsonnet` with the following. This step will likely not be necessary in future tanka releases.
39+
40+
```jsonnet
41+
(import 'github.com/jsonnet-libs/k8s-alpha/1.14/main.libsonnet')
42+
+ (import 'github.com/jsonnet-libs/k8s-alpha/1.14/extensions/kausal-shim.libsonnet')
3743
Be sure to replace the username, password and the relevant `htpasswd` contents.
3844
Making sure to set the value for username, password, and `htpasswd` properly,
3945
replace the contents of `environments/loki/main.jsonnet` with:

production/ksonnet/README.md

+1-93
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,3 @@
11
# Deploy Loki to Kubernetes
22

3-
## Prerequisites
4-
5-
Make sure you have a recent version of [Tanka](https://github.com/grafana/tanka). Follow their [install instructions](https://tanka.dev/install) to do so. Make sure to install [jsonnet-bundler](https://github.com/jsonnet-bundler/jsonnet-bundler) as well.
6-
7-
```bash
8-
# Verify it works
9-
$ tk --version
10-
tk version v0.6.1
11-
```
12-
13-
In your config repo, if you don't yet have a Tanka project set up:
14-
15-
```bash
16-
# create a directory (any name works)
17-
$ mkdir config && cd config/
18-
$ tk init
19-
$ tk env add environments/loki --namespace=loki
20-
$ tk env set environments/loki --server=https://${K8S_MASTER_ADDRESS}:6443
21-
```
22-
23-
## Deploying Promtail to your cluster.
24-
25-
Grab the `promtail` module using jb:
26-
27-
```
28-
$ jb install github.com/grafana/loki/production/ksonnet/promtail
29-
```
30-
31-
Replace the contents of `environments/loki/main.jsonnet` with:
32-
```jsonnet
33-
local promtail = import 'promtail/promtail.libsonnet';
34-
35-
promtail + {
36-
_config+:: {
37-
namespace: 'loki',
38-
39-
promtail_config+: {
40-
clients: [
41-
{
42-
scheme:: 'https',
43-
hostname:: 'logs-us-west1.grafana.net',
44-
username:: 'user-id',
45-
password:: 'password',
46-
external_labels: {},
47-
}
48-
],
49-
container_root_path: '/var/lib/docker',
50-
},
51-
},
52-
}
53-
54-
```
55-
Notice that `container_root_path` is your own data root for docker daemon, use `docker info | grep "Root Dir"` to get it.
56-
57-
Now use `tk show environments/loki` to see the yaml, and `tk apply environments/loki` to apply it to the cluster.
58-
59-
## Deploying Loki to your cluster.
60-
61-
If you want to further also deploy the server to the cluster, then run the following to install the module:
62-
63-
```
64-
$ jb install github.com/grafana/loki/production/ksonnet/loki
65-
```
66-
Be sure to replace the username, password and the relevant htpasswd contents.
67-
Replace the contents of `environments/loki/main.jsonnet` with:
68-
69-
```jsonnet
70-
local gateway = import 'loki/gateway.libsonnet';
71-
local loki = import 'loki/loki.libsonnet';
72-
local promtail = import 'promtail/promtail.libsonnet';
73-
74-
loki + promtail + gateway {
75-
_config+:: {
76-
namespace: 'loki',
77-
htpasswd_contents: 'loki:$apr1$H4yGiGNg$ssl5/NymaGFRUvxIV1Nyr.',
78-
79-
80-
promtail_config: {
81-
scheme: 'http',
82-
hostname: 'gateway.%(namespace)s.svc' % $._config,
83-
username: 'loki',
84-
password: 'password',
85-
container_root_path: '/var/lib/docker',
86-
},
87-
replication_factor: 3,
88-
consul_replicas: 1,
89-
},
90-
}
91-
```
92-
Notice that `container_root_path` is your own data root for docker daemon, use `docker info | grep "Root Dir"` to get it.
93-
94-
Use `tk show environments/loki` to see the manifests being deployed to the cluster.
95-
Finally `tk apply environments/loki` will deploy the server components to your cluster.
3+
See the [Tanka Installation Docs](../../docs/sources/installation/tanka.md)

production/ksonnet/loki/jsonnetfile.json

+9
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@
3636
}
3737
},
3838
"version": "master"
39+
},
40+
{
41+
"source": {
42+
"git": {
43+
"remote": "https://github.com/jsonnet-libs/k8s-alpha.git",
44+
"subdir": "1.14"
45+
}
46+
},
47+
"version": "master"
3948
}
4049
],
4150
"legacyImports": true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"version": 1,
3+
"dependencies": [
4+
{
5+
"source": {
6+
"git": {
7+
"remote": "https://github.com/grafana/jsonnet-libs.git",
8+
"subdir": "consul"
9+
}
10+
},
11+
"version": "8629e32d04a0eefdce41224540f0d31de7d40deb",
12+
"sum": "whodWjF2UjlDT6rDiBsxbT+71UGD2J7IKiVxJETrXCA="
13+
},
14+
{
15+
"source": {
16+
"git": {
17+
"remote": "https://github.com/grafana/jsonnet-libs.git",
18+
"subdir": "jaeger-agent-mixin"
19+
}
20+
},
21+
"version": "8629e32d04a0eefdce41224540f0d31de7d40deb",
22+
"sum": "DsdBoqgx5kE3zc6fMYnfiGjW2+9Mx2OXFieWm1oFHgY="
23+
},
24+
{
25+
"source": {
26+
"git": {
27+
"remote": "https://github.com/grafana/jsonnet-libs.git",
28+
"subdir": "ksonnet-util"
29+
}
30+
},
31+
"version": "8629e32d04a0eefdce41224540f0d31de7d40deb",
32+
"sum": "TGgjbv8oGfmMNjfvcgxi2cX9RAJKGZnYGLEhzK2wNjM="
33+
},
34+
{
35+
"source": {
36+
"git": {
37+
"remote": "https://github.com/grafana/jsonnet-libs.git",
38+
"subdir": "memcached"
39+
}
40+
},
41+
"version": "8629e32d04a0eefdce41224540f0d31de7d40deb",
42+
"sum": "AIspZ151p0qkxVc9tuoAEYNrkazV6QncWWsIsarK9GE="
43+
},
44+
{
45+
"source": {
46+
"git": {
47+
"remote": "https://github.com/jsonnet-libs/k8s-alpha.git",
48+
"subdir": "1.14"
49+
}
50+
},
51+
"version": "4423ca26d1762943b9975fd4f5cc229e814fe8b6",
52+
"sum": "00qOXX9Ddf0r2AR3NX7d9A/9MFaAesdGxCs6sXUobok="
53+
}
54+
],
55+
"legacyImports": false
56+
}

0 commit comments

Comments
 (0)