From 5459750274c040a519eb328d97f56c8c11b0df27 Mon Sep 17 00:00:00 2001 From: Xiang Dai <764524258@qq.com> Date: Mon, 23 Sep 2019 14:54:46 +0800 Subject: [PATCH 01/11] update ksonnect doc for Tanka Signed-off-by: Xiang Dai <764524258@qq.com> --- production/ksonnet/README.md | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/production/ksonnet/README.md b/production/ksonnet/README.md index be964c71956db..b1562515e76fa 100644 --- a/production/ksonnet/README.md +++ b/production/ksonnet/README.md @@ -17,6 +17,9 @@ In your config repo, if you don't yet have the directory structure of Tanka set $ mkdir config && cd config/ $ tk init $ tk env add loki --namespace=loki +# Ksonnet kubernetes libraries +$ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k.libsonnet +$ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k8s.libsonnet ``` ## Deploying Promtail to your cluster. @@ -27,7 +30,7 @@ Grab the promtail module using jb: $ jb install github.com/grafana/loki/production/ksonnet/promtail ``` -Replace the contents of `environments/loki/main.jsonnet` with: +Replace the contents of `environments/default/main.jsonnet` with: ```jsonnet local promtail = import 'promtail/promtail.libsonnet'; @@ -54,19 +57,29 @@ promtail + { ``` Notice that `container_root_path` is your own data root for docker daemon, use `docker info | grep "Root Dir"` to get it. -Then do `ks show loki` to see the manifests that'll be deployed to your cluster. -Apply them using `ks apply loki`. +As a last step, fill add the correct `spec.apiServer` and `spec.namespace` to `environments/default/spec.json`: + +{ + "apiVersion": "tanka.dev/v1alpha1", + "kind": "Environment", + "spec": { + "apiServer": "https://localhost:6443", + "namespace": "default" + } +} + +Now use `tk show environments/default` to see the yaml, and `tk apply environments/default` 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 +$ 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: +Replace the contents of `environments/default/main.jsonnet` with: ```jsonnet local gateway = import 'loki/gateway.libsonnet'; @@ -93,5 +106,5 @@ loki + promtail + gateway { ``` 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. +Use `tk show environments/default` to see the manifests being deployed to the cluster. +Finally `tk apply environments/default` will deploy the server components to your cluster. From 2b28491888a3aced4cb5bfe74b161f41f4a58305 Mon Sep 17 00:00:00 2001 From: Xiang Dai <764524258@qq.com> Date: Mon, 23 Sep 2019 17:49:35 +0800 Subject: [PATCH 02/11] init before install Signed-off-by: Xiang Dai <764524258@qq.com> --- production/ksonnet/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/production/ksonnet/README.md b/production/ksonnet/README.md index b1562515e76fa..15c6a99fae4b5 100644 --- a/production/ksonnet/README.md +++ b/production/ksonnet/README.md @@ -14,7 +14,7 @@ In your config repo, if you don't yet have the directory structure of Tanka set ```bash # create a directory (any name works) -$ mkdir config && cd config/ +$ mkdir promtail && cd promtail/ $ tk init $ tk env add loki --namespace=loki # Ksonnet kubernetes libraries @@ -75,6 +75,13 @@ Now use `tk show environments/default` to see the yaml, and `tk apply environmen If you want to further also deploy the server to the cluster, then run the following to install the module: ``` +# create a directory (any name works) +$ mkdir loki && cd loki/ +$ tk init +$ tk env add loki --namespace=loki +# Ksonnet kubernetes libraries +$ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k.libsonnet +$ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k8s.libsonnet $ jb install github.com/grafana/loki/production/ksonnet/loki ``` From 8c38a5ef1b88819af898ef7829f572350e013711 Mon Sep 17 00:00:00 2001 From: Xiang Dai <764524258@qq.com> Date: Mon, 23 Sep 2019 17:52:53 +0800 Subject: [PATCH 03/11] add update spec Signed-off-by: Xiang Dai <764524258@qq.com> --- production/ksonnet/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/production/ksonnet/README.md b/production/ksonnet/README.md index 15c6a99fae4b5..8fdb1f932e4a8 100644 --- a/production/ksonnet/README.md +++ b/production/ksonnet/README.md @@ -113,5 +113,16 @@ loki + promtail + gateway { ``` Notice that `container_root_path` is your own data root for docker daemon, use `docker info | grep "Root Dir"` to get it. +As a last step, fill add the correct `spec.apiServer` and `spec.namespace` to `environments/default/spec.json`: + +{ + "apiVersion": "tanka.dev/v1alpha1", + "kind": "Environment", + "spec": { + "apiServer": "https://localhost:6443", + "namespace": "default" + } +} + Use `tk show environments/default` to see the manifests being deployed to the cluster. Finally `tk apply environments/default` will deploy the server components to your cluster. From b36d373ae5b43fca98bcd4f6c3887d53e781cc6c Mon Sep 17 00:00:00 2001 From: Xiang Dai <764524258@qq.com> Date: Mon, 23 Sep 2019 18:27:35 +0800 Subject: [PATCH 04/11] update env Signed-off-by: Xiang Dai <764524258@qq.com> --- production/ksonnet/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production/ksonnet/README.md b/production/ksonnet/README.md index 8fdb1f932e4a8..9ab65952b5e65 100644 --- a/production/ksonnet/README.md +++ b/production/ksonnet/README.md @@ -16,7 +16,7 @@ In your config repo, if you don't yet have the directory structure of Tanka set # create a directory (any name works) $ mkdir promtail && cd promtail/ $ tk init -$ tk env add loki --namespace=loki +$ tk env add promtail --namespace=loki # Ksonnet kubernetes libraries $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k.libsonnet $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k8s.libsonnet From b513d5ba4b1643e46f0986a1f3475a1398054e31 Mon Sep 17 00:00:00 2001 From: Xiang Dai <764524258@qq.com> Date: Tue, 24 Sep 2019 10:22:35 +0800 Subject: [PATCH 05/11] review feedback Signed-off-by: Xiang Dai <764524258@qq.com> --- production/ksonnet/README.md | 46 +++++++----------------------------- 1 file changed, 9 insertions(+), 37 deletions(-) diff --git a/production/ksonnet/README.md b/production/ksonnet/README.md index 9ab65952b5e65..4f319232cb1db 100644 --- a/production/ksonnet/README.md +++ b/production/ksonnet/README.md @@ -14,9 +14,11 @@ In your config repo, if you don't yet have the directory structure of Tanka set ```bash # create a directory (any name works) -$ mkdir promtail && cd promtail/ +$ mkdir config && cd config/ $ tk init -$ tk env add promtail --namespace=loki +$ tk env add loki --namespace=loki +# notice that k8s_master_node_ip could not be localhost or 0.0.0.0 +$ tk set environments/loki --server=https://$(k8s_master_node_ip):6443 # Ksonnet kubernetes libraries $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k.libsonnet $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k8s.libsonnet @@ -30,11 +32,10 @@ Grab the promtail module using jb: $ jb install github.com/grafana/loki/production/ksonnet/promtail ``` -Replace the contents of `environments/default/main.jsonnet` with: +Replace the contents of `environments/loki/main.jsonnet` with: ```jsonnet local promtail = import 'promtail/promtail.libsonnet'; - promtail + { _config+:: { namespace: 'loki', @@ -57,36 +58,18 @@ promtail + { ``` Notice that `container_root_path` is your own data root for docker daemon, use `docker info | grep "Root Dir"` to get it. -As a last step, fill add the correct `spec.apiServer` and `spec.namespace` to `environments/default/spec.json`: - -{ - "apiVersion": "tanka.dev/v1alpha1", - "kind": "Environment", - "spec": { - "apiServer": "https://localhost:6443", - "namespace": "default" - } -} - -Now use `tk show environments/default` to see the yaml, and `tk apply environments/default` to apply it to the cluster. +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: ``` -# create a directory (any name works) -$ mkdir loki && cd loki/ -$ tk init -$ tk env add loki --namespace=loki -# Ksonnet kubernetes libraries -$ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k.libsonnet -$ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k8s.libsonnet $ 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/default/main.jsonnet` with: +Replace the contents of `environments/loki/main.jsonnet` with: ```jsonnet local gateway = import 'loki/gateway.libsonnet'; @@ -113,16 +96,5 @@ loki + promtail + gateway { ``` Notice that `container_root_path` is your own data root for docker daemon, use `docker info | grep "Root Dir"` to get it. -As a last step, fill add the correct `spec.apiServer` and `spec.namespace` to `environments/default/spec.json`: - -{ - "apiVersion": "tanka.dev/v1alpha1", - "kind": "Environment", - "spec": { - "apiServer": "https://localhost:6443", - "namespace": "default" - } -} - -Use `tk show environments/default` to see the manifests being deployed to the cluster. -Finally `tk apply environments/default` will deploy the server components to your cluster. +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. From 3673cd1016369a908a6f986cdfaf182ba3e8c678 Mon Sep 17 00:00:00 2001 From: Xiang Dai <764524258@qq.com> Date: Tue, 24 Sep 2019 15:54:27 +0800 Subject: [PATCH 06/11] add missing cmd Signed-off-by: Xiang Dai <764524258@qq.com> --- production/ksonnet/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production/ksonnet/README.md b/production/ksonnet/README.md index 4f319232cb1db..2e210cfcce47e 100644 --- a/production/ksonnet/README.md +++ b/production/ksonnet/README.md @@ -18,7 +18,7 @@ $ mkdir config && cd config/ $ tk init $ tk env add loki --namespace=loki # notice that k8s_master_node_ip could not be localhost or 0.0.0.0 -$ tk set environments/loki --server=https://$(k8s_master_node_ip):6443 +$ tk env set environments/loki --server=https://$(k8s_master_node_ip):6443 # Ksonnet kubernetes libraries $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k.libsonnet $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k8s.libsonnet From 74cdc6a97d74f67a83adf73fb25d8fb326ee421a Mon Sep 17 00:00:00 2001 From: Xiang Dai <764524258@qq.com> Date: Tue, 24 Sep 2019 18:35:38 +0800 Subject: [PATCH 07/11] update env path Signed-off-by: Xiang Dai <764524258@qq.com> --- production/ksonnet/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/production/ksonnet/README.md b/production/ksonnet/README.md index 2e210cfcce47e..ea3c212c5144a 100644 --- a/production/ksonnet/README.md +++ b/production/ksonnet/README.md @@ -18,7 +18,7 @@ $ mkdir config && cd config/ $ tk init $ tk env add loki --namespace=loki # notice that k8s_master_node_ip could not be localhost or 0.0.0.0 -$ tk env set environments/loki --server=https://$(k8s_master_node_ip):6443 +$ tk env set loki --server=https://$(k8s_master_node_ip):6443 # Ksonnet kubernetes libraries $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k.libsonnet $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k8s.libsonnet @@ -32,7 +32,7 @@ Grab the promtail module using jb: $ jb install github.com/grafana/loki/production/ksonnet/promtail ``` -Replace the contents of `environments/loki/main.jsonnet` with: +Replace the contents of `loki/main.jsonnet` with: ```jsonnet local promtail = import 'promtail/promtail.libsonnet'; @@ -67,9 +67,8 @@ If you want to further also deploy the server to the cluster, then run the follo ``` $ 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: +Replace the contents of `loki/main.jsonnet` with: ```jsonnet local gateway = import 'loki/gateway.libsonnet'; From 6212147208dfdede0d68a26fe02bf1a90b7da159 Mon Sep 17 00:00:00 2001 From: Xiang Dai <764524258@qq.com> Date: Tue, 24 Sep 2019 18:37:22 +0800 Subject: [PATCH 08/11] remove ip adress note Signed-off-by: Xiang Dai <764524258@qq.com> --- production/ksonnet/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/production/ksonnet/README.md b/production/ksonnet/README.md index ea3c212c5144a..029b4ebfffd49 100644 --- a/production/ksonnet/README.md +++ b/production/ksonnet/README.md @@ -17,8 +17,7 @@ In your config repo, if you don't yet have the directory structure of Tanka set $ mkdir config && cd config/ $ tk init $ tk env add loki --namespace=loki -# notice that k8s_master_node_ip could not be localhost or 0.0.0.0 -$ tk env set loki --server=https://$(k8s_master_node_ip):6443 +$ tk env set loki --server=https://$k8s_master_node_ip:6443 # Ksonnet kubernetes libraries $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k.libsonnet $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k8s.libsonnet From 91bd7a571f3d3d40d9846577068ad99bb0398e05 Mon Sep 17 00:00:00 2001 From: Xiang Dai <764524258@qq.com> Date: Tue, 24 Sep 2019 18:57:31 +0800 Subject: [PATCH 09/11] review feedback Signed-off-by: Xiang Dai <764524258@qq.com> --- production/ksonnet/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/production/ksonnet/README.md b/production/ksonnet/README.md index 029b4ebfffd49..9724260fb3373 100644 --- a/production/ksonnet/README.md +++ b/production/ksonnet/README.md @@ -16,8 +16,8 @@ In your config repo, if you don't yet have the directory structure of Tanka set # create a directory (any name works) $ mkdir config && cd config/ $ tk init -$ tk env add loki --namespace=loki -$ tk env set loki --server=https://$k8s_master_node_ip:6443 +$ tk env add environments/loki --namespace=loki +$ tk env set environments/loki --server=https://$k8s_master_node_ip:6443 # Ksonnet kubernetes libraries $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k.libsonnet $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k8s.libsonnet @@ -67,7 +67,7 @@ If you want to further also deploy the server to the cluster, then run the follo $ 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 `loki/main.jsonnet` with: +Replace the contents of `environments/loki/main.jsonnet` with: ```jsonnet local gateway = import 'loki/gateway.libsonnet'; From 4c9282654aba0b12c83d63f78c414e7cc0e36d0b Mon Sep 17 00:00:00 2001 From: Xiang Dai <764524258@qq.com> Date: Tue, 24 Sep 2019 19:18:23 +0800 Subject: [PATCH 10/11] update val name Signed-off-by: Xiang Dai <764524258@qq.com> --- production/ksonnet/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production/ksonnet/README.md b/production/ksonnet/README.md index 9724260fb3373..109ead2e3ba03 100644 --- a/production/ksonnet/README.md +++ b/production/ksonnet/README.md @@ -17,7 +17,7 @@ In your config repo, if you don't yet have the directory structure of Tanka set $ mkdir config && cd config/ $ tk init $ tk env add environments/loki --namespace=loki -$ tk env set environments/loki --server=https://$k8s_master_node_ip:6443 +$ tk env set environments/loki --server=https://${K8S_MASTER_ADDRESS}:6443 # Ksonnet kubernetes libraries $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k.libsonnet $ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k8s.libsonnet From fd1cc0b09e06d95c24dbb67abf53df6a9073b9e7 Mon Sep 17 00:00:00 2001 From: Xiang Dai <764524258@qq.com> Date: Tue, 24 Sep 2019 19:23:24 +0800 Subject: [PATCH 11/11] update Signed-off-by: Xiang Dai <764524258@qq.com> --- production/ksonnet/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production/ksonnet/README.md b/production/ksonnet/README.md index 109ead2e3ba03..245994bc307f8 100644 --- a/production/ksonnet/README.md +++ b/production/ksonnet/README.md @@ -31,7 +31,7 @@ Grab the promtail module using jb: $ jb install github.com/grafana/loki/production/ksonnet/promtail ``` -Replace the contents of `loki/main.jsonnet` with: +Replace the contents of `environments/loki/main.jsonnet` with: ```jsonnet local promtail = import 'promtail/promtail.libsonnet';