|
| 1 | +--- |
| 2 | +reviewers: |
| 3 | +- liggitt |
| 4 | +- lavalamp |
| 5 | +- thockin |
| 6 | +- smarterclayton |
| 7 | +title: "Deprecated API Migration Guide" |
| 8 | +weight: 45 |
| 9 | +content_type: reference |
| 10 | +--- |
| 11 | + |
| 12 | +<!-- overview --> |
| 13 | + |
| 14 | +As the Kubernetes API evolves, APIs are periodically reorganized or upgraded. |
| 15 | +When APIs evolve, the old API is deprecated and eventually removed. |
| 16 | +This page contains information you need to know when migrating from |
| 17 | +deprecated API versions to newer and more stable API versions. |
| 18 | + |
| 19 | +<!-- body --> |
| 20 | + |
| 21 | +## Removed APIs by release |
| 22 | + |
| 23 | + |
| 24 | +### v1.25 |
| 25 | + |
| 26 | +The **v1.25** release will stop serving the following deprecated API versions: |
| 27 | + |
| 28 | +#### Event {#event-v125} |
| 29 | + |
| 30 | +The **events.k8s.io/v1beta1** API version of Event will no longer be served in v1.25. |
| 31 | + |
| 32 | +* Migrate manifests and API clients to use the **events.k8s.io/v1** API version, available since v1.19. |
| 33 | +* All existing persisted objects are accessible via the new API |
| 34 | +* Notable changes in **events.k8s.io/v1**: |
| 35 | + * `type` is limited to `Normal` and `Warning` |
| 36 | + * `involvedObject` is renamed to `regarding` |
| 37 | + * `action`, `reason`, `reportingComponent`, and `reportingInstance` are required when creating new **events.k8s.io/v1** Events |
| 38 | + * use `eventTime` instead of the deprecated `firstTimestamp` field (which is renamed to `deprecatedFirstTimestamp` and not permitted in new **events.k8s.io/v1** Events) |
| 39 | + * use `series.lastObservedTime` instead of the deprecated `lastTimestamp` field (which is renamed to `deprecatedLastTimestamp` and not permitted in new **events.k8s.io/v1** Events) |
| 40 | + * use `series.count` instead of the deprecated `count` field (which is renamed to `deprecatedCount` and not permitted in new **events.k8s.io/v1** Events) |
| 41 | + * use `reportingComponent` instead of the deprecated `source.component` field (which is renamed to `deprecatedSource.component` and not permitted in new **events.k8s.io/v1** Events) |
| 42 | + * use `reportingInstance` instead of the deprecated `source.host` field (which is renamed to `deprecatedSource.host` and not permitted in new **events.k8s.io/v1** Events) |
| 43 | + |
| 44 | +#### RuntimeClass {#runtimeclass-v125} |
| 45 | + |
| 46 | +RuntimeClass in the **node.k8s.io/v1beta1** API version will no longer be served in v1.25. |
| 47 | + |
| 48 | +* Migrate manifests and API clients to use the **node.k8s.io/v1** API version, available since v1.20. |
| 49 | +* All existing persisted objects are accessible via the new API |
| 50 | +* No notable changes |
| 51 | + |
| 52 | +### v1.22 |
| 53 | + |
| 54 | +The **v1.22** release will stop serving the following deprecated API versions: |
| 55 | + |
| 56 | +#### Webhook resources {#webhook-resources-v122} |
| 57 | + |
| 58 | +The **admissionregistration.k8s.io/v1beta1** API version of MutatingWebhookConfiguration and ValidatingWebhookConfiguration will no longer be served in v1.22. |
| 59 | + |
| 60 | +* Migrate manifests and API clients to use the **admissionregistration.k8s.io/v1** API version, available since v1.16. |
| 61 | +* All existing persisted objects are accessible via the new APIs |
| 62 | +* Notable changes: |
| 63 | + * `webhooks[*].failurePolicy` default changed from `Ignore` to `Fail` for v1 |
| 64 | + * `webhooks[*].matchPolicy` default changed from `Exact` to `Equivalent` for v1 |
| 65 | + * `webhooks[*].timeoutSeconds` default changed from `30s` to `10s` for v1 |
| 66 | + * `webhooks[*].sideEffects` default value is removed, and the field made required, and only `None` and `NoneOnDryRun` are permitted for v1 |
| 67 | + * `webhooks[*].admissionReviewVersions` default value is removed and the field made required for v1 (supported versions for AdmissionReview are `v1` and `v1beta1`) |
| 68 | + * `webhooks[*].name` must be unique in the list for objects created via `admissionregistration.k8s.io/v1` |
| 69 | + |
| 70 | +#### CustomResourceDefinition {#customresourcedefinition-v122} |
| 71 | + |
| 72 | +The **apiextensions.k8s.io/v1beta1** API version of CustomResourceDefinition will no longer be served in v1.22. |
| 73 | + |
| 74 | +* Migrate manifests and API clients to use the **apiextensions.k8s.io/v1beta1** API version, available since v1.16. |
| 75 | +* All existing persisted objects are accessible via the new API |
| 76 | +* Notable changes: |
| 77 | + * `spec.scope` is no longer defaulted to `Namespaced` and must be explicitly specified |
| 78 | + * `spec.version` is removed in v1; use `spec.versions` instead |
| 79 | + * `spec.validation` is removed in v1; use `spec.versions[*].schema` instead |
| 80 | + * `spec.subresources` is removed in v1; use `spec.versions[*].subresources` instead |
| 81 | + * `spec.additionalPrinterColumns` is removed in v1; use `spec.versions[*].additionalPrinterColumns` instead |
| 82 | + * `spec.conversion.webhookClientConfig` is moved to `spec.conversion.webhook.clientConfig` in v1 |
| 83 | + * `spec.conversion.conversionReviewVersions` is moved to `spec.conversion.webhook.conversionReviewVersions` in v1 |
| 84 | + * `spec.versions[*].schema.openAPIV3Schema` is now required when creating v1 CustomResourceDefinition objects, and must be a [structural schema](/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#specifying-a-structural-schema) |
| 85 | + * `spec.preserveUnknownFields: true` is disallowed when creating v1 CustomResourceDefinition objects; it must be specified within schema definitions as `x-kubernetes-preserve-unknown-fields: true` |
| 86 | + * In `additionalPrinterColumns` items, the `JSONPath` field was renamed to `jsonPath` in v1 (fixes [#66531](https://github.com/kubernetes/kubernetes/issues/66531)) |
| 87 | + |
| 88 | +#### APIService {#apiservice-v122} |
| 89 | + |
| 90 | +The **apiregistration.k8s.io/v1beta1** API version of APIService will no longer be served in v1.22. |
| 91 | + |
| 92 | +* Migrate manifests and API clients to use the **apiregistration.k8s.io/v1** API version, available since v1.10. |
| 93 | +* All existing persisted objects are accessible via the new API |
| 94 | +* No notable changes |
| 95 | + |
| 96 | +#### TokenReview {#tokenreview-v122} |
| 97 | + |
| 98 | +The **authentication.k8s.io/v1beta1** API version of TokenReview will no longer be served in v1.22. |
| 99 | + |
| 100 | +* Migrate manifests and API clients to use the **authentication.k8s.io/v1** API version, available since v1.6. |
| 101 | +* No notable changes |
| 102 | + |
| 103 | +#### SubjectAccessReview resources {#subjectaccessreview-resources-v122} |
| 104 | + |
| 105 | +The **authorization.k8s.io/v1beta1** API version of LocalSubjectAccessReview, SelfSubjectAccessReview, and SubjectAccessReview will no longer be served in v1.22. |
| 106 | + |
| 107 | +* Migrate manifests and API clients to use the **authorization.k8s.io/v1** API version, available since v1.6. |
| 108 | +* Notable changes: |
| 109 | + * `spec.group` was renamed to `spec.groups` in v1 (fixes [#32709](https://github.com/kubernetes/kubernetes/issues/32709)) |
| 110 | + |
| 111 | +#### CertificateSigningRequest {#certificatesigningrequest-v122} |
| 112 | + |
| 113 | +The **certificates.k8s.io/v1beta1** API version of CertificateSigningRequest will no longer be served in v1.22. |
| 114 | + |
| 115 | +* Migrate manifests and API clients to use the **certificates.k8s.io/v1** API version, available since v1.19. |
| 116 | +* All existing persisted objects are accessible via the new API |
| 117 | +* Notable changes in `certificates.k8s.io/v1`: |
| 118 | + * For API clients requesting certificates: |
| 119 | + * `spec.signerName` is now required (see [known Kubernetes signers](https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/#kubernetes-signers)), and requests for `kubernetes.io/legacy-unknown` are not allowed to be created via the `certificates.k8s.io/v1` API |
| 120 | + * `spec.usages` is now required, may not contain duplicate values, and must only contain known usages |
| 121 | + * For API clients approving or signing certificates: |
| 122 | + * `status.conditions` may not contain duplicate types |
| 123 | + * `status.conditions[*].status` is now required |
| 124 | + * `status.certificate` must be PEM-encoded, and contain only `CERTIFICATE` blocks |
| 125 | + |
| 126 | +#### Lease {#lease-v122} |
| 127 | + |
| 128 | +The **coordination.k8s.io/v1beta1** API version of Lease will no longer be served in v1.22. |
| 129 | + |
| 130 | +* Migrate manifests and API clients to use the **coordination.k8s.io/v1** API version, available since v1.14. |
| 131 | +* All existing persisted objects are accessible via the new API |
| 132 | +* No notable changes |
| 133 | + |
| 134 | +#### Ingress {#ingress-v122} |
| 135 | + |
| 136 | +The **extensions/v1beta1** and **networking.k8s.io/v1beta1** API versions of Ingress will no longer be served in v1.22. |
| 137 | + |
| 138 | +* Migrate manifests and API clients to use the **networking.k8s.io/v1** API version, available since v1.19. |
| 139 | +* All existing persisted objects are accessible via the new API |
| 140 | +* Notable changes: |
| 141 | + * `spec.backend` is renamed to `spec.defaultBackend` |
| 142 | + * The backend `serviceName` field is renamed to `service.name` |
| 143 | + * Numeric backend `servicePort` fields are renamed to `service.port.number` |
| 144 | + * String backend `servicePort` fields are renamed to `service.port.name` |
| 145 | + * `pathType` is now required for each specified path. Options are `Prefix`, `Exact`, and `ImplementationSpecific`. To match the undefined `v1beta1` behavior, use `ImplementationSpecific`. |
| 146 | + |
| 147 | +#### IngressClass {#ingressclass-v122} |
| 148 | + |
| 149 | +The **networking.k8s.io/v1beta1** API version of IngressClass will no longer be served in v1.22. |
| 150 | + |
| 151 | +* Migrate manifests and API clients to use the **networking.k8s.io/v1** API version, available since v1.19. |
| 152 | +* All existing persisted objects are accessible via the new API |
| 153 | +* No notable changes |
| 154 | + |
| 155 | +#### RBAC resources {#rbac-resources-v122} |
| 156 | + |
| 157 | +The **rbac.authorization.k8s.io/v1beta1** API version of ClusterRole, ClusterRoleBinding, Role, and RoleBinding will no longer be served in v1.22. |
| 158 | + |
| 159 | +* Migrate manifests and API clients to use the **networking.k8s.io/v1** API version, available since v1.8. |
| 160 | +* All existing persisted objects are accessible via the new APIs |
| 161 | +* No notable changes |
| 162 | + |
| 163 | +#### PriorityClass {#priorityclass-v122} |
| 164 | + |
| 165 | +The **scheduling.k8s.io/v1beta1** API version of PriorityClass will no longer be served in v1.22. |
| 166 | + |
| 167 | +* Migrate manifests and API clients to use the **scheduling.k8s.io/v1** API version, available since v1.14. |
| 168 | +* All existing persisted objects are accessible via the new API |
| 169 | +* No notable changes |
| 170 | + |
| 171 | +#### Storage resources {#storage-resources-v122} |
| 172 | + |
| 173 | +The **storage.k8s.io/v1beta1** API version of CSIDriver, CSINode, StorageClass, and VolumeAttachment will no longer be served in v1.22. |
| 174 | + |
| 175 | +* Migrate manifests and API clients to use the **storage.k8s.io/v1** API version |
| 176 | + * CSIDriver is available in **storage.k8s.io/v1** since v1.19. |
| 177 | + * CSINode is available in **storage.k8s.io/v1** since v1.17 |
| 178 | + * StorageClass is available in **storage.k8s.io/v1** since v1.6 |
| 179 | + * VolumeAttachment is available in **storage.k8s.io/v1** v1.13 |
| 180 | +* All existing persisted objects are accessible via the new APIs |
| 181 | +* No notable changes |
| 182 | + |
| 183 | +### v1.16 |
| 184 | + |
| 185 | +The **v1.16** release stopped serving the following deprecated API versions: |
| 186 | + |
| 187 | +#### NetworkPolicy {#networkpolicy-v116} |
| 188 | + |
| 189 | +The **extensions/v1beta1** API version of NetworkPolicy is no longer served as of v1.16. |
| 190 | + |
| 191 | +* Migrate manifests and API clients to use the **networking.k8s.io/v1** API version, available since v1.8. |
| 192 | +* All existing persisted objects are accessible via the new API |
| 193 | + |
| 194 | +#### DaemonSet {#daemonset-v116} |
| 195 | + |
| 196 | +The **extensions/v1beta1** and **apps/v1beta2** API versions of DaemonSet are no longer served as of v1.16. |
| 197 | + |
| 198 | +* Migrate manifests and API clients to use the **apps/v1** API version, available since v1.9. |
| 199 | +* All existing persisted objects are accessible via the new API |
| 200 | +* Notable changes: |
| 201 | + * `spec.templateGeneration` is removed |
| 202 | + * `spec.selector` is now required and immutable after creation; use the existing template labels as the selector for seamless upgrades |
| 203 | + * `spec.updateStrategy.type` now defaults to `RollingUpdate` (the default in `extensions/v1beta1` was `OnDelete`) |
| 204 | + |
| 205 | +#### Deployment {#deployment-v116} |
| 206 | + |
| 207 | +The **extensions/v1beta1**, **apps/v1beta1**, and **apps/v1beta2** API versions of Deployment are no longer served as of v1.16. |
| 208 | + |
| 209 | +* Migrate manifests and API clients to use the **apps/v1** API version, available since v1.9. |
| 210 | +* All existing persisted objects are accessible via the new API |
| 211 | +* Notable changes: |
| 212 | + * `spec.rollbackTo` is removed |
| 213 | + * `spec.selector` is now required and immutable after creation; use the existing template labels as the selector for seamless upgrades |
| 214 | + * `spec.progressDeadlineSeconds` now defaults to `600` seconds (the default in `extensions/v1beta1` was no deadline) |
| 215 | + * `spec.revisionHistoryLimit` now defaults to `10` (the default in `apps/v1beta1` was `2`, the default in `extensions/v1beta1` was to retain all) |
| 216 | + * `maxSurge` and `maxUnavailable` now default to `25%` (the default in `extensions/v1beta1` was `1`) |
| 217 | + |
| 218 | +#### StatefulSet {#statefulset-v116} |
| 219 | + |
| 220 | +The **apps/v1beta1** and **apps/v1beta2** API versions of StatefulSet are no longer served as of v1.16. |
| 221 | + |
| 222 | +* Migrate manifests and API clients to use the **apps/v1** API version, available since v1.9. |
| 223 | +* All existing persisted objects are accessible via the new API |
| 224 | +* Notable changes: |
| 225 | + * `spec.selector` is now required and immutable after creation; use the existing template labels as the selector for seamless upgrades |
| 226 | + * `spec.updateStrategy.type` now defaults to `RollingUpdate` (the default in `apps/v1beta1` was `OnDelete`) |
| 227 | + |
| 228 | +#### ReplicaSet {#replicaset-v116} |
| 229 | + |
| 230 | +The **extensions/v1beta1**, **apps/v1beta1**, and **apps/v1beta2** API versions of ReplicaSet are no longer served as of v1.16. |
| 231 | + |
| 232 | +* Migrate manifests and API clients to use the **apps/v1** API version, available since v1.9. |
| 233 | +* All existing persisted objects are accessible via the new API |
| 234 | +* Notable changes: |
| 235 | + * `spec.selector` is now required and immutable after creation; use the existing template labels as the selector for seamless upgrades |
| 236 | + |
| 237 | +## What to do |
| 238 | + |
| 239 | +### Test with deprecated APIs disabled |
| 240 | + |
| 241 | +You can test your clusters by starting an API server with specific API versions disabled |
| 242 | +to simulate upcoming removals. Add the following flag to the API server startup arguments: |
| 243 | + |
| 244 | +`--runtime-config=<group>/<version>=false` |
| 245 | + |
| 246 | +For example: |
| 247 | + |
| 248 | +`--runtime-config=admissionregistration.k8s.io/v1beta1=false,apiextensions.k8s.io/v1beta1,...` |
| 249 | + |
| 250 | +### Locate use of deprecated APIs |
| 251 | + |
| 252 | +Use [client warnings, metrics, and audit information available in 1.19+](https://kubernetes.io/blog/2020/09/03/warnings/#deprecation-warnings) |
| 253 | +to locate use of deprecated APIs. |
| 254 | + |
| 255 | +### Migrate to non-deprecated APIs |
| 256 | + |
| 257 | +* Update custom integrations and controllers to call the non-deprecated APIs |
| 258 | +* Change YAML files to reference the non-deprecated APIs |
| 259 | + |
| 260 | + You can use the `kubectl-convert` command (`kubectl convert` prior to v1.20) |
| 261 | + to automatically convert an existing object: |
| 262 | + |
| 263 | + `kubectl-convert -f <file> --output-version <group>/<version>`. |
| 264 | + |
| 265 | + For example, to convert an older Deployment to `apps/v1`, you can run: |
| 266 | + |
| 267 | + `kubectl-convert -f ./my-deployment.yaml --output-version apps/v1` |
| 268 | + |
| 269 | + Note that this may use non-ideal default values. To learn more about a specific |
| 270 | + resource, check the Kubernetes [API reference](/docs/reference/kubernetes-api/). |
0 commit comments