{"record":{"id":"34531c690c06d6ad","repo":"GoogleContainerTools/skaffold","slug":"kubectl-version-1-12-0-or-greater-is-recommended-f","errorCode":null,"errorMessage":"kubectl version 1.12.0 or greater is recommended for use with Skaffold","messagePattern":"kubectl version 1\\.12\\.0 or greater is recommended for use with Skaffold","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/skaffold/kubectl/version.go","lineNumber":61,"sourceCode":"}\n\nfunc (v ClientVersion) String() string {\n\tif v.Major == unknown || v.Minor == unknown {\n\t\treturn unknown\n\t}\n\n\treturn v.Major + \".\" + v.Minor\n}\n\n// CheckVersion warns the user if their kubectl version is < 1.12.0\nfunc (c *CLI) CheckVersion(ctx context.Context) error {\n\tcomp, err := c.CompareVersionTo(ctx, 1, 12)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif comp < 0 {\n\t\treturn errors.New(\"kubectl version 1.12.0 or greater is recommended for use with Skaffold\")\n\t}\n\treturn nil\n}\n\nfunc (c *CLI) CompareVersionTo(ctx context.Context, vMajor, vMinor int) (int, error) {\n\tv := c.Version(ctx)\n\n\tmajorInt, err := strconv.Atoi(v.Major)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"couldn't get kubectl minor version: %w\", err)\n\t}\n\n\t// Some patched versions get a '+' suffix.\n\tminorInt, err := strconv.Atoi(strings.TrimRight(v.Minor, \"+\"))\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"couldn't get kubectl minor version: %w\", err)\n\t}\n","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/kubectl/version.go#L43-L79","documentation":"CheckVersion validates the installed kubectl client version and returns this error when kubectl is older than 1.12, which Skaffold considers the minimum recommended version for manifest handling. CompareVersionTo compares the client's major/minor version against 1.12 and a negative result triggers the message.","triggerScenarios":"Any code path calling kubectl.CLI.CheckVersion while the kubectl binary on PATH reports major.minor < 1.12 (e.g. 1.11.x or older).","commonSituations":"Old kubectl left in PATH from a legacy cluster install; CI images pinned to old kubectl; version skew after upgrading the cluster but not the local tooling.","solutions":["Upgrade kubectl to >= 1.12 (`kubectl version --client` to check; install via krew, package manager, or GKE/cloud CLI)","Ensure the newer kubectl is first on PATH (remove/renames stale binaries like /usr/local/bin/kubectl)","Pin kubectl in CI images to a modern version matching the cluster"],"exampleFix":"// before\n$ kubectl version --client  # v1.11.10\n// after\n$ curl -LO https://dl.k8s.io/release/stable.txt/bin/linux/amd64/kubectl && install kubectl /usr/local/bin/\n$ kubectl version --client  # >= 1.12","handlingStrategy":"validation","validationCode":"out, err := exec.Command(\"kubectl\", \"version\", \"--client\", \"-o\", \"json\").Output()\nvar v struct{ ClientVersion struct{ Major, Minor string } }\njson.Unmarshal(out, &v)\nif parseMinor(v.ClientVersion.Minor) < 12 { return errors.New(\"kubectl >= 1.12 required\") }","typeGuard":"func kubectlAtLeast112(major, minor int) bool { return major > 1 || (major == 1 && minor >= 12) }","tryCatchPattern":"if err := cli.CheckVersion(ctx); err != nil {\n  log.Warnf(\"kubectl check failed: %v — upgrade kubectl\", err)\n  return fmt.Errorf(\"kubectl too old: %w\", err)\n}","preventionTips":["Pin kubectl version in CI images alongside cluster version","Run `kubectl version --client` in environment bootstrap","Keep kubectl first on PATH; remove stale binaries"],"tags":["kubectl","version-check","skaffold"],"backgroundTag":"kubectl-version-too-old","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}