Sub topic 3
How the deprecation policy decides when an API disappears
This chapter assumes you know what API groups, versions, and the alpha, beta, and stable levels are from the previous chapter. It also assumes you can read a manifest's apiVersion field.
Deprecated and removed are different states
An API version moves through two steps. While it is deprecated, the API server still serves it, but clients get a warning. Once it is removed, the server no longer recognizes it and rejects requests that use it.
The policy sets the minimum time between those two steps. That time is the window you have to migrate.
Minimum lifetime by maturity level
The window depends on the maturity level of the version being deprecated. The rule is "whichever is longer", so the release count can extend the time limit.
| Level | Example | Minimum support after deprecation |
|---|---|---|
| Stable (GA) | `v1` | 12 months or 3 releases |
| Beta | `v1beta1` | 9 months or 3 releases |
| Alpha | `v1alpha1` | 0 releases, can be removed at any time |
Kubernetes ships about three minor releases a year, so the 3-release limit is usually the longer one for beta. Removal happens only in a minor release, never in a patch release.
Rules that constrain what can be removed
- Removal needs a new version. An API element can be removed only by incrementing the version of its API group. You cannot drop a field from
v1and keep calling itv1. - Round-tripping must be lossless. An object converted between versions and back must not lose information. This is why the server can store one version and serve several.
- No move to a less stable level. A GA version cannot be deprecated in favor of a beta version.
A real example
extensions/v1beta1 Ingress was removed in Kubernetes 1.22. A manifest that applied cleanly on 1.21 was rejected on 1.22. The replacement was networking.k8s.io/v1, which also changed the schema, so the fix was more than editing one line.
Seeing what your clients still call
The API server records requests to deprecated versions. The apiserver_requested_deprecated_apis metric carries group, version, resource, and removed_release labels.
# Show which deprecated APIs this API server has served requests for
kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis
# List the API versions the server currently serves
kubectl api-versions | sortThe removed_release label tells you the first release that will reject the call. Compare it with your target version.
Common errors
- Treating a warning as harmless. Deprecated calls work until the removal release, then fail all at once.
- Assuming beta means long-lived. Beta APIs have a shorter window than GA ones.
- Only checking manifests. Controllers, Helm charts, and CI jobs also call the API, and the metric shows them.
Exercise
A beta API is deprecated in release 1.30. Its minimum support is "9 months or 3 releases, whichever is longer". Releases arrive about every 4 months. Which release is the earliest it can be removed in, and why?
Show answer
Release 1.33. Three releases after 1.30 is 1.33, about 12 months later. That is longer than 9 months, so the 3-release limit applies. Removal also happens only in a minor release.