Skip to main content

☑️ Prevent use of deprecated APIs in Kubernetes v1.24

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

The following resources are deprecated in version 1.24:

API versionResource kind
storage.k8s.io/v1beta1CSIStorageCapacity
flowcontrol.apiserver.k8s.io/v1beta2FlowSchema, PriorityLevelConfiguration
flowcontrol.apiserver.k8s.io/v1beta1FlowSchema, PriorityLevelConfiguration

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

Complexity: easy (What does this mean?)

Policy as code identifier: K8S_DEPRECATED_APIVERSION_1.24


This rule will fail​

If one of the deprecated API versions is used for a resource:

apiVersion: storage.k8s.io/v1beta1
kind: CSIStorageCapacity

Rule output in the CLI​

$ datree test *.yaml

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

How to fix this failure​

Use a supported API version instead of the deprecated one:

Deprecated API versionSupported API version
storage.k8s.io/v1beta1storage.k8s.io/v1
flowcontrol.apiserver.k8s.io/v1beta2flowcontrol.apiserver.k8s.io/v1beta3
flowcontrol.apiserver.k8s.io/v1beta1flowcontrol.apiserver.k8s.io/v1beta3

Example:

apiVersion: storage.k8s.io/v1
kind: CSIStorageCapacity

Read more​