Files
Paul Gottschling e811e22549 Add page_type and outcome statements to 47 guides (#67771)
Continues the work from the previous batch (#67723).

We are standardizing docs guides to add a `page_type` frontmatter field,
with values for how-to guides, references, etc. We can then use this
field to apply linting rules that ensure each guide type follows
type-specific docs site conventions. The first convention is that each
docs page must have an outcome statement, the structure of which depends
on the guide's type. Human and AI agent readers can determine from the
outcome statement whether to continue reading the guide or not.

This change assigns the `page_type` frontmatter field to 47 guides in
the enroll-resources section of the docs. Where an outcome statement is
missing or incorrect, this change adds or corrects it.

Of the 47 guides:
- 14 guides were landing pages that needed only `page_type: landing`
  (landing pages do not have outcome statements).
- 11 guides already included the expected outcome statement, but needed
  a `page_type` frontmatter field.
- 17 guides had no outcome statement at all.
- 5 guides included outcome statements but required minor tweaks so
  they followed the expected structure.
2026-06-18 14:34:51 +00:00

147 lines
3.7 KiB
Plaintext

---
title: Dynamic Database Registration
sidebar_label: Dynamic Registration
description: Register/unregister databases without restarting Teleport.
tags:
- conceptual
- zero-trust
- infrastructure-identity
page_type: conceptual
---
Dynamic database registration allows Teleport administrators to register new
databases (or update/unregister existing ones) without having to update the
static configuration and restart Teleport Database Service instances.
This page describes the Teleport configuration options that allow you to enable
and customize dynamic database registration.
Dynamic registration also enables administrators to deploy multiple Database
Service instances for [high availability](../../../installation/agents/high-availability.mdx) by
configuring Database Service replicas to watch for the same database resources.
To enable dynamic registration, include a `resources` section in your Teleport
Database Service configuration with a list of resource label selectors you'd like this
service to monitor for registering:
```yaml
db_service:
enabled: true
resources:
- labels:
"*": "*"
```
You can use a wildcard selector to register all dynamic database resources in the cluster
on the Database Service or provide a specific set of labels for a subset:
```yaml
resources:
- labels:
"env": "prod"
"engine": "postgres"
- labels:
"env": "test"
"engine": "mysql"
```
To see the currently running Database Services, run `tctl get db_services`:
```yaml
kind: db_service
metadata:
expires: "2024-08-27T11:38:10.207175Z"
name: 2b5207e3-a258-423e-a41d-e50ea2f0dfdc
spec:
hostname: my-host
resources:
- labels:
env: prod
engine: postgres
- labels:
env: test
engine: mysql
version: v1
```
The `name` within a `db_service` matches to the host ID of the agent running the Teleport Database Service.
Next define a database resource:
```yaml
kind: db
version: v3
metadata:
name: example
description: "Example database"
labels:
env: prod
engine: postgres
spec:
protocol: "postgres"
uri: "localhost:5432"
```
The user creating the dynamic registration needs to have a role with access to the
database labels and the `db` resource. In this example role the user can only
create and maintain databases labeled `env: prod` and `engine: postgres`.
```yaml
kind: role
metadata:
name: dynamicregexample
spec:
allow:
db_labels:
engine: postgres
env: prod
rules:
- resources:
- db
verbs:
- list
- create
- read
- update
- delete
version: v5
```
See the full database resource [reference](../../../reference/infrastructure-as-code/teleport-resources/database-v3.mdx).
To create a database resource, run:
```code
$ tctl create database.yaml
```
- (!docs/pages/includes/tctl.mdx!)
After the resource has been created, it will appear among the list of available
databases (in `tsh db ls` or UI) as long as at least one Database Service
instance picks it up according to its label selectors.
To update an existing database resource, run:
```code
$ tctl create -f database.yaml
```
If the updated resource's labels no longer match a particular database, it
will unregister and stop proxying it.
To delete a database resource, run:
```code
$ tctl rm db/example
```
Aside from `tctl`, dynamic resources can also be added by:
- [Auto-Discovery](../../auto-discovery/databases/databases.mdx)
- [Terraform Provider](../../../configuration/terraform-provider/terraform-provider.mdx)
- [Kubernetes Operator](../../../configuration/teleport-operator/teleport-operator.mdx)
- [Teleport API](../../../zero-trust-access/api/api.mdx)
See [Using Dynamic Resources](../../../configuration/configuration.mdx) to learn
more about managing Teleport's dynamic resources in general.