{"record":{"id":"30d98e0633307a05","repo":"kubernetes/kops","slug":"kubernetesversion-not-specified-and-unable-to-dow","errorCode":null,"errorMessage":"KubernetesVersion not specified, and unable to download latest version from %q: %v","messagePattern":"KubernetesVersion not specified, and unable to download latest version from %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/defaults.go","lineNumber":226,"sourceCode":"\t\tlatestVersion, err := FindLatestKubernetesVersion()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tklog.Infof(\"Using kubernetes latest stable version: %s\", latestVersion)\n\t\tc.Spec.KubernetesVersion = latestVersion\n\t}\n\treturn nil\n}\n\n// FindLatestKubernetesVersion returns the latest kubernetes version,\n// as stored at https://dl.k8s.io/release/stable.txt\n// This shouldn't be used any more; we prefer reading the stable channel\nfunc FindLatestKubernetesVersion() (string, error) {\n\tstableURL := \"https://dl.k8s.io/release/stable.txt\"\n\tklog.Warningf(\"Loading latest kubernetes version from %q\", stableURL)\n\tb, err := vfs.Context.ReadFile(stableURL)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"KubernetesVersion not specified, and unable to download latest version from %q: %v\", stableURL, err)\n\t}\n\tlatestVersion := strings.TrimSpace(string(b))\n\treturn latestVersion, nil\n}\n\nfunc assignProxy(cluster *kops.Cluster) (*kops.EgressProxySpec, error) {\n\tegressProxy := cluster.Spec.Networking.EgressProxy\n\t// Add default no_proxy values if we are using a http proxy\n\tif egressProxy != nil {\n\n\t\tvar egressSlice []string\n\t\tif egressProxy.ProxyExcludes != \"\" {\n\t\t\tegressSlice = strings.Split(egressProxy.ProxyExcludes, \",\")\n\t\t}\n\n\t\tip, _, err := net.ParseCIDR(cluster.Spec.Networking.NonMasqueradeCIDR)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to parse Non Masquerade CIDR\")","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/defaults.go#L208-L244","documentation":"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.","triggerScenarios":"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.","commonSituations":"CI runners without internet or behind a corporate proxy; dl.k8s.io outages; DNS resolution failures; firewalls egress-filtering the build machine.","solutions":["Pin an explicit version: set cluster.Spec.KubernetesVersion or pass --kubernetes-version to kops create cluster so no download is needed","Fix network access to dl.k8s.io (proxy: set HTTPS_PROXY; firewall: allow dl.k8s.io)","Retry after a transient dl.k8s.io outage"],"exampleFix":"// before\nkops create cluster --cloud aws ...   # fetches stable.txt, fails offline\n// after\nkops create cluster --cloud aws --kubernetes-version v1.28.4 ...","handlingStrategy":"fallback","validationCode":"if cluster.Spec.KubernetesVersion == \"\" {\n    // ensure offline environments pin a version beforehand\n    return errors.New(\"KubernetesVersion must be set in offline environments\")\n}","typeGuard":null,"tryCatchPattern":"ver, err := FindLatestKubernetesVersion()\nif err != nil {\n    klog.Warningf(\"falling back to pinned version: %v\", err)\n    ver = fallbackKubernetesVersion\n}","preventionTips":["Always pass --kubernetes-version in offline/air-gapped environments","Set HTTPS_PROXY for CI runners","Monitor dl.k8s.io reachability in preflight checks"],"tags":["kubernetes-version","network","offline","defaults"],"backgroundTag":"network-fetch-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}