Spin Target Configuration for SpinKube

Learn how to configure a Spin application target so it is compatible with the containerd-shim-spin environment.

Spin applications can run in a variety of environments, including the local CLI, cloud platforms, and SpinKube. Not every application is compatible with every environment.

Spin target environments describe the interfaces and capabilities that an environment provides. Each environment definition can be referenced from the application.targets array in a Spin application manifest. Spin then checks the application’s WebAssembly components against the selected target when you build the application.

Starting with containerd-shim-spin v0.27.2, the project publishes an environment definition for each shim release. Configure the target to match the shim version installed in your cluster with the Runtime Class Manager:

[application]
targets = ["containerd-shim-spin@<SHIM_VERSION>"]

Replace <SHIM_VERSION> with the full version of the shim you installed, without the v prefix. For example, use 0.27.2 for shim v0.27.2.

Example

The following example installs containerd-shim-spin v0.27.2:

kubectl apply -f https://github.com/spinframework/containerd-shim-spin/releases/download/v0.27.2/runtime-class-manager-shim-v1alpha1-v0.27.2.yaml

Add the matching target to spin.toml:

spin_manifest_version = 2

[application]
authors = ["SpinKube Maintainers"]
description = "My Spin app"
name = "hello"
version = "0.1.0"
targets = ["containerd-shim-spin@0.27.2"]

Then run:

spin build

The build validates the application’s components against the v0.27.2 shim target. If the application uses interfaces or capabilities that are not supported by that shim release, update the application or use a shim release that provides the required capabilities.