kubernetes/kops · error

unable to find containerd config

Error message

unable to find containerd config

What it means

FindContainerdAsset reads the containerd configuration off the instance group's cluster spec. If ig.RawClusterSpec().Containerd is nil there is no containerd config to derive a URL or version from, so the function fails fast with this sentinel error. It protects the asset pipeline from dereferencing a missing config block.

Source

Thrown at pkg/nodemodel/wellknownassets/containerd.go:40

	"github.com/blang/semver/v4"

	"k8s.io/kops/pkg/apis/kops/model"
	"k8s.io/kops/pkg/assets"
	"k8s.io/kops/upup/pkg/fi"
	"k8s.io/kops/util/pkg/architectures"
	"k8s.io/kops/util/pkg/hashing"
)

const (
	containerdReleaseUrlAmd64 = "https://github.com/containerd/containerd/releases/download/v%s/containerd-%s-linux-amd64.tar.gz"
	containerdReleaseUrlArm64 = "https://github.com/containerd/containerd/releases/download/v%s/containerd-%s-linux-arm64.tar.gz"
)

func FindContainerdAsset(ig model.InstanceGroup, assetBuilder *assets.AssetBuilder, arch architectures.Architecture) (*assets.FileAsset, error) {
	containerd := ig.RawClusterSpec().Containerd
	if containerd == nil {
		return nil, fmt.Errorf("unable to find containerd config")
	}

	canonicalURL := ""
	knownHash := ""

	if containerd.Packages != nil {
		if arch == architectures.ArchitectureAmd64 && containerd.Packages.UrlAmd64 != nil && containerd.Packages.HashAmd64 != nil {
			canonicalURL = fi.ValueOf(containerd.Packages.UrlAmd64)
			knownHash = fi.ValueOf(containerd.Packages.HashAmd64)
		}
		if arch == architectures.ArchitectureArm64 && containerd.Packages.UrlArm64 != nil && containerd.Packages.HashArm64 != nil {
			canonicalURL = fi.ValueOf(containerd.Packages.UrlArm64)
			knownHash = fi.ValueOf(containerd.Packages.HashArm64)
		}
	}

	if canonicalURL == "" {
		version := fi.ValueOf(containerd.Version)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Add a containerd section to the cluster spec (e.g. containerd: {version: 2.x}) and update the cluster
  2. In code/tests, construct the InstanceGroup with a non-nil Containerd config before calling FindContainerdAsset
  3. If containerd assets are not required, skip FindContainerdAsset for that instance group

Example fix

// before
spec: {}
// after
spec:
  containerd:
    version: 2.1.0
Defensive patterns

Strategy: validation

Validate before calling

if ig.RawClusterSpec().Containerd == nil {
    return fmt.Errorf("instance group %s has no containerd config; add spec.containerd before building assets", ig.Name)
}

Try / catch

asset, err := wellknownassets.FindContainerdAsset(ig, assetBuilder, arch)
if err != nil && strings.Contains(err.Error(), "unable to find containerd config") {
    return fmt.Errorf("cluster spec is missing the containerd block: %w", err)
}

Prevention

When it happens

Trigger: BuildKubernetesFileAssets calls FindContainerdAsset with an instance group whose cluster spec has no containerd section set (ContainerdConfig nil) while containerd assets are requested.

Common situations: Older cluster manifests predating the containerd spec field; programmatically constructed InstanceGroup/test fixtures lacking the Containerd block; clusters migrated from docker runtime without adding the containerd stanza.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/dbe6f1da37109dac. Report an issue: GitHub.