talos-extensions/examples/hello-world-service
Dmitry Sharshakov 5cd226e3ea
chore: build with new toolchain
Move modules, firmware and libraries to accommodate usrmerged rootfs

Only use network where needed via new bldr, pre-download Go dependencies in prepare step, improve Go cache

Bump xen-guest-agent to make it build with current Alpine Rust

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
2025-02-10 16:00:19 +01:00
..
src chore: bump deps 2024-08-06 22:34:19 +03:00
hello-world.yaml feat: add example extension hello world service 2022-02-16 22:00:12 +03:00
manifest.yaml refactor: clean up extensions versioning 2022-04-13 20:08:59 +03:00
pkg.yaml chore: build with new toolchain 2025-02-10 16:00:19 +01:00
README.md docs: update documentation on installing extensions 2023-09-29 22:49:23 +04:00
vars.yaml chore: adjust extension versions (tags) to drop Talos version 2024-01-31 17:05:13 +04:00

Example Talos Extension Service

This repository is an example of an extension service.

Installation

See Installing Extensions.

Usage

Once this example extension is installed, it will provide simple HTTP server which responds with a message on port 80:

$ curl http://<IP>/
Hello from Talos Linux Extension Service!

Extension service appears in the service list (please note the ext- prefix):

$ talosctl services
NODE         SERVICE           STATE     HEALTH   LAST CHANGE   LAST EVENT
172.20.0.5   apid              Running   OK       1m37s ago     Health check successful
172.20.0.5   containerd        Running   OK       1m38s ago     Health check successful
172.20.0.5   cri               Running   OK       1m37s ago     Health check successful
172.20.0.5   ext-hello-world   Running   ?        1m38s ago     Started task ext-hello-world (PID 1100) for container ext-hello-world
172.20.0.5   kubelet           Running   OK       1m30s ago     Health check successful
172.20.0.5   machined          Running   ?        1m40s ago     Service started as goroutine
172.20.0.5   udevd             Running   OK       1m38s ago     Health check successful

Run talosctl service ext-hello-world to see the detailed service state:

$ talosctl service ext-hello-world
NODE     172.20.0.5
ID       ext-hello-world
STATE    Running
HEALTH   ?
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)

The service can be started and stopped via talosctl:

$ talosctl  service ext-hello-world stop
NODE         RESPONSE
172.20.0.5   Service "ext-hello-world" stopped
$ talosctl service ext-hello-world start
NODE         RESPONSE
172.20.0.5   Service "ext-hello-world" started

Use talosctl logs to access service logs:

$ talosctl logs ext-hello-world
172.20.0.5: 2022/02/16 18:45:21 starting the hello world service
172.20.0.5: 2022/02/16 18:52:33 stopping the hello world service
172.20.0.5: 2022/02/16 18:52:35 starting the hello world service