Given that kubernetes frequently deprecates apiVersions, we want to check for the resources with deprecated apiVersions in cluster or files or as a part of Continous Integration pipeline (Github Actions) so that we can update the apiVersion in manifest before the cluster is upgraded.
kube-depre
is a simple CLI tool that allows us to find such deprecated apiVersion in Kubernetes cluster, or in files and as well integrated with github actions to report the Deprecated Apis as a comment on Pull Request.
Supports only Linux and Mac
- Download from the Release
OR
curl -L https://raw.githubusercontent.com/maheshrayas/kube-depre/main/release/install.sh | sh -
kube-depre by default looks for ~/.kube/config
for kuberenetes configuration. If the configuration is stored in other file location, set that location in the KUBECONFIG
environment variable.
export KUBECONFIG={config-location}
kube-depre 0.4.0
USAGE:
kube-depre [OPTIONS]
OPTIONS:
-d, --debug
supply --debug to print the debug information
-f, --file <FILE>
supply -f or --file "Manifest file directory". if -f not supplied, it will by default
query the cluster
-h, --help
Print help information
-o, --output <OUTPUT>
Output format for the list of deprecated APIs [default: table] [possible values: table,
csv, markdown-table]
-t, --target-version <TARGET_VERSION>
list of deprecated APIs in a specific kubernetes version, -t 1.22. If -t not supplied,
it will query for versions : 1.16, 1.22, 1.25, 1.26, 1.27, 1.29, custom
-V, --version
Print version information
# check for list for depreacted Apis in the cluster in K8s 1.22 and output will be printed on terminal
./kube-depre -t 1.22
# check for list for depreacted Apis in the cluster in K8s 1.22 & 1.24 and output will be printed on terminal, it can be outputted to csv as well
./kube-depre -t 1.22,1.24
# check for list for depreacted Apis in the cluster in K8s 1.22 and output will be in csv format
./kube-depre -t 1.22 -o csv
# check for list for depreacted Apis in the cluster for non default K8s Custom resouces, for example: Istio, SecretStoreCSI etc.
./kube-depre -t custom
# check for list for depreacted Apis in the cluster in K8s version 1.16,1.22,1.24,1.25 and output will be in csv format
./kube-depre -o csv
# check for list for depreacted Apis in the supplied file directory in K8s 1.22 and output will be printed on terminal
./kube-depre -t 1.22 -f $(pwd)/tests/data
# check for list for depreacted Apis in the supplied file directory in K8s 1.22 & 1.24 and output will be printed on terminal, it can be outputted to csv as well
./kube-depre -t 1.22,1.24
# check for list for depreacted Apis in the supplied file directory in K8s 1.22 and output will be in csv format
./kube-depre -t 1.22 -o csv -f $(pwd)/tests/data
# check for list for depreacted Apis in the files for non default K8s Kinds or Custom resouces, for example: Istio, SecretStoreCSI etc.
./kube-depre -t custom -o csv -f $(pwd)/tests/data
# check for list for depreacted Apis in the supplied file directory in K8s version 1.16,1.22,1.24,1.25 and output will be in csv format
./kube-depre -o csv -f $(pwd)/tests/data
If you want to add additional kinds(non default), please feel free to PR here
Refer github workflow on how to scan kubernetes manifests in github repo and comment on PR with list of Deprecated APIs.