☑️ Prevent deprecated APIs in Kubernetes v1.16
The v1.16 release stopped serving some API versions for different resource types. When a user deploys a resource with a deprecated API version, the Kubernetes engine rejects it.
caution
Kubernetes v1.16 is no longer (officially) supported since 2 September 2020, So if you are still running this version, consider upgrading it as soon as possible.
Targeted resources by this rule (types of kind
): NetworkPolicy / Deployment / DaemonSet / StatefulSet
Enabled by default? True
Policy as code identifier: K8S_DEPRECATED_APIVERSION_1.16
This rule will fail
If one of the following API versions is used:
- extensions/v1beta1
- apps/v1beta1
- apps/v1beta2
apiVersion: apps/v1beta2
kind: Deployment
Rule output in the CLI
$ datree test *.yaml
>> File: failExample.yaml
❌ Prevent deprecated APIs in Kubernetes v1.16 [1 occurrence]
💡 Incorrect value for key `apiVersion` - the version you are trying to use is not supported by the Kubernetes cluster version (>=1.16)
How to fix this failure
Use apps/v1 instead of the deprecated version
apiVersion: apps/v1
kind: Deployment