|
| 1 | +# KEP-4706: Deprecate and remove kustomize from kubectl |
| 2 | + |
| 3 | +<!-- toc --> |
| 4 | +- [Release Signoff Checklist](#release-signoff-checklist) |
| 5 | +- [Summary](#summary) |
| 6 | +- [Motivation](#motivation) |
| 7 | + - [Goals](#goals) |
| 8 | + - [Non-Goals](#non-goals) |
| 9 | +- [Proposal](#proposal) |
| 10 | + - [Risks and Mitigations](#risks-and-mitigations) |
| 11 | + - [Users relying on <code>kubectl kustomize</code>](#users-relying-on-kubectl-kustomize) |
| 12 | + - [Users relying on <code>--kustomize</code> flag](#users-relying-on---kustomize-flag) |
| 13 | +- [Design Details](#design-details) |
| 14 | + - [Test Plan](#test-plan) |
| 15 | + - [Prerequisite testing updates](#prerequisite-testing-updates) |
| 16 | + - [Unit tests](#unit-tests) |
| 17 | + - [Integration tests](#integration-tests) |
| 18 | + - [e2e tests](#e2e-tests) |
| 19 | + - [Graduation Criteria](#graduation-criteria) |
| 20 | + - [Alpha](#alpha) |
| 21 | + - [Beta](#beta) |
| 22 | + - [GA](#ga) |
| 23 | + - [Deprecation](#deprecation) |
| 24 | + - [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy) |
| 25 | + - [Version Skew Strategy](#version-skew-strategy) |
| 26 | +- [Production Readiness Review Questionnaire](#production-readiness-review-questionnaire) |
| 27 | + - [Feature Enablement and Rollback](#feature-enablement-and-rollback) |
| 28 | + - [Rollout, Upgrade and Rollback Planning](#rollout-upgrade-and-rollback-planning) |
| 29 | + - [Monitoring Requirements](#monitoring-requirements) |
| 30 | + - [Dependencies](#dependencies) |
| 31 | + - [Scalability](#scalability) |
| 32 | + - [Troubleshooting](#troubleshooting) |
| 33 | +- [Implementation History](#implementation-history) |
| 34 | +- [Drawbacks](#drawbacks) |
| 35 | +- [Alternatives](#alternatives) |
| 36 | + - [Help with kustomize maintenance](#help-with-kustomize-maintenance) |
| 37 | + - [Minimize kustomize dependencies](#minimize-kustomize-dependencies) |
| 38 | +- [Infrastructure Needed (Optional)](#infrastructure-needed-optional) |
| 39 | +<!-- /toc --> |
| 40 | + |
| 41 | +## Release Signoff Checklist |
| 42 | + |
| 43 | +<!-- |
| 44 | +**ACTION REQUIRED:** In order to merge code into a release, there must be an |
| 45 | +issue in [kubernetes/enhancements] referencing this KEP and targeting a release |
| 46 | +milestone **before the [Enhancement Freeze](https://git.k8s.io/sig-release/releases) |
| 47 | +of the targeted release**. |
| 48 | +
|
| 49 | +For enhancements that make changes to code or processes/procedures in core |
| 50 | +Kubernetes—i.e., [kubernetes/kubernetes], we require the following Release |
| 51 | +Signoff checklist to be completed. |
| 52 | +
|
| 53 | +Check these off as they are completed for the Release Team to track. These |
| 54 | +checklist items _must_ be updated for the enhancement to be released. |
| 55 | +--> |
| 56 | + |
| 57 | +Items marked with (R) are required *prior to targeting to a milestone / release*. |
| 58 | + |
| 59 | +- [x] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR) |
| 60 | +- [x] (R) KEP approvers have approved the KEP status as `implementable` |
| 61 | +- [x] (R) Design details are appropriately documented |
| 62 | +- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors) |
| 63 | + - [ ] e2e Tests for all Beta API Operations (endpoints) |
| 64 | + - [ ] (R) Ensure GA e2e tests meet requirements for [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md) |
| 65 | + - [ ] (R) Minimum Two Week Window for GA e2e tests to prove flake free |
| 66 | +- [x] (R) Graduation criteria is in place |
| 67 | + - [ ] (R) [all GA Endpoints](https://github.com/kubernetes/community/pull/1806) must be hit by [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md) |
| 68 | +- [x] (R) Production readiness review completed |
| 69 | +- [x] (R) Production readiness review approved |
| 70 | +- [x] "Implementation History" section is up-to-date for milestone |
| 71 | +- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io] |
| 72 | +- [ ] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes |
| 73 | + |
| 74 | +<!-- |
| 75 | +**Note:** This checklist is iterative and should be reviewed and updated every time this enhancement is being considered for a milestone. |
| 76 | +--> |
| 77 | + |
| 78 | +[kubernetes.io]: https://kubernetes.io/ |
| 79 | +[kubernetes/enhancements]: https://git.k8s.io/enhancements |
| 80 | +[kubernetes/kubernetes]: https://git.k8s.io/kubernetes |
| 81 | +[kubernetes/website]: https://git.k8s.io/website |
| 82 | + |
| 83 | +## Summary |
| 84 | + |
| 85 | +Deprecate and remove kustomize from kubectl. This will allow both tools to |
| 86 | +be developed and maintained separately. |
| 87 | + |
| 88 | +## Motivation |
| 89 | + |
| 90 | +Kustomize was [brought into kubectl](https://github.com/kubernetes/kubernetes/pull/70875) |
| 91 | +shortly after its [initial release](https://github.com/kubernetes-sigs/kustomize/commit/e57010bcf641738738591eb48b4977843a494893). |
| 92 | +The main motivation back then was to expand declarative support for kubernetes objects. |
| 93 | +Over the past decade of kubernetes existence multiple, various tools for customization |
| 94 | +and templating has been development. Given that, current kubectl maintainers |
| 95 | +feel that promoting one tool over the other should not be the role of the project. |
| 96 | + |
| 97 | +Moreover, decoupling both projects will allow them to move at separate pace. The |
| 98 | +current kubernetes release cycle doesn't match that of kustomize, oftentimes |
| 99 | +risking users of kubectl to work with outdated version of kustomize. |
| 100 | + |
| 101 | +Lastly, some of the kustomize dependencies has already been problematic to the |
| 102 | +core kubernetes project, so removing kustomize will allow us to minimize the |
| 103 | +dependency graph and the size of kubectl binary. |
| 104 | + |
| 105 | + |
| 106 | +### Goals |
| 107 | + |
| 108 | +* Deprecate and remove kustomize from kubectl. |
| 109 | + |
| 110 | +### Non-Goals |
| 111 | + |
| 112 | +* Change kubectl or kustomize functionality. |
| 113 | +* Change kubectl or kustomize release cycle. |
| 114 | + |
| 115 | +## Proposal |
| 116 | + |
| 117 | +Following the [official kubernetes deprecation policy](https://kubernetes.io/docs/reference/using-api/deprecation-policy/#deprecating-a-flag-or-cli) |
| 118 | +it is required to keep a generally available element of user-facing component to |
| 119 | +be available at minimum 12 months or 2 releases. We're proposing to proceed with |
| 120 | +the deprecation and removal of kustomize in the following stages: |
| 121 | + |
| 122 | +1. v1.31 (alpha) - announce the deprecation of `kubectl kustomize` subcommand, |
| 123 | + `--kustomize` flag from all the subcommands using it, and from `kubectl version` |
| 124 | + output. |
| 125 | +2. v1.31 - v1.33 - gather feedback from users, and publish kustomize in [krew index](https://github.com/kubernetes-sigs/krew-index). |
| 126 | +3. v1.34 - v1.35 (beta) - disable kustomize by default from kubectl. |
| 127 | +4. Entirely remove kustomize in v1.36 (planned as first release of 2026). |
| 128 | + |
| 129 | +### Risks and Mitigations |
| 130 | + |
| 131 | +#### Users relying on `kubectl kustomize` |
| 132 | + |
| 133 | +There may be a significant group of users relying on the built-in kustomize. |
| 134 | +Those users should switch to using [kubectl plugins](../2379-kubectl-plugins/README.md), |
| 135 | +which allows kubectl users to invoke any `kubectl-*` prefixed binary as a native |
| 136 | +kubectl command. Additionally, we will publish kustomize in [krew index](https://github.com/kubernetes-sigs/krew-index), |
| 137 | +which provides a central repository for kubectl plugins. |
| 138 | + |
| 139 | +#### Users relying on `--kustomize` flag |
| 140 | + |
| 141 | +There may be a significant group of users relying on the built-in kustomize |
| 142 | +inside one of the subcommands. Those users will be advised to use `kustomize build` |
| 143 | +and pipe the output to appropriate command instead, as part of the deprecation warning. |
| 144 | + |
| 145 | +## Design Details |
| 146 | + |
| 147 | +In version 1.31 of kubectl we will implement warnings, such that all users of |
| 148 | +`kubectl kustomize` will be informed that the subcommand is deprecated and they |
| 149 | +will be directed to use standalone kustomize, or switch to kustomize plugin. |
| 150 | +Users of `--kustomize` flag will be informed that the flag is deprecated, |
| 151 | +and will be directed to use standalone kustomize. |
| 152 | + |
| 153 | +The above warnings will be implemented behind a `KUBECTL_LEGACY_KUSTOMIZE` environment |
| 154 | +variable which starting from v1.31 will be on by default. Users interested in |
| 155 | +trying out kubectl without kustomize will be able to disable the aforementioned |
| 156 | +environment variable. |
| 157 | + |
| 158 | +In version 1.34 we will disable the environment variable, disabling access to kustomize |
| 159 | +by default in kubectl. At this point in time users will still have the option to |
| 160 | +enable this mechanism back using `KUBECTL_LEGACY_KUSTOMIZE`. |
| 161 | + |
| 162 | +In version 1.36 lock `KUBECTL_LEGACY_KUSTOMIZE` to off by default, but leaving |
| 163 | +the kustomize code base in kubectl for one more release. |
| 164 | + |
| 165 | +Finally, in version 1.37 entirely drop kustomize from kubectl. |
| 166 | + |
| 167 | +### Test Plan |
| 168 | + |
| 169 | +[x] I/we understand the owners of the involved components may require updates to |
| 170 | +existing tests to make this code solid enough prior to committing the changes necessary |
| 171 | +to implement this enhancement. |
| 172 | + |
| 173 | +##### Prerequisite testing updates |
| 174 | + |
| 175 | +##### Unit tests |
| 176 | + |
| 177 | +- `k8s.io/cli-runtime/pkg/genericclioptions`: `2024-06-10` - `22.5%` |
| 178 | +- `k8s.io/cli-runtime/pkg/resource`: `2024-06-10` - `71.8%` |
| 179 | +- `k8s.io/kubectl/pkg/cmd/delete`: `2024-06-10` - `77.6%` |
| 180 | +- `k8s.io/kubectl/pkg/cmd/kustomize`: `2024-06-10` - `0%` |
| 181 | + |
| 182 | +##### Integration tests |
| 183 | + |
| 184 | +- `run_kubectl_version_tests`: https://testgrid.k8s.io/sig-testing-canaries#pull-kubernetes-integration-go-canary |
| 185 | +- `run_kubectl_apply_tests`: https://testgrid.k8s.io/sig-testing-canaries#pull-kubernetes-integration-go-canary |
| 186 | +- `run_kubectl_create_kustomization_directory_tests`: https://testgrid.k8s.io/sig-testing-canaries#pull-kubernetes-integration-go-canary |
| 187 | + |
| 188 | +##### e2e tests |
| 189 | + |
| 190 | +None available. |
| 191 | + |
| 192 | +### Graduation Criteria |
| 193 | + |
| 194 | +#### Alpha |
| 195 | + |
| 196 | +- Warning users that kustomize subcommand and flag is deprecated. |
| 197 | +- Feature implemented behind an environment variable `KUBECTL_LEGACY_KUSTOMIZE` turned on by default. |
| 198 | +- Gather feedback from users |
| 199 | + |
| 200 | +#### Beta |
| 201 | + |
| 202 | +- Turn `KUBECTL_LEGACY_KUSTOMIZE` environment variable off by default. |
| 203 | +- Publish kustomize in [krew index](https://github.com/kubernetes-sigs/krew-index). |
| 204 | +- Gather feedback from users |
| 205 | + |
| 206 | +#### GA |
| 207 | + |
| 208 | +- Lock `KUBECTL_LEGACY_KUSTOMIZE` environment variable to off by default. |
| 209 | + |
| 210 | +#### Deprecation |
| 211 | + |
| 212 | +- Remove kustomize from kubectl code base. |
| 213 | + |
| 214 | +### Upgrade / Downgrade Strategy |
| 215 | + |
| 216 | +Initially users will have the ability to test kubectl with and without kustomize |
| 217 | +setting `KUBECTL_LEGACY_KUSTOMIZE` to on or off. Eventually, once the functionality |
| 218 | +is removed users will have the option to switch to kustomize plugin (preferred), |
| 219 | +or stick with older version of kubectl as long as the support window allows. |
| 220 | + |
| 221 | +### Version Skew Strategy |
| 222 | + |
| 223 | +kubectl supports +/- one version skew. The deprecation and later removal |
| 224 | +of kustomize will not affect the provided support window. |
| 225 | + |
| 226 | +## Production Readiness Review Questionnaire |
| 227 | + |
| 228 | +### Feature Enablement and Rollback |
| 229 | + |
| 230 | +Users will have an option to test kubectl with and without kustomize by setting |
| 231 | +`KUBECTL_LEGACY_KUSTOMIZE` environment variable. Initially, by default this option |
| 232 | +will be on. |
| 233 | + |
| 234 | +###### How can this feature be enabled / disabled in a live cluster? |
| 235 | + |
| 236 | +- [ ] Feature gate (also fill in values in `kep.yaml`) |
| 237 | + - Feature gate name: |
| 238 | + - Components depending on the feature gate: |
| 239 | +- [X] Other |
| 240 | + - Describe the mechanism: |
| 241 | + `KUBECTL_LEGACY_KUSTOMIZE` environment variable |
| 242 | + - Will enabling / disabling the feature require downtime of the control |
| 243 | + plane? |
| 244 | + No. |
| 245 | + - Will enabling / disabling the feature require downtime or reprovisioning |
| 246 | + of a node? |
| 247 | + No. |
| 248 | + |
| 249 | +###### Does enabling the feature change any default behavior? |
| 250 | + |
| 251 | +Disabling `KUBECTL_LEGACY_KUSTOMIZE` will remove access to `kubectl kustomize`, |
| 252 | +`--kustomize` flag from appropriate subcommands and from `kubectl version` output. |
| 253 | + |
| 254 | +###### Can the feature be disabled once it has been enabled (i.e. can we roll back the enablement)? |
| 255 | + |
| 256 | +Yes, users will have `KUBECTL_LEGACY_KUSTOMIZE` environment variable to do just that. |
| 257 | + |
| 258 | +###### What happens if we reenable the feature if it was previously rolled back? |
| 259 | + |
| 260 | +Enabling `KUBECTL_LEGACY_KUSTOMIZE` will keep access to `kubectl kustomize`, |
| 261 | +`--kustomize` in the appropriate subcommands and in the `kubectl version` output. |
| 262 | + |
| 263 | +###### Are there any tests for feature enablement/disablement? |
| 264 | + |
| 265 | +We plan to add integration tests (in `test/cmd`) exercising the functionality |
| 266 | +with the environment variable turn on and off. |
| 267 | + |
| 268 | +### Rollout, Upgrade and Rollback Planning |
| 269 | + |
| 270 | +###### How can a rollout or rollback fail? Can it impact already running workloads? |
| 271 | + |
| 272 | +N/A |
| 273 | + |
| 274 | +###### What specific metrics should inform a rollback? |
| 275 | + |
| 276 | +N/A |
| 277 | + |
| 278 | +###### Were upgrade and rollback tested? Was the upgrade->downgrade->upgrade path tested? |
| 279 | + |
| 280 | +N/A |
| 281 | + |
| 282 | +###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.? |
| 283 | + |
| 284 | +We are deprecating `kubectl kustomize` subcommand, `--kustomize` flag from |
| 285 | +appropriate subcommands, and from `kubectl version` output. |
| 286 | + |
| 287 | + |
| 288 | +### Monitoring Requirements |
| 289 | + |
| 290 | +###### How can an operator determine if the feature is in use by workloads? |
| 291 | + |
| 292 | +N/A |
| 293 | + |
| 294 | +###### How can someone using this feature know that it is working for their instance? |
| 295 | + |
| 296 | +N/A |
| 297 | + |
| 298 | +###### What are the reasonable SLOs (Service Level Objectives) for the enhancement? |
| 299 | + |
| 300 | +N/A |
| 301 | + |
| 302 | +###### What are the SLIs (Service Level Indicators) an operator can use to determine the health of the service? |
| 303 | + |
| 304 | +N/A |
| 305 | + |
| 306 | +###### Are there any missing metrics that would be useful to have to improve observability of this feature? |
| 307 | + |
| 308 | +N/A |
| 309 | + |
| 310 | +### Dependencies |
| 311 | + |
| 312 | +###### Does this feature depend on any specific services running in the cluster? |
| 313 | + |
| 314 | +No. |
| 315 | + |
| 316 | +### Scalability |
| 317 | + |
| 318 | +###### Will enabling / using this feature result in any new API calls? |
| 319 | + |
| 320 | +No. |
| 321 | + |
| 322 | +###### Will enabling / using this feature result in introducing new API types? |
| 323 | + |
| 324 | +No. |
| 325 | + |
| 326 | +###### Will enabling / using this feature result in any new calls to the cloud provider? |
| 327 | + |
| 328 | +No. |
| 329 | + |
| 330 | +###### Will enabling / using this feature result in increasing size or count of the existing API objects? |
| 331 | + |
| 332 | +No. |
| 333 | + |
| 334 | +###### Will enabling / using this feature result in increasing time taken by any operations covered by existing SLIs/SLOs? |
| 335 | + |
| 336 | +No. |
| 337 | + |
| 338 | +###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components? |
| 339 | + |
| 340 | +No. |
| 341 | + |
| 342 | +###### Can enabling / using this feature result in resource exhaustion of some node resources (PIDs, sockets, inodes, etc.)? |
| 343 | + |
| 344 | +No. |
| 345 | + |
| 346 | +### Troubleshooting |
| 347 | + |
| 348 | +###### How does this feature react if the API server and/or etcd is unavailable? |
| 349 | + |
| 350 | +This is client-side functionality, so it is not affected by API server and/or etcd availability. |
| 351 | + |
| 352 | +###### What are other known failure modes? |
| 353 | + |
| 354 | +N/A |
| 355 | + |
| 356 | +###### What steps should be taken if SLOs are not being met to determine the problem? |
| 357 | + |
| 358 | +## Implementation History |
| 359 | + |
| 360 | +2024-06-10: Initial version of the document |
| 361 | + |
| 362 | +## Drawbacks |
| 363 | + |
| 364 | +<!-- |
| 365 | +Why should this KEP _not_ be implemented? |
| 366 | +--> |
| 367 | + |
| 368 | +## Alternatives |
| 369 | + |
| 370 | +<!-- |
| 371 | +What other approaches did you consider, and why did you rule them out? These do |
| 372 | +not need to be as detailed as the proposal, but should include enough |
| 373 | +information to express the idea and why it was not acceptable. |
| 374 | +--> |
| 375 | + |
| 376 | +### Help with kustomize maintenance |
| 377 | + |
| 378 | +[Kustomize](https://github.com/kubernetes-sigs/kustomize/) is pretty significant, |
| 379 | +the project has been around for [6 years now](https://github.com/kubernetes-sigs/kustomize/commit/e57010bcf641738738591eb48b4977843a494893). |
| 380 | +Unfortunately, in the recent years the maintainers turnaround has been pretty |
| 381 | +significant. Currently, the project is being overlooked by two primary contributors: |
| 382 | +[Yugo](https://github.com/koba1t) and [Varsha](https://github.com/varshaprasad96). |
| 383 | + |
| 384 | + |
| 385 | +### Minimize kustomize dependencies |
| 386 | + |
| 387 | +The project over the years built a lot of functionality current users rely on. |
| 388 | +The option to drop some of that, to be able to limit the scope of the dependencies |
| 389 | +is thus limited by which functionality can be dropped. Further more, our goal is |
| 390 | +not to limit the further development of kustomize, but only decoupling it from |
| 391 | +kubectl. |
| 392 | + |
| 393 | +## Infrastructure Needed (Optional) |
| 394 | + |
| 395 | +N/A |
0 commit comments