kubernetes/kops · error

KubernetesVersion not specified, and unable to download late

Error message

KubernetesVersion not specified, and unable to download latest version from %q: %v

What it means

FindLatestKubernetesVersion fetches https://dl.k8s.io/release/stable.txt to determine the latest Kubernetes version when the cluster spec does not set KubernetesVersion. If the download fails, this error wraps the network/VFS failure and cluster spec population stops because no version can be defaulted.

Source

Thrown at upup/pkg/fi/cloudup/defaults.go:226

		latestVersion, err := FindLatestKubernetesVersion()
		if err != nil {
			return err
		}
		klog.Infof("Using kubernetes latest stable version: %s", latestVersion)
		c.Spec.KubernetesVersion = latestVersion
	}
	return nil
}

// FindLatestKubernetesVersion returns the latest kubernetes version,
// as stored at https://dl.k8s.io/release/stable.txt
// This shouldn't be used any more; we prefer reading the stable channel
func FindLatestKubernetesVersion() (string, error) {
	stableURL := "https://dl.k8s.io/release/stable.txt"
	klog.Warningf("Loading latest kubernetes version from %q", stableURL)
	b, err := vfs.Context.ReadFile(stableURL)
	if err != nil {
		return "", fmt.Errorf("KubernetesVersion not specified, and unable to download latest version from %q: %v", stableURL, err)
	}
	latestVersion := strings.TrimSpace(string(b))
	return latestVersion, nil
}

func assignProxy(cluster *kops.Cluster) (*kops.EgressProxySpec, error) {
	egressProxy := cluster.Spec.Networking.EgressProxy
	// Add default no_proxy values if we are using a http proxy
	if egressProxy != nil {

		var egressSlice []string
		if egressProxy.ProxyExcludes != "" {
			egressSlice = strings.Split(egressProxy.ProxyExcludes, ",")
		}

		ip, _, err := net.ParseCIDR(cluster.Spec.Networking.NonMasqueradeCIDR)
		if err != nil {
			return nil, fmt.Errorf("unable to parse Non Masquerade CIDR")

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Pin an explicit version: set cluster.Spec.KubernetesVersion or pass --kubernetes-version to kops create cluster so no download is needed
  2. Fix network access to dl.k8s.io (proxy: set HTTPS_PROXY; firewall: allow dl.k8s.io)
  3. Retry after a transient dl.k8s.io outage

Example fix

// before
kops create cluster --cloud aws ...   # fetches stable.txt, fails offline
// after
kops create cluster --cloud aws --kubernetes-version v1.28.4 ...
Defensive patterns

Strategy: fallback

Validate before calling

if cluster.Spec.KubernetesVersion == "" {
    // ensure offline environments pin a version beforehand
    return errors.New("KubernetesVersion must be set in offline environments")
}

Try / catch

ver, err := FindLatestKubernetesVersion()
if err != nil {
    klog.Warningf("falling back to pinned version: %v", err)
    ver = fallbackKubernetesVersion
}

Prevention

When it happens

Trigger: Calling ensureKubernetesVersion (via PerformAssignments/populate) with cluster.Spec.KubernetesVersion empty while the HTTPS fetch of dl.k8s.io/release/stable.txt fails — no network, DNS failure, proxy blocking, or dl.k8s.io unreachable.

Common situations: CI runners without internet or behind a corporate proxy; dl.k8s.io outages; DNS resolution failures; firewalls egress-filtering the build machine.

Related errors


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