kubernetes/kops · error

error trying to locate asset %q: %v

Error message

error trying to locate asset %q: %v

What it means

KubectlBuilder.Build installs kubectl on API-server nodes by looking up the "kubectl" asset through b.Assets.Find(assetName, assetPath). When the asset resolution mechanism itself fails (network/download error, hash mismatch, malformed assets config), the error is wrapped as "error trying to locate asset %q: %v". Note this is distinct from the asset simply being absent, which produces "unable to locate asset" on the next line.

Source

Thrown at nodeup/pkg/model/kubectl.go:48

type KubectlBuilder struct {
	*NodeupModelContext
}

var _ fi.NodeupModelBuilder = &KubectlBuilder{}

// Build is responsible for managing the kubectl on the nodes
func (b *KubectlBuilder) Build(c *fi.NodeupModelBuilderContext) error {
	if !b.HasAPIServer {
		return nil
	}

	{
		// TODO: Extract to common function?
		assetName := "kubectl"
		assetPath := ""
		asset, err := b.Assets.Find(assetName, assetPath)
		if err != nil {
			return fmt.Errorf("error trying to locate asset %q: %v", assetName, err)
		}
		if asset == nil {
			return fmt.Errorf("unable to locate asset %q", assetName)
		}

		c.AddTask(&nodetasks.File{
			Path:     b.KubectlPath() + "/" + assetName,
			Contents: asset,
			Type:     nodetasks.FileType_File,
			Mode:     s("0755"),
		})
	}

	{
		name := nodetasks.PKIXName{
			CommonName:   "kubecfg",
			Organization: []string{rbac.SystemPrivilegedGroup},
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify network access from the node to the kops asset location (KOPS_BASE_URL / asset mirror) and fix connectivity or proxy settings
  2. Set a correct, reachable base URL (e.g. KOPS_BASE_URL or --kops-base-url) matching your kops version
  3. Use a custom asset configuration (kops set cluster cluster.spec.assets) pointing at an internally hosted kubectl binary with the correct hash
  4. Upgrade/downgrade kops so a published kubectl artifact exists for the node OS/arch

Example fix

# before: node cannot reach the default mirror
export KOPS_BASE_URL=https://unreachable.internal/kops
# after: point at a reachable mirror hosting the matching kubectl asset
export KOPS_BASE_URL=https://s3.amazonaws.com/kops-releases/latest
# or pre-pin the asset
kops set cluster mycluster cluster.spec.assets.nodeUrlAmd64=https://internalMirror/kubectl
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the kubectl asset is reachable before bootstrapping
baseURL := os.Getenv("KOPS_BASE_URL")
url := baseURL + "/linux/amd64/kubectl"
resp, err := http.Head(url)
if err != nil || resp.StatusCode != http.StatusOK {
	return fmt.Errorf("kubectl asset unreachable at %s: %v", url, err)
}

Try / catch

if err := runNodeup(cfg); err != nil {
	if strings.Contains(err.Error(), "error trying to locate asset") {
		log.Errorf("asset resolution failed; check KOPS_BASE_URL/mirror reachability and assets config: %v", err)
		return fmt.Errorf("bootstrap blocked by asset lookup: %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: Running nodeup on a node with an API server where kops' Assets.Find for name="kubectl" returns a non-nil error — e.g. failure resolving the kubectl download URL, an unreachable/misconfigured KOPS_BASE_URL or assets location, or an error computing the asset hash.

Common situations: Air-gapped or firewalled clusters where the kops asset mirror/base URL is unreachable; broken KOPS_BASE_URL or custom assetBundles config; kops version with no published kubectl artifact for the target GOOS/GOARCH; proxy/TLS problems on the node.

Related errors


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