☑️ Prevent deprecated APIs in Kubernetes v1.17
The v1.17 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.17 is no longer (officially) supported since 30 January 2021, So if you are still running this version, consider upgrading it as soon as possible.
Targeted objects by this rule (types of kind
): NetworkPolicy / Deployment / DaemonSet / StatefulSet
Complexity: easy (What does this mean?)
Policy as code identifier: K8S_DEPRECATED_APIVERSION_1.17
This rule will fail
If one of the following API versions is used:
- kubeadm.k8s.io/v1beta1
- rbac.authorization.k8s.io/v1alpha1
- rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1alpha1
kind: ClusterRoleBinding
Rule output in the CLI
$ datree test *.yaml
>> File: failExample.yaml
❌ Prevent deprecated APIs in Kubernetes v1.17 [1 occurrence]
💡 Incorrect value for key `apiVersion` - the version you are trying to use is not supported by the Kubernetes cluster version (>=1.17)
How to fix this failure
Use v1 instead of the deprecated version
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding