diff --git a/docs/sources/installation/tanka.md b/docs/sources/installation/tanka.md index 9b76ce163515..e44687a02b0e 100644 --- a/docs/sources/installation/tanka.md +++ b/docs/sources/installation/tanka.md @@ -30,10 +30,16 @@ Download and install the Loki and Promtail module using `jb`: ```bash go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb +jb init jb install github.com/grafana/loki/production/ksonnet/loki jb install github.com/grafana/loki/production/ksonnet/promtail ``` +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. + +```jsonnet +(import 'github.com/jsonnet-libs/k8s-alpha/1.14/main.libsonnet') ++ (import 'github.com/jsonnet-libs/k8s-alpha/1.14/extensions/kausal-shim.libsonnet') Be sure to replace the username, password and the relevant `htpasswd` contents. Making sure to set the value for username, password, and `htpasswd` properly, replace the contents of `environments/loki/main.jsonnet` with: diff --git a/production/ksonnet/README.md b/production/ksonnet/README.md index 42676164b73a..58ef106c95f1 100644 --- a/production/ksonnet/README.md +++ b/production/ksonnet/README.md @@ -1,95 +1,3 @@ # Deploy Loki to Kubernetes -## Prerequisites - -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. - -```bash -# Verify it works -$ tk --version -tk version v0.6.1 -``` - -In your config repo, if you don't yet have a Tanka project set up: - -```bash -# create a directory (any name works) -$ mkdir config && cd config/ -$ tk init -$ tk env add environments/loki --namespace=loki -$ tk env set environments/loki --server=https://${K8S_MASTER_ADDRESS}:6443 -``` - -## Deploying Promtail to your cluster. - -Grab the `promtail` module using jb: - -``` -$ jb install github.com/grafana/loki/production/ksonnet/promtail -``` - -Replace the contents of `environments/loki/main.jsonnet` with: -```jsonnet -local promtail = import 'promtail/promtail.libsonnet'; - -promtail + { - _config+:: { - namespace: 'loki', - - promtail_config+: { - clients: [ - { - scheme:: 'https', - hostname:: 'logs-us-west1.grafana.net', - username:: 'user-id', - password:: 'password', - external_labels: {}, - } - ], - container_root_path: '/var/lib/docker', - }, - }, -} - -``` -Notice that `container_root_path` is your own data root for docker daemon, use `docker info | grep "Root Dir"` to get it. - -Now use `tk show environments/loki` to see the yaml, and `tk apply environments/loki` to apply it to the cluster. - -## Deploying Loki to your cluster. - -If you want to further also deploy the server to the cluster, then run the following to install the module: - -``` -$ jb install github.com/grafana/loki/production/ksonnet/loki -``` -Be sure to replace the username, password and the relevant htpasswd contents. -Replace the contents of `environments/loki/main.jsonnet` with: - -```jsonnet -local gateway = import 'loki/gateway.libsonnet'; -local loki = import 'loki/loki.libsonnet'; -local promtail = import 'promtail/promtail.libsonnet'; - -loki + promtail + gateway { - _config+:: { - namespace: 'loki', - htpasswd_contents: 'loki:$apr1$H4yGiGNg$ssl5/NymaGFRUvxIV1Nyr.', - - - promtail_config: { - scheme: 'http', - hostname: 'gateway.%(namespace)s.svc' % $._config, - username: 'loki', - password: 'password', - container_root_path: '/var/lib/docker', - }, - replication_factor: 3, - consul_replicas: 1, - }, -} -``` -Notice that `container_root_path` is your own data root for docker daemon, use `docker info | grep "Root Dir"` to get it. - -Use `tk show environments/loki` to see the manifests being deployed to the cluster. -Finally `tk apply environments/loki` will deploy the server components to your cluster. +See the [Tanka Installation Docs](../../docs/sources/installation/tanka.md) diff --git a/production/ksonnet/loki/jsonnetfile.json b/production/ksonnet/loki/jsonnetfile.json index c46c23f64def..3fe98aafb67d 100644 --- a/production/ksonnet/loki/jsonnetfile.json +++ b/production/ksonnet/loki/jsonnetfile.json @@ -36,6 +36,15 @@ } }, "version": "master" + }, + { + "source": { + "git": { + "remote": "https://github.com/jsonnet-libs/k8s-alpha.git", + "subdir": "1.14" + } + }, + "version": "master" } ], "legacyImports": true diff --git a/production/ksonnet/loki/jsonnetfile.lock.json b/production/ksonnet/loki/jsonnetfile.lock.json new file mode 100644 index 000000000000..bb662923b0f8 --- /dev/null +++ b/production/ksonnet/loki/jsonnetfile.lock.json @@ -0,0 +1,56 @@ +{ + "version": 1, + "dependencies": [ + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "consul" + } + }, + "version": "8629e32d04a0eefdce41224540f0d31de7d40deb", + "sum": "whodWjF2UjlDT6rDiBsxbT+71UGD2J7IKiVxJETrXCA=" + }, + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "jaeger-agent-mixin" + } + }, + "version": "8629e32d04a0eefdce41224540f0d31de7d40deb", + "sum": "DsdBoqgx5kE3zc6fMYnfiGjW2+9Mx2OXFieWm1oFHgY=" + }, + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "ksonnet-util" + } + }, + "version": "8629e32d04a0eefdce41224540f0d31de7d40deb", + "sum": "TGgjbv8oGfmMNjfvcgxi2cX9RAJKGZnYGLEhzK2wNjM=" + }, + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "memcached" + } + }, + "version": "8629e32d04a0eefdce41224540f0d31de7d40deb", + "sum": "AIspZ151p0qkxVc9tuoAEYNrkazV6QncWWsIsarK9GE=" + }, + { + "source": { + "git": { + "remote": "https://github.com/jsonnet-libs/k8s-alpha.git", + "subdir": "1.14" + } + }, + "version": "4423ca26d1762943b9975fd4f5cc229e814fe8b6", + "sum": "00qOXX9Ddf0r2AR3NX7d9A/9MFaAesdGxCs6sXUobok=" + } + ], + "legacyImports": false +}