Kube No Trouble (kubent) with GKE 測試小記
GKE
1.25.7-gke.1000
1.23.16-gke.1400
OS: openSUSE Leap 15.4
Helm: 3.11.2
kubent: 0.7.0
今天來測試 kubent ( Kube No Trouble )
功能 Easily check your clusters for use of deprecated APIs
這個在社群上看到朋友分享的, 會想測試這個是因為 Kubernetes 版本畢竟不像一般的 Linux OS, 也許會有比較長的維護期間, 版本的更替速度相對的快, 所以在升級之前就要檢查有沒有棄用停止的 API.
首先到 kubent 的 Github 頁面看說明
他上面的安裝是使用 sh -c "$(curl -sSL https://git.io/install-kubent)"
但是我實際使用的時候有錯誤, 所以我是直接去抓程式下來執行
下載 kubent-0.7.0-linux-amd64.tar.gz
解壓縮檔案
> tar zxvf kubent-0.7.0-linux-amd64.tar.gz
kubent
觀察檔案
> ls
kubent kubent-0.7.0-linux-amd64.tar.gz
使用方法很簡單, 如果你現在已經有 Kubernetes 的 cluster, 直接執行就可以
我先以之前測試的 GKE 1.23.16-gke.1400 版本為例
> ./kubent
11:16AM INF >>> Kube No Trouble `kubent` <<<
11:16AM INF version 0.7.0 (git sha d1bb4e5fd6550b533b2013671aa8419d923ee042)
11:16AM INF Initializing collectors and retrieving data
11:16AM INF Target K8s version is 1.23.16-gke.1400
11:16AM INF Retrieved 117 resources from collector name=Cluster
11:16AM INF Retrieved 0 resources from collector name="Helm v3"
11:16AM INF Loaded ruleset name=custom.rego.tmpl
11:16AM INF Loaded ruleset name=deprecated-1-16.rego
11:16AM INF Loaded ruleset name=deprecated-1-22.rego
11:16AM INF Loaded ruleset name=deprecated-1-25.rego
11:16AM INF Loaded ruleset name=deprecated-1-26.rego
11:16AM INF Loaded ruleset name=deprecated-future.rego
__________________________________________________________________________________________
>>> Deprecated APIs removed in 1.22 <<<
------------------------------------------------------------------------------------------
KIND NAMESPACE NAME API_VERSION REPLACE_WITH (SINCE)
CustomResourceDefinition <undefined> capacityrequests.internal.autoscaling.k8s.io apiextensions.k8s.io/v1beta1 apiextensions.k8s.io/v1 (1.16.0)
CustomResourceDefinition <undefined> scalingpolicies.scalingpolicy.kope.io apiextensions.k8s.io/v1beta1 apiextensions.k8s.io/v1 (1.16.0)
__________________________________________________________________________________________
>>> Deprecated APIs removed in 1.25 <<<
------------------------------------------------------------------------------------------
KIND NAMESPACE NAME API_VERSION REPLACE_WITH (SINCE)
PodSecurityPolicy <undefined> gce.gke-metrics-agent policy/v1beta1 <removed> (1.21.0)
再來測試現在測試的 GKE 1.25.7-gke.1000
> ./kubent
11:14AM INF >>> Kube No Trouble `kubent` <<<
11:14AM INF version 0.7.0 (git sha d1bb4e5fd6550b533b2013671aa8419d923ee042)
11:14AM INF Initializing collectors and retrieving data
11:14AM INF Target K8s version is 1.25.7-gke.1000
11:15AM INF Retrieved 0 resources from collector name=Cluster
11:15AM INF Retrieved 0 resources from collector name="Helm v3"
11:15AM INF Loaded ruleset name=custom.rego.tmpl
11:15AM INF Loaded ruleset name=deprecated-1-16.rego
11:15AM INF Loaded ruleset name=deprecated-1-22.rego
11:15AM INF Loaded ruleset name=deprecated-1-25.rego
11:15AM INF Loaded ruleset name=deprecated-1-26.rego
11:15AM INF Loaded ruleset name=deprecated-future.rego
這邊就沒有出現 Deprecated API :)
他也有容器的版本, 但是我覺得不需要, 實際上測試容器版本的 kubent 也有權限的問題要調整, 所以直接下載執行應該就可以了
紀錄一下
~ enjoy it
References
沒有留言:
張貼留言