From 6489f1b6249325aba8e3776c8cfb9fd7cb20fd29 Mon Sep 17 00:00:00 2001 From: Tero Marttila Date: Thu, 31 Aug 2017 11:31:32 +0300 Subject: [PATCH 1/7] doc node token agent envs --- references/environment-variables.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/references/environment-variables.md b/references/environment-variables.md index ae74812..465f479 100644 --- a/references/environment-variables.md +++ b/references/environment-variables.md @@ -21,8 +21,11 @@ ## Kontena Agent -- `KONTENA_URI`: Kontena Master websocket uri (required) -- `KONTENA_TOKEN`: Kontena Grid token (required) +The `KONTENA_URI` and either of `KONTENA_TOKEN` or `KONTENA_NODE_TOKEN` is required. + +- `KONTENA_URI`: Kontena Master websocket uri, `ws://...` or `wss://...` (required) +- `KONTENA_TOKEN`: Kontena [Grid token](../using-kontena/nodes.md#grid-token) +- `KONTENA_NODE_TOKEN`: Kontena [Node token](../using-kontena/nodes.md#node-token) - `KONTENA_PEER_INTERFACE`: network interface for peer/private communication (default: eth1) - `KONTENA_PUBLIC_IP`: specify node public ip, overrides default resolving - `KONTENA_PRIVATE_IP`: specify node private ip, overrides default resolving From ee8b863d88efc5f546d94691cdd740f65e08671c Mon Sep 17 00:00:00 2001 From: Tero Marttila Date: Thu, 31 Aug 2017 12:15:33 +0300 Subject: [PATCH 2/7] fix grid env docs --- advanced/grids.md | 6 ++++-- using-kontena/platform.md | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/advanced/grids.md b/advanced/grids.md index 9db420a..36e8724 100755 --- a/advanced/grids.md +++ b/advanced/grids.md @@ -98,12 +98,14 @@ Show audit logs. $ kontena grid audit-log ``` -## Show Kontena Platform Grid Environment Details +#### Show Kontena Platform Grid Agent Configuration -Outputs currently used Kontena Platform Grid environment variables that can be used to configure Kontena CLI. +Generate the [`/etc/kontena-agent` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using grid tokens: ``` $ kontena grid env +KONTENA_URI=ws://192.168.66.1:9292/ +KONTENA_TOKEN=yempbjWHbZLhc66gB0mAFXKS8HzS/daDwCfnHC+UfrJo5wkhQ6hpr8XKY5nUdH+h6CH81Y9bQIc4IgTcEEjQCQ== ``` ## Show Kontena Platform Grid Cloud-Config diff --git a/using-kontena/platform.md b/using-kontena/platform.md index aa4e7f8..e53709d 100644 --- a/using-kontena/platform.md +++ b/using-kontena/platform.md @@ -169,12 +169,14 @@ Show audit logs. $ kontena grid audit-log ``` -## Show Kontena Platform Grid Environment Details +#### Show Kontena Platform Grid Agent Configuration -Outputs currently used Kontena Platform Grid environment variables that can be used to configure Kontena CLI. +Generate the [`/etc/kontena-agent` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using grid tokens: ``` $ kontena grid env +KONTENA_URI=ws://192.168.66.1:9292/ +KONTENA_TOKEN=yempbjWHbZLhc66gB0mAFXKS8HzS/daDwCfnHC+UfrJo5wkhQ6hpr8XKY5nUdH+h6CH81Y9bQIc4IgTcEEjQCQ== ``` ## Show Kontena Platform Grid Cloud-Config From 98fe3e7182b2930fe61e2b46e94badce876b3b16 Mon Sep 17 00:00:00 2001 From: Tero Marttila Date: Thu, 31 Aug 2017 12:18:49 +0300 Subject: [PATCH 3/7] document new kontena node commands --- using-kontena/nodes.md | 48 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/using-kontena/nodes.md b/using-kontena/nodes.md index cb41bbe..b20084b 100644 --- a/using-kontena/nodes.md +++ b/using-kontena/nodes.md @@ -17,12 +17,29 @@ In this chapter, we'll discover how to manage, operate and monitor Kontena Nodes Please see the [Add Kontena Nodes](install-nodes/README.md) documentation to learn more. +## Create Kontena Nodes + +Create a new Kontena Node for manual provisioning: + +``` +$ kontena node create core-03 + [done] Creating core-03 node +``` + +The server will generate a random node token by default. Use `--token` to supply a pre-generated node token. + +The new node must be provisioned using the `kontena node env` configuration. + ## List Kontena Nodes The command that may be used for listing all Kontena Nodes in a Kontena Platform. ``` $ kontena node list +NAME VERSION STATUS INITIAL LABELS +⊛ core-01 1.4.0 online 1 / 1 provider=vagrant +⊛ core-02 1.4.0 online - provider=vagrant +⊝ core-03 1.4.0 offline - - ``` ## Show Kontena Node Information @@ -33,6 +50,18 @@ The command that may be used for inspecting Kontena Node information. $ kontena node show ``` +## Show Kontena Node Agent Configuration + +Generate the [`/etc/kontena-agent` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using node tokens: + +``` +$ kontena node env core-03 +KONTENA_URI=ws://192.168.66.1:9292/ +KONTENA_NODE_TOKEN=yempbjWHbZLhc66gB0mAFXKS8HzS/daDwCfnHC+UfrJo5wkhQ6hpr8XKY5nUdH+h6CH81Y9bQIc4IgTcEEjQCQ== +``` + +See [`kontena grid env`](./platform.md#show-kontena-platform-grid-agent-configuration) or [`kontena node reset-token`](#reset-a-kontena-node-token) if the node was not created using `kontena node create`. + ## Update Kontena Node Information ``` @@ -47,15 +76,30 @@ The command that may be used for connecting to Kontena Node via SSH. $ kontena node ssh ``` +## Reset a Kontena Node Token + +The `kontena node reset-token` command can be used to replace a compromised node token, upgrade a node that was originally provisioned using a grid token, or revert a node to using a grid token: + +``` +$ kontena node reset-token +``` + +Resetting the token of an online Kontena Node will force the agent to disconnect. The agent will not be able to reconnect until the the node is reconfigured using the new `kontena node env` values. + +The `kontena node reset-token` command can also be used to upgrade a node provisioned using a grid token. The node must be reconfigured using the new `kontena node env` configuration before it will be able to reconnect. The `kontena node reset-token --clear-token` command can be used to revert back to the grid token. + + ## Remove a Kontena Node -In order to remove a Kontena Node, it must be terminated first. Once terminated, it may be removed. Only `offline` Kontena Nodes may be removed. +The `kontena node remove` command can be used to remove a node that is being decomissioned: ``` $ kontena node remove ``` -If you are using the Kontena CLI built-in provision tool, you can terminate Kontena Node using the `kontena node terminate` command. Alternatively, power off / terminate the Kontena Node machine from any infrastructure you are using and wait for the machine to become offline before removing them. +If the node was provisioned using the Kontena CLI built-in provisioning tool, you can terminate the host machine using the `kontena node terminate` command. This will also remove the Kontena Node. If the host machine has already been terminated, then the `kontena node remove` command can be used to forget the terminated node. + +If the node was provisioned with a node token, then the `kontena node remove` command can also be used to invalidate the node token, forcing the agent to disconnect if it is still connected. Nodes provisioned using grid tokens cannot be removed if they are still online, because the agent will simply reconnect and the node will quickly re-appear. **IMPORTANT!** If you remove a Kontena Node that has `stateful` Kontena Service instances deployed, those Kontena Service instances will be re-scheduled for the next Kontena Service deploy and lose their state. From 7fdb03c145bd67d897be3676eba51fb121219462 Mon Sep 17 00:00:00 2001 From: Tero Marttila Date: Thu, 31 Aug 2017 17:02:48 +0300 Subject: [PATCH 4/7] fix heading levels --- advanced/grids.md | 2 +- using-kontena/platform.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/grids.md b/advanced/grids.md index 36e8724..fac39fc 100755 --- a/advanced/grids.md +++ b/advanced/grids.md @@ -98,7 +98,7 @@ Show audit logs. $ kontena grid audit-log ``` -#### Show Kontena Platform Grid Agent Configuration +## Show Kontena Platform Grid Agent Configuration Generate the [`/etc/kontena-agent` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using grid tokens: diff --git a/using-kontena/platform.md b/using-kontena/platform.md index e53709d..ac433e7 100644 --- a/using-kontena/platform.md +++ b/using-kontena/platform.md @@ -169,7 +169,7 @@ Show audit logs. $ kontena grid audit-log ``` -#### Show Kontena Platform Grid Agent Configuration +## Show Kontena Platform Grid Agent Configuration Generate the [`/etc/kontena-agent` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using grid tokens: From 771e8b8ba1b00fea6dcc82ec38ca8e52fa1469bd Mon Sep 17 00:00:00 2001 From: Tero Marttila Date: Thu, 31 Aug 2017 17:04:17 +0300 Subject: [PATCH 5/7] will -> would --- using-kontena/nodes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/using-kontena/nodes.md b/using-kontena/nodes.md index b20084b..c21429c 100644 --- a/using-kontena/nodes.md +++ b/using-kontena/nodes.md @@ -99,7 +99,7 @@ $ kontena node remove If the node was provisioned using the Kontena CLI built-in provisioning tool, you can terminate the host machine using the `kontena node terminate` command. This will also remove the Kontena Node. If the host machine has already been terminated, then the `kontena node remove` command can be used to forget the terminated node. -If the node was provisioned with a node token, then the `kontena node remove` command can also be used to invalidate the node token, forcing the agent to disconnect if it is still connected. Nodes provisioned using grid tokens cannot be removed if they are still online, because the agent will simply reconnect and the node will quickly re-appear. +If the node was provisioned with a node token, then the `kontena node remove` command can also be used to invalidate the node token, forcing the agent to disconnect if it is still connected. Nodes provisioned using grid tokens cannot be removed if they are still online, because the agent would simply reconnect and the node would quickly re-appear. **IMPORTANT!** If you remove a Kontena Node that has `stateful` Kontena Service instances deployed, those Kontena Service instances will be re-scheduled for the next Kontena Service deploy and lose their state. From 43446d513821399a719f02d777a481f22842d9d4 Mon Sep 17 00:00:00 2001 From: Tero Marttila Date: Fri, 1 Sep 2017 10:45:49 +0300 Subject: [PATCH 6/7] Show Kontena Node Configuration --- advanced/grids.md | 2 +- using-kontena/nodes.md | 4 ++-- using-kontena/platform.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/advanced/grids.md b/advanced/grids.md index fac39fc..628df55 100755 --- a/advanced/grids.md +++ b/advanced/grids.md @@ -98,7 +98,7 @@ Show audit logs. $ kontena grid audit-log ``` -## Show Kontena Platform Grid Agent Configuration +## Show Kontena Node Configuration Generate the [`/etc/kontena-agent` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using grid tokens: diff --git a/using-kontena/nodes.md b/using-kontena/nodes.md index c21429c..c0de5f5 100644 --- a/using-kontena/nodes.md +++ b/using-kontena/nodes.md @@ -50,7 +50,7 @@ The command that may be used for inspecting Kontena Node information. $ kontena node show ``` -## Show Kontena Node Agent Configuration +## Show Kontena Node Configuration Generate the [`/etc/kontena-agent` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using node tokens: @@ -60,7 +60,7 @@ KONTENA_URI=ws://192.168.66.1:9292/ KONTENA_NODE_TOKEN=yempbjWHbZLhc66gB0mAFXKS8HzS/daDwCfnHC+UfrJo5wkhQ6hpr8XKY5nUdH+h6CH81Y9bQIc4IgTcEEjQCQ== ``` -See [`kontena grid env`](./platform.md#show-kontena-platform-grid-agent-configuration) or [`kontena node reset-token`](#reset-a-kontena-node-token) if the node was not created using `kontena node create`. +See [`kontena grid env`](./platform.md#show-kontena-node-configuration) or [`kontena node reset-token`](#reset-a-kontena-node-token) if the node was not created using `kontena node create`. ## Update Kontena Node Information diff --git a/using-kontena/platform.md b/using-kontena/platform.md index ac433e7..b173f9c 100644 --- a/using-kontena/platform.md +++ b/using-kontena/platform.md @@ -169,7 +169,7 @@ Show audit logs. $ kontena grid audit-log ``` -## Show Kontena Platform Grid Agent Configuration +## Show Kontena Node Configuration Generate the [`/etc/kontena-agent` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using grid tokens: From fbe74dfd373e50e8165e47687a386cf0187a0f26 Mon Sep 17 00:00:00 2001 From: Tero Marttila Date: Fri, 1 Sep 2017 10:48:27 +0300 Subject: [PATCH 7/7] /etc/kontena-agent.env --- advanced/grids.md | 2 +- using-kontena/nodes.md | 2 +- using-kontena/platform.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/grids.md b/advanced/grids.md index 628df55..642635c 100755 --- a/advanced/grids.md +++ b/advanced/grids.md @@ -100,7 +100,7 @@ $ kontena grid audit-log ## Show Kontena Node Configuration -Generate the [`/etc/kontena-agent` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using grid tokens: +Generate the [`/etc/kontena-agent.env` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using grid tokens: ``` $ kontena grid env diff --git a/using-kontena/nodes.md b/using-kontena/nodes.md index c0de5f5..afa0758 100644 --- a/using-kontena/nodes.md +++ b/using-kontena/nodes.md @@ -52,7 +52,7 @@ $ kontena node show ## Show Kontena Node Configuration -Generate the [`/etc/kontena-agent` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using node tokens: +Generate the [`/etc/kontena-agent.env` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using node tokens: ``` $ kontena node env core-03 diff --git a/using-kontena/platform.md b/using-kontena/platform.md index b173f9c..b14b006 100644 --- a/using-kontena/platform.md +++ b/using-kontena/platform.md @@ -171,7 +171,7 @@ $ kontena grid audit-log ## Show Kontena Node Configuration -Generate the [`/etc/kontena-agent` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using grid tokens: +Generate the [`/etc/kontena-agent.env` environment variables](../references/environment-variables#kontena-agent) required when manually provisioning nodes using grid tokens: ``` $ kontena grid env