diff --git a/advanced/grids.md b/advanced/grids.md index 9db420a..642635c 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 Node Configuration -Outputs currently used Kontena Platform Grid environment variables that can be used to configure Kontena CLI. +Generate the [`/etc/kontena-agent.env` 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/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 diff --git a/using-kontena/nodes.md b/using-kontena/nodes.md index cb41bbe..afa0758 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 Configuration + +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 +KONTENA_URI=ws://192.168.66.1:9292/ +KONTENA_NODE_TOKEN=yempbjWHbZLhc66gB0mAFXKS8HzS/daDwCfnHC+UfrJo5wkhQ6hpr8XKY5nUdH+h6CH81Y9bQIc4IgTcEEjQCQ== +``` + +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 ``` @@ -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 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. diff --git a/using-kontena/platform.md b/using-kontena/platform.md index aa4e7f8..b14b006 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 Node Configuration -Outputs currently used Kontena Platform Grid environment variables that can be used to configure Kontena CLI. +Generate the [`/etc/kontena-agent.env` 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