-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Create "Configuring your Cluster" docs subsection #25442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e28c30e
Create "Configuring your Cluster" docs subsection
ptgott f6faeb7
Linter fixes
ptgott 7cbdd88
Frame the guide around dynamic resources
ptgott 0d56a8a
Respond to stevenGravy feedback
ptgott 9e68617
Create a diagram
ptgott 0c45201
Partially respond to PR feedback
ptgott 6caf763
Add a `ui_config` section
ptgott File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,277 @@ | ||
| --- | ||
| title: Using Dynamic Configuration Resources | ||
| description: An introduction to Teleport's dynamic configuration resources, which make it possible to apply settings to remote clusters using infrastructure as code. | ||
| tocDepth: 3 | ||
| --- | ||
|
|
||
| This section includes guides for managing Teleport's dynamic configuration | ||
| resources, which make it possible to adjust the behavior of your Teleport | ||
| cluster as your infrastructure changes. | ||
|
|
||
| ## What is a dynamic configuration resource? | ||
|
|
||
| There are two ways to configure a Teleport cluster: | ||
|
|
||
| - **Static configuration file:** At startup, a Teleport process reads a | ||
| configuration file from the local filesystem (the default path is | ||
| `/etc/teleport.yaml`). Static configuration settings control aspects of a | ||
| cluster that are not expected to change frequently, like the ports that | ||
| services listen on. | ||
| - **Dynamic configuration resources:** Dynamic configuration resources control | ||
| aspects of your cluster that are likely to change over time, such as roles, | ||
| local users, and registered infrastructure resources. | ||
|
|
||
| This approach makes it possible to incrementally adjust your Teleport | ||
| configuration without restarting Teleport instances. | ||
|
|
||
| ```mermaid | ||
| flowchart TB | ||
| subgraph backend["Cluster state backend"] | ||
| direction LR | ||
| resources["Dynamic config resources"] | ||
| end | ||
|
|
||
| subgraph cluster[Teleport cluster] | ||
| subgraph auth[Auth Service] | ||
| conf1["Static config"] | ||
| end | ||
| subgraph proxy[Proxy Service] | ||
| conf2["Static config"] | ||
| end | ||
| end | ||
|
|
||
| auth--"Reads, writes"-->backend | ||
| subgraph clients["API clients"] | ||
| terraform["Terraform Provider"] | ||
| operator["Kubernetes Operator"] | ||
| tctl | ||
| end | ||
| terraform & operator & tctl-- "API calls" -->proxy | ||
| proxy-.->auth | ||
| ``` | ||
|
|
||
| A cluster is composed of different objects (i.e., resources) and there are three | ||
| common operations that can be performed on them: `get` , `create` , and `remove` | ||
| . | ||
|
|
||
| Every resource in Teleport has three required fields: | ||
|
|
||
| - `kind`: The type of resource | ||
| - `name`: A required field in the `metadata` to uniquely identify the resource | ||
| - `version`: The version of the resource format | ||
|
|
||
| All other fields are specific to a resource. | ||
|
|
||
| While Teleport Enterprise Cloud and Teleport Team do not expose the static | ||
| configuration file to operators, they do use a static configuration file for | ||
| certain settings. Read how Teleport [reconciles static and dynamic | ||
| resources](#reconciling-the-configuration-file-with-dynamic-resources) to | ||
| understand how to see the values of static configuration settings that also | ||
| appear in dynamic configuration resources. | ||
|
|
||
| When examining a dynamic configuration resource, note that some of the fields | ||
| you will see are used only internally and are not meant to be changed. Others | ||
| are reserved for future use. | ||
|
|
||
| ## Managing dynamic configuration resources | ||
|
|
||
| Teleport provides three methods for applying dynamic configuration resources: | ||
| the `tctl` client tool, Teleport Terraform provider, and Kubernetes Operator. | ||
|
|
||
| All three methods connect to the Teleport Auth Service's gRPC endpoint in order | ||
| to manipulate cluster configuration resources stored on the Auth Service | ||
| backend. The design of Teleport's configuration interface makes it well suited | ||
| for infrastructure-as-code and GitOps approaches. | ||
|
|
||
| ### YAML documents with `tctl` | ||
|
|
||
| You can define configuration resources as YAML documents and apply them using | ||
| the `tctl` client tool. Here is an example of a `role` resource that allows | ||
| access to servers with the label `env:test`: | ||
|
|
||
| ```yaml | ||
| kind: role | ||
| version: v6 | ||
| metadata: | ||
| name: developer | ||
| spec: | ||
| allow: | ||
| logins: ['ubuntu', 'debian', '{{internal.logins}}'] | ||
| node_labels: | ||
| 'env': 'test' | ||
| ``` | ||
|
|
||
| Since `tctl` works from the local filesystem, you can write commands that apply | ||
| all configuration documents in a directory tree. See the [CLI | ||
| reference](../reference/cli.mdx#tctl) for more information on `tctl`. | ||
|
|
||
| ### Teleport Terraform provider | ||
|
|
||
| Teleport's Terraform provider lets you manage your Teleport configuration | ||
| resources within the same infrastructure-as-code source as the rest of your | ||
| infrastructure. There is a Terraform resource for each Teleport configuration | ||
| resource. For example: | ||
|
|
||
| ```text | ||
| resource "teleport_role" "developer" { | ||
| metadata = { | ||
| name = "developer" | ||
| } | ||
|
|
||
| spec = { | ||
| allow = { | ||
| logins = ["ubuntu", "debian", "{{internal.logins}}"] | ||
|
|
||
| node_labels = { | ||
| key = ["env"] | ||
| value = ["test"] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| [Get started with the Terraform provider](./dynamic-configuration/terraform-provider.mdx). | ||
|
|
||
| ### Teleport Kubernetes Operator | ||
|
|
||
| The Teleport Kubernetes Operator lets you apply Teleport configuration resources | ||
| as Kubernetes resources so you can manage your Teleport settings alongside the | ||
| rest of your Kubernetes infrastructure. Here is an example of a `TeleportRole` | ||
| resource, which is equivalent to the two roles shown above: | ||
|
|
||
| ```yaml | ||
|
|
||
| apiVersion: resources.teleport.dev/v5 | ||
| kind: TeleportRole | ||
| metadata: | ||
| name: developer | ||
| spec: | ||
| allow: | ||
| logins: ['ubuntu', 'debian', '{{internal.logins}}'] | ||
| node_labels: | ||
| 'env': 'test' | ||
| ``` | ||
|
|
||
| [Get started with the Kubernetes Operator](dynamic-configuration/teleport-operator.mdx). | ||
|
|
||
| ## Reconciling the configuration file with dynamic resources | ||
|
|
||
| Some dynamic configuration resources assign the same settings as fields within | ||
| Teleport's static configuration file. For these fields, the Teleport Auth | ||
| Service reconciles static and dynamic configurations on startup and when you | ||
| create or remove a configuration resource. | ||
|
|
||
| ### Configuration resources that apply to static configuration fields | ||
|
|
||
| There are three dynamic configuration resources that share fields with the | ||
| static configuration file: | ||
|
|
||
| - `session_recording_config` | ||
| - `cluster_auth_preference` | ||
| - `cluster_networking_config` | ||
|
ptgott marked this conversation as resolved.
|
||
|
|
||
| #### `session_recording_config` | ||
|
|
||
| |Dynamic resource field|Static configuration field| | ||
| |---|---| | ||
| |`spec.mode`|`auth_service.session_recording`| | ||
| |`spec.proxy_checks_host_keys`|`auth_service.proxy_checks_host_keys`| | ||
|
|
||
| #### `cluster_auth_preference` | ||
|
|
||
| |Dynamic resource field|Static configuration field| | ||
| |---|---| | ||
| |`spec.type`|`auth_service.authentication.type`| | ||
| |`spec.second_factor`|`auth_service.authentication.second_factor`| | ||
| |`spec.connector_name`|`auth_service.authentication.connector_name` | ||
| |`spec.u2f`|`auth_service.authentication.u2f`| | ||
| |<nobr>`spec.disconnect_expired_cert`</nobr>|`auth_service.disconnect_expired_cert`| | ||
| |`spec.allow_local_auth`|`auth_service.authentication.local_auth`| | ||
| |`spec.message_of_the_day`|`auth_service.message_of_the_day`| | ||
| |`spec.locking_mode`|`auth_service.authentication.locking_mode`| | ||
| |`spec.webauthn`|`auth_service.authentication.webauthn`| | ||
| |`spec.require_session_mfa`|<nobr>`auth_service.authentication.require_session_mfa`</nobr>| | ||
| |`spec.allow_passwordless`|`auth_service.authentication.passwordless`| | ||
| |`spec.device_trust`|`auth_service.authentication.device_trust`| | ||
| |`spec.idp`|`proxy_service.idp`| | ||
| |`spec.allow_headless`|`auth_service.authentication.headless`| | ||
|
|
||
| #### `cluster_networking_config` | ||
|
|
||
| |Dynamic resource field|Static configuration field| | ||
| |---|---| | ||
| |`spec.client_idle_timeout`|`auth_service.client_idle_timeout`| | ||
| |`spec.keep_alive_interval`|`auth_service.keep_alive_interval`| | ||
| |`spec.keep_alive_count_max`|`auth_service.keep_alive_count_max`| | ||
| |`spec.session_control_timeout`|`auth_service.session_control_timeout`| | ||
| |`spec.idle_timeout_message`|`auth_service.client_idle_timeout_message`| | ||
| |`spec.web_idle_timeout`|`auth_service.web_idle_timeout`| | ||
| |`spec.proxy_listener_mode`|`auth_service.proxy_listener_mode`| | ||
| |`spec.routing_strategy`|`auth_service.routing_strategy`| | ||
| |`spec.tunnel_strategy`|`auth_service.tunnel_strategy`| | ||
| |`spec.proxy_ping_interval`|`auth_service.proxy_ping_interval`| | ||
|
|
||
| #### `ui_config` | ||
|
|
||
| |Dynamic resource field|Static configuration field| | ||
| |---|---| | ||
| |`spec.scrollback_lines`|`proxy_service.ui.scrollback_lines`| | ||
|
|
||
| ### Origin labels | ||
|
|
||
| The Teleport Auth Service applies the `teleport.dev/origin` label to | ||
| configuration resources to indicate whether they originated from the static | ||
| configuration file, a dynamic configuration resource, or the default value. | ||
|
|
||
| Here are possible values of the `teleport.dev/origin` label: | ||
|
|
||
| - `defaults` | ||
| - `config-file` | ||
| - `dynamic` | ||
|
|
||
| When the Auth Service starts up, it looks up the values of static configuration | ||
| fields that correspond to fields in dynamic configuration resources. If any of | ||
| these have values, it creates the corresponding dynamic configuration resources | ||
| and stores them in its backend. | ||
|
|
||
| For any static configuration fields without a value, the Auth Service checks | ||
| whether the backend contains the corresponding dynamic configuration resource. | ||
| If not, it creates one with default values and the | ||
| `teleport.dev/origin=defaults` label. | ||
|
|
||
| If you attempt to create a dynamic configuration resource after the Auth Service | ||
| has already loaded the configuration from a static configuration file, the Auth | ||
| Service will return an error. | ||
|
|
||
| If you remove a dynamic configuration resource, the Auth Service will restore | ||
| its configuration fields to the default values and add the | ||
| `teleport.dev/origin=defaults` label. | ||
|
|
||
| <Notice type="tip"> | ||
|
|
||
| Cloud-hosted Teleport deployments use configuration files, but these are not | ||
| available for operators to modify. Users of Teleport Enterprise Cloud and | ||
| Teleport Team may see configuration resources with the | ||
| `teleport.dev/origin=config-file` label. | ||
|
|
||
| </Notice> | ||
|
|
||
| ## Further reading | ||
|
|
||
| ### Configuration references | ||
|
|
||
| - For a comprehensive reference of Teleport's static configuration options, read | ||
| the [Configuration Reference](../reference/config.mdx). | ||
| - To see the dynamic configuration resources available to apply, read the | ||
| [Configuration Resource Reference](../reference/resources.mdx). There are also | ||
| dedicated configuration resource references for | ||
| [applications](../application-access/reference.mdx#application-resource) and | ||
| [databases](../database-access/reference/configuration.mdx#database-resource). | ||
|
|
||
| ### Other ways to use the Teleport API | ||
|
|
||
| The Teleport Kubernetes Operator, Terraform provider, and `tctl` are all clients | ||
| of the Teleport Auth Service's gRPC API. To build your own API client to extend | ||
| Teleport for your organization's needs, read our [API | ||
| guides](../api/introduction.mdx). | ||
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.