Skip to main content

☑️ Prevent use of removed APIs in Kubernetes v1.23

Kubernetes version 1.23 stopped serving several APIs for different resource types.
When deploying a resource with a removed API version, the Kubernetes engine will reject it.

The following resources are removed in version 1.23:

API versionResource kind
rbac.authorization.k8s.io/v1alpha1All
scheduling.k8s.io/v1alpha1All

Targeted objects by this rule (types of kind): (See table above)

Complexity: easy (What does this mean?)

Policy as code identifier: K8S_REMOVED_APIVERSION_1.23


This rule will fail

If one of the removed API versions is used:

apiVersion: rbac.authorization.k8s.io/v1alpha1
kind: Role

Rule output in the CLI

$ datree test *.yaml

>> File: failExample.yaml
❌ Prevent use of removed APIs in Kubernetes v1.23 [1 occurrence]
💡 Incorrect value for key `apiVersion` - the version of the resource you are trying to use is removed in k8s v1.23

How to fix this failure

Use a supported API version instead of the removed one:

Removed API versionSupported API version
rbac.authorization.k8s.io/v1alpha1rbac.authorization.k8s.io/v1
scheduling.k8s.io/v1alpha1scheduling.k8s.io/v1

Example:

apiVersion: rbac.authorization.k8s.io/v1
kind: Role

Read more