Talos provides a way to run additional system services early in the Talos boot process.
Extension services should be included into the Talos root filesystem (e.g. using system extensions).
Extension services run as privileged containers with ephemeral root filesystem located in the Talos root filesystem.Extension services can be used to extend core features of Talos in a way that is not possible via static pods or
Kubernetes DaemonSets.Potential extension services use-cases:
Talos on boot scans directory /usr/local/etc/containers for *.yaml files describing the extension services to run.
Format of the extension service config:
Field name sets the service name, valid names are [a-z0-9-_]+.
The service container root filesystem path is derived from the name: /usr/local/lib/containers/<name>.
The extension service will be registered as a Talos service under an ext-<name> identifier.
entrypoint defines the container entrypoint relative to the container root filesystem (/usr/local/lib/containers/<name>)
environmentFile (deprecated) defines the path to a file containing environment variables, the service waits for the file to
exist before starting.
Use ExtensionServiceConfig instead.
environment defines the container environment variables.
args defines the additional arguments to pass to the entrypoint
mounts defines the volumes to be mounted into the container root
All requested directories will be mounted into the extension service container mount namespace.
If the source directory doesn’t exist in the host filesystem, it will be created (only for writable paths in the Talos root filesystem).
The depends section describes extension service start dependencies: the service will not be started until all dependencies are met.Available dependencies:
service: <name>: wait for the service <name> to be running and healthy
path: <path>: wait for the <path> to exist
network: [addresses, connectivity, hostname, etcfiles]: wait for the specified network readiness checks to succeed
time: true: wait for the NTP time sync
configuration: true: wait for ExtensionServiceConfig resource with a name matching the extension name to be available.
The mounts specified in the ExtensionServiceConfig will be added as extra mounts to the extension service.
ExtensionServiceConfig is supported only when the extension service manifest declares configuration: true.
Using it with a service that does not declare this dependency is unsupported and has undefined startup behavior.
The service might start before its configuration is rendered, leaving config files or environment variables unavailable until a later service restart.
Field logToConsole defines whether the service logs should also be written to the console, i.e., to kernel log buffer (or to the container logs in container mode).This feature is particularly useful for debugging extensions that operate in maintenance mode or early in the boot process when service logs cannot be accessed yet.
Talos starts the container for the extension service with container root filesystem at /usr/local/lib/containers/hello-world:
/├── hello└── config.ini
Extension service is registered as ext-hello-world in talosctl services:
talosctl service ext-hello-worldNODE 172.20.0.5ID ext-hello-worldSTATE RunningHEALTH ?EVENTS [Running]: Started task ext-hello-world (PID 1100) for container ext-hello-world (2m47s ago) [Preparing]: Creating service runner (2m47s ago) [Preparing]: Running pre state (2m47s ago) [Waiting]: Waiting for service "containerd" to be "up" (2m48s ago) [Waiting]: Waiting for service "containerd" to be "up", network (2m49s ago)
An extension service can be started, restarted and stopped using talosctl service ext-hello-world start|restart|stop.
Use talosctl logs ext-hello-world to get the logs of the service.Complete example of the extension service can be found in the extensions repository.