Kubent 介绍
Kubent 全称Kube No Trouble是一个简单的工具,主要用于检查k8s集群中是否使用废弃的API版本
Kubent工具可以根据部署资源的进行检测,检测已弃用的API,
特别支持以下方式进行检测:
Kubent 安装
可以手动去GitHub上下载
https://github.com/doitintl/kube-no-trouble/releases/latest
我这里将kubent下载到我下载服务器上 (随着文章时间以及版本更新,不确保为最新版)
[root@k8s-01 tmp]# wget https://d.frps.cn/file/tools/kubent/kubent-0.5.1-linux-amd64.tar.gz [root@k8s-01 tmp]# tar xf kubent-0.5.1-linux-amd64.tar.gz [root@k8s-01 tmp]# mv kubent /usr/local/bin/
使用方法
kubent需要通过config文件,读取k8s集群信息。如果我们/root/.kube/config中包含多个集群信息,可以通过-k参数指定配置文件。否则默认读取config文件
[root@k8s-01 tmp]# kubent -k /root/.kube/config_abcdocker 12:57AM INF >>> Kube No Trouble `kubent` <<< 12:57AM INF version 0.5.1 (git sha a762ff3c6b5622650b86dc982652843cc2bd123c) 12:57AM INF Initializing collectors and retrieving data 12:57AM INF Target K8s version is 1.23.5 12:57AM INF Retrieved 35 resources from collector name=Cluster 12:57AM INF Retrieved 0 resources from collector name="Helm v2" 12:57AM INF Retrieved 150 resources from collector name="Helm v3" 12:57AM INF Loaded ruleset name=custom.rego.tmpl 12:57AM INF Loaded ruleset name=deprecated-1-16.rego 12:57AM INF Loaded ruleset name=deprecated-1-22.rego 12:57AM INF Loaded ruleset name=deprecated-1-25.rego __________________________________________________________________________________________ >>> Deprecated APIs removed in 1.25 <<< ------------------------------------------------------------------------------------------ KIND NAMESPACE NAME API_VERSION REPLACE_WITH (SINCE) PodSecurityPolicy <undefined> psp.flannel.unprivileged policy/v1beta1 <removed> (1.21.0) PodSecurityPolicy cattle-monitoring-system rancher-monitoring-alertmanager policy/v1beta1 <removed> (1.21.0) PodSecurityPolicy cattle-monitoring-system rancher-monitoring-crd-manager policy/v1beta1 <removed> (1.21.0) PodSecurityPolicy cattle-monitoring-system rancher-monitoring-grafana policy/v1beta1 <removed> (1.21.0) PodSecurityPolicy cattle-monitoring-system rancher-monitoring-kube-state-metrics policy/v1beta1 <removed> (1.21.0) PodSecurityPolicy cattle-monitoring-system rancher-monitoring-operator policy/v1beta1 <removed> (1.21.0) PodSecurityPolicy cattle-monitoring-system rancher-monitoring-patch-sa policy/v1beta1 <removed> (1.21.0) PodSecurityPolicy cattle-monitoring-system rancher-monitoring-prometheus policy/v1beta1 <removed> (1.21.0) PodSecurityPolicy cattle-monitoring-system rancher-monitoring-prometheus-adapter policy/v1beta1 <removed> (1.21.0) PodSecurityPolicy cattle-monitoring-system rancher-monitoring-prometheus-node-exporter policy/v1beta1 <removed> (1.21.0)
Deprecated APIs removed in 1.25下面就会显示当前k8s集群中已经废弃的apiserver
更多kubent命令
$./kubent -h Usage of ./kubent: -a, --additional-kind strings additional kinds of resources to report in Kind.version.group.com format -c, --cluster enable Cluster collector (default true) -x, --context string kubeconfig context -e, --exit-error exit with non-zero code when issues are found -f, --filename strings manifests to check, use - for stdin --helm2 enable Helm v2 collector (default true) --helm3 enable Helm v3 collector (default true) -k, --kubeconfig string path to the kubeconfig file -l, --log-level string set log level (trace, debug, info, warn, error, fatal, panic, disabled) (default "info") -o, --output string output format - [text|json] (default "text") -t, --target-version string target K8s version in SemVer format (autodetected by default) -v, --version prints the version of kubent and exits
github地址https://github.com/doitintl/kube-no-trouble
相关文章:
- Kubernetes 1.14 二进制集群安装
- Kubenetes 1.13.5 集群二进制安装
- Kuerbernetes 1.11 集群二进制安装
- CentOS 7 ETCD集群配置大全