ここ最近、kubectl pluginを全然ウォッチしておらず、ふと何か増えてるかなーとkrewのpluginのページを見ると、2022/6/29時点でpluginの数が194となっていた。
自分が以前見たときから随分増えていたので、どういうものが増えたのかを調べるついでに流行りとか面白そうなもの、kubernetesを便利に使えるものがないかを調べて、ついでに触ってみたときのメモ。
前提知識
kubectl pluginを知らない人向けに、pluginとそのpackage managerであるkrewの説明をしておく。知ってる人は飛ばしてください。
kubectl pluginとは
kubectlにサブコマンドを追加する仕組みで、
kubectl hogehoge
のようにkubectlに本来存在しないサブコマンドを追加し、機能拡張することが出来る。
実は作成は非常に簡単で、環境変数のPATH
が通っているところに、kubectl-<name>
を置けばpluginとして認識される。
以下完全に余談となるが、せっかくなので試してみる。$HOME/bin
にPATH
が通っていることを前提とする。
PLUGIN_HOGEHOGE=~/bin/kubectl-hogehoge
cat << EOF > $PLUGIN_HOGEHOGE
#!/bin/bash
echo "fugafuga"
EOF
chmod +x $PLUGIN_HOGEHOGE
これでkubectl pluginは作成できた。さっそく動かしてみる。
$ kubectl hogehoge
fugafuga
上手く動いた。
krewとは
pluginがあるのは分かっても、世に散らばって存在しているpluginをかき集めて使うのはなかなか難しい。
そのため、aptやyumのように、kubectl pluginでもPackage Managerが提供されている。
それがkrewである。
今回、krewベースでpluginの流行りを確認するため、初めてkrewを使う方はインストール手順に従ってインストールしておくこと。
あと、kubectl pluginは非常に便利なので、環境を作り直すことが多い人は自動でインストールするようスクリプト化等しておくのを推奨する。
インストールに成功し、search
のサブコマンドを渡して実行すると以下のように利用可能なpluginの一覧が取得できる。
$ kubectl krew search
NAME DESCRIPTION INSTALLED
access-matrix Show an RBAC access matrix for server resources no
accurate Manage Accurate, a multi-tenancy controller no
advise-policy Suggests PodSecurityPolicies and OPA Policies f... no
advise-psp Suggests PodSecurityPolicies for cluster. no
allctx Run commands on contexts in your kubeconfig no
:(省略)
ちなみに他のサブコマンドで覚えておくとよいものとしてlistがある。実行すると、以下のようにインストールしているpluginの一覧が表示される。
$ kubectl krew list
PLUGIN VERSION
cluster-group v0.1.4
images v0.3.2
krew v0.4.1
neat v2.0.3
node-shell v1.5.3
tree v0.4.0
view-secret v0.8.1
kubectl pluginの流行り
pluginの一覧はkubectl krew search
で確認できるが、どれが流行っているかはコマンドでは分からない。
そこで、krewのWebサイトで、利用可能なPlugin一覧を公開しているページを覗いてみると、
このように、plugin名と説明、Repositoryへのリンクだけでなく、starの数が分かるようになっている。(ソートは出来ないけど)
今回は、こちらのstarの数を元に、kubectl plugin Star数Top10を作っていきたいと思う。
Star数ランキングTop10
6/29時点でのランキングはこちら。なお、starの単位がkで丸められているものは、そのまま x1000 で計算している。
全体で194個のpluginが記載されており、starが公開されているものが187個あったため、187個の中でのランキングとなる。
以下がTop10となる。
順位 | Name | Description | Stars |
---|---|---|---|
1 | ctx | Switch between contexts in your kubeconfig | 13000 |
1 | ingress-nginx | Interact with ingress-nginx | 13000 |
1 | ns | Switch between Kubernetes namespaces | 13000 |
4 | cert-manager | Manage cert-manager resources inside your cluster | 9000 |
5 | krew | Package manager for kubectl plugins. | 4900 |
6 | popeye | Scans your clusters for potential resource issues | 3500 |
7 | kyverno | Kyverno is a policy engine for kubernetes | 2600 |
8 | flyte | Monitor, launch and manage flyte executions | 2400 |
9 | karmada | Manage clusters with Karmada federation. | 2300 |
9 | sniff | Start a remote packet capture on pods using tcpdump and wireshark | 2300 |
個人的には結構意外な結果となった。neatとか上位に来るんじゃないかと思っていたのだが。treeもランク外。
以降でそれぞれどんなものかを見ていきたい。なお、全194pluginでのランキングは最後に付録として載せている。
1位:ctx
いわずも知れたkubectx。コンテキストの切り替えで大活躍するコマンドだが、pluginの方を使っている人が多いことを初めてしった。
kubectxオフィシャルサイトを見ると、kubectlのインストール手順が先頭で用意されていたので、こちらの手順でインストールした人が多いのかもしれない。
機能紹介
以下のように、コンテキストの切り替えを行う。
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
tkg15-mc-admin@tkg15-mc tkg15-mc tkg15-mc-admin
* tkg15-wc-admin@tkg15-wc tkg15-wc tkg15-wc-admin delme
$ kubectl ctx tkg15-mc-admin@tkg15-mc
Switched to context "tkg15-mc-admin@tkg15-mc".
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* tkg15-mc-admin@tkg15-mc tkg15-mc tkg15-mc-admin
tkg15-wc-admin@tkg15-wc tkg15-wc tkg15-wc-admin delme
実際に使う場合は、以下のようにaliasを張るのがオススメ。
alias kx='kubectl ctx'
あと、fzfがないと、いちいちコンテキストの名前取得や確認の手間が入ってしまうので、fzfもあわせて導入するのをオススメする。
1位:ingress-nginx
同率1位はingress-nginx。ただ、これはpluginの利用としてではなく、Ingress NGINX Controllerとしてのstarの数が多いだけのような。。。
pluginとしては、ingress-nginxのcontrollerを検査するためのもののようだ。
機能紹介
サブコマンドとしては以下が用意されている。
Available Commands:
backends Inspect the dynamic backend information of an ingress-nginx instance
certs Output the certificate data stored in an ingress-nginx pod
conf Inspect the generated nginx.conf
exec Execute a command inside an ingress-nginx pod
general Inspect the other dynamic ingress-nginx information
help Help about any command
info Show information about the ingress-nginx service
ingresses Provide a short summary of all of the ingress definitions
lint Inspect kubernetes resources for possible issues
logs Get the kubernetes logs for an ingress-nginx pod
ssh ssh into a running ingress-nginx pod
正直言って微妙なものが多い気がする。logsとかexecとかsshとかkubectlだけでいいのでは?
そうは言ってもせっかくなので、とりあえず試してみる。
普段IngressControllerはcontourかalb-ingressしか使わないので、Ingress NGINX Controllerをインストールする。
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.2.0/deploy/static/provider/cloud/deploy.yaml
動作確認用に、適当にnginxをnginx-ingressで公開する。
kubectl run --image nginx nginx-pod
kubectl expose pod nginx-pod --port 80
kubectl create ingress nginx-test --class nginx --rule="foo.com/=nginx-pod:80"
試しにbackendsコマンドで、先程作ったnginxのingressの情報が取れているか見てみる。
k ingress-nginx -n ingress-nginx backends
[
{
"name": "default-nginx-pod-80",
"service": {
"metadata": {
"creationTimestamp": null
},
"spec": {},
"status": {
"loadBalancer": {}
}
},
:(省略)
なんか取れてはいるが、あまり有用そうな感じではなかった。。。
ingress-nginx pluginを活用されている方、こういう場面に使えるよ、というのがあればコメント頂けると有り難いです。
(config見れるのは少し良さそうだった)
1位:ns
こちらは先程紹介したkubectxと兄弟みたいなもので、恐らくkubectxを使っている人はセットで使っているんじゃないかと思う。こちらはNamespaceの切り替えを容易にするplugin。
機能紹介
以下のように、Namespaceの切り替えを行う。
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
tkg15-mc-admin@tkg15-mc tkg15-mc tkg15-mc-admin
* tkg15-wc-admin@tkg15-wc tkg15-wc tkg15-wc-admin delme
$ kubectl ns kube-system
Switched to context "tkg15-mc-admin@tkg15-mc".
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
tkg15-mc-admin@tkg15-mc tkg15-mc tkg15-mc-admin
* tkg15-wc-admin@tkg15-wc tkg15-wc tkg15-wc-admin kube-system
こちらもkubectxの時と同じようにaliasを張るのとfzfと併せて使うのがオススメ。
ただし、Knative触っている人はknコマンドとaliasがバッティングするため、alias名は気をつけた方がよい。
4位:cert-manager
4位はstarの数のcert-manager。ただこれもingress-nginxと同じで、pluginとしてではなく、cert-manager自体のstarの数で4位となっていると思われる。
機能紹介
cert-manager自体の説明を超簡単にしておくと、kubernetes上でTLSの証明書の管理を楽にするためのツールである。
証明書の発行や更新などを自動でやってくれるため、httpsで公開するサービスなどを作る場合はかなり使えるツールである(でも、EKSでACM使う時とかはACMで良さそう)。
cert-managerのサブコマンドは以下がある。
Available Commands:
approve Approve a CertificateRequest
check Check cert-manager components
convert Convert cert-manager config files between different API versions
create Create cert-manager resources
deny Deny a CertificateRequest
experimental Interact with experimental features
help Help about any command
inspect Get details on certificate related resources
renew Mark a Certificate for manual renewal
status Get details on current status of cert-manager resources
upgrade Tools that assist in upgrading cert-manager
version Print the cert-manager CLI version and the deployed cert-manager version
恐らくリソースの作成から更新まで幅広く出来そうだが、今回は味見なので、とりあえずinspectを実行し、証明書の内容が取得できるか試してみる。
$ kubectl cert-manager inspect -n tanzu-system-registry secret harbor-tls
Valid for:
DNS Names:
- harbor.tkg
- notary.harbor.tkg
URIs: <none>
IP Addresses: <none>
Email Addresses: <none>
Usages:
- server auth
- client auth
Validity period:
Not Before: Mon, 23 May 2022 05:25:52 UTC
Not After: Thu, 20 May 2032 05:25:52 UTC
Issued By:
Common Name: Harbor CA
Organization: Harbor CA
:(省略)
これがないと、Secretをデコードした上でopensslコマンドなどで読み取る必要があるため、かなり便利。
5位:krew
5位はkrew。RHELで使われているパッケージランキングにrpmとかyumが入っているのと同じような違和感が。。。
機能紹介
前述のように、kubectl pluginを管理するパッケージマネージャであり、サブコマンドは以下ような導入・削除およびライフサイクル管理のようになっている。
Available Commands:
completion generate the autocompletion script for the specified shell
help Help about any command
index Manage custom plugin indexes
info Show information about an available plugin
install Install kubectl plugins
list List installed kubectl plugins
search Discover kubectl plugins
uninstall Uninstall plugins
update Update the local copy of the plugin index
upgrade Upgrade installed plugins to newer versions
version Show krew version and diagnostics
小ネタとして、completionが少し豪華。
Available Commands:
bash generate the autocompletion script for bash
fish generate the autocompletion script for fish
powershell generate the autocompletion script for powershell
zsh generate the autocompletion script for zsh
6位:popeye
6位はクラスタの健全性チェックのpopeyeがランクイン。こちらもpluginというよりコマンドがメジャーなイメージがある。
機能紹介
クラスタの状態について、大体以下のような観点で指摘をしてくれる。
- クラスタに繋げられるか
- Kubernetesのバージョンが古くないか
- 不必要なRole、ClusterRoleがないか
- 不必要なConfigMapはないか
- Podで使ってるイメージはタグなしだったりしないか
- Podで使っているServiceAccountは適切か
最後にスコアも出してくれる。
以下、実施例。
$ kubectl popeye
___ ___ _____ _____ K .-'-.
| _ \___| _ \ __\ \ / / __| 8 __| `\
| _/ _ \ _/ _| \ V /| _| s `-,-`--._ `\
|_| \___/_| |___| |_| |___| [] .->' a `|-'
Biffs`em and Buffs`em! `=/ (__/_ /
\_, ` _)
`----; |
GENERAL [TKG15-WC]
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
· Connectivity...................................................................................✅
· MetricServer...................................................................................✅
:(省略)
SUMMARY
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
Your cluster score: 90 -- A
o .-'-.
o __| A `\
o `-,-`--._ `\
[] .->' a `|-'
`=/ (__/_ /
\_, ` _)
`----; |
運用時の簡易チェッカーとしては優秀なので、特に運用する側の人は試してみると良いと思う。
7位:kyverno
7位はKyvernoで、所謂k8sのポリシーエンジン。これもingress-nginxと同じでpluginとしてのstar数ではなく、kyvernoそのもののstar数と見た方がよい。
機能紹介
kubernetesを使いやすくするpluginではなく、kyvernoそのものを操作するpluginであり、趣旨から大分外れるため、しぶしぶ割愛。
コマンドについてはオフィシャルサイトのCLIの説明が参考になると思う。
8位:flyte
8位はFlyteというワークフローエンジンのplugin。多分これもPluginに対するstarでの数ではなく(以下略
機能紹介
ごめんなさい。これもkyvernoと同じく、今回の趣旨から離れるので割愛。
9位:karmada
9位はkarmadaというマルチクラスタ管理ツールのplugin。karmadaはCNCFのsandboxプロジェクトにもなっている模様。でもQiitaで記事を書いている人が誰もいない。。。
機能紹介
事前準備として、karmadaをインストールする。
なお、スクリプト内でdocker, go, kindを実行しているので、それぞれ用意しておく。また、docker daemonも起動しておく必要がある。
git clone https://github.com/karmada-io/karmada /tmp/karmada
cd /tmp/karmada/
./hack/local-up-karmada.sh
このスクリプトが完了すると、4つのクラスタ(karmada-host,member1,member2,member3)がkindで起動する。
なお、走り切るまで10分以上かかるので、気長に待つこと。
あと余談だが、構築完了時のロゴが壮大。
------------------------------------------------------------------------------------------------------
█████ ████ █████████ ███████████ ██████ ██████ █████████ ██████████ █████████
░░███ ███░ ███░░░░░███ ░░███░░░░░███ ░░██████ ██████ ███░░░░░███ ░░███░░░░███ ███░░░░░███
░███ ███ ░███ ░███ ░███ ░███ ░███░█████░███ ░███ ░███ ░███ ░░███ ░███ ░███
░███████ ░███████████ ░██████████ ░███░░███ ░███ ░███████████ ░███ ░███ ░███████████
░███░░███ ░███░░░░░███ ░███░░░░░███ ░███ ░░░ ░███ ░███░░░░░███ ░███ ░███ ░███░░░░░███
░███ ░░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ███ ░███ ░███
█████ ░░████ █████ █████ █████ █████ █████ █████ █████ █████ ██████████ █████ █████
░░░░░ ░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░░ ░░░░░ ░░░░░
------------------------------------------------------------------------------------------------------
構築後、KUBECONFIGを切り替える必要がある。
# ControlPlane
export KUBECONFIG=$HOME/.kube/karmada.config
# Member
export KUBECONFIG=$HOME/.kube/members.config
せっかくなので、少し味見してみる。
$ export KUBECONFIG=$HOME/.kube/karmada.config
$ kubectl api-resources | grep Cluster -w
clusters cluster.karmada.io/v1alpha1 false Cluster
$ kubectl get cluster
NAME VERSION MODE READY AGE
member1 v1.23.4 Push True 9m42s
member2 v1.23.4 Push True 9m34s
member3 v1.23.4 Pull True 8m46s
このように、kind: Cluster
はあるものの、CAPIではなく独自のリソースとなっている。
味見が終わったら、さっそくkarmada pluginを試していく。
karmada pluginで利用できるサブコマンドは以下。
Available Commands:
completion Generate the autocompletion script for the specified shell
cordon Mark cluster as unschedulable
deinit removes Karmada from Kubernetes
describe Show details of a specific resource or group of resources in a cluster
exec Execute a command in a container in a cluster
get Display one or many resources
help Help about any command
init install karmada in kubernetes.
join Register a cluster to control plane
logs Print the logs for a container in a pod in a cluster
promote Promote resources from legacy clusters to karmada control plane.
taint Update the taints on one or more clusters.
uncordon Mark cluster as schedulable
unjoin Remove the registration of a cluster from control plane
version Print the version information.
karmadaの管理しているクラスタのノード一覧を取得してみる。
$ kubectl karmada get node
NAME CLUSTER STATUS ROLES AGE VERSION ADOPTION
member1-control-plane member1 Ready control-plane,master 67m v1.23.4 N
member2-control-plane member2 Ready control-plane,master 67m v1.23.4 N
member3-control-plane member3 Ready control-plane,master 67m v1.23.4 N
CLUSTER
の項目から、複数のクラスタのノードをまとめて取得できていることが分かる。
せっかくなのでもう少し遊んでみる。karmadaのcontrol planeはworker nodeを持たず、例えばDeploymentをdeployしても、どこにもPodは起動されない。
$ kubectl get node
No resources found
10.206.213.69 21:34:20 ⎈ karmada-apiserver tkg oss /tmp/karmada $
$ kubectl get deploy
NAME READY UP-TO-DATE AVAILABLE AGE
nginx 0/2 0 0 14s
ただし、Control Planeにデプロイされたリソースを登録している各クラスタにデプロイし直すことが出来る。リポジトリに置いてあるサンプルは以下となる。
apiVersion: policy.karmada.io/v1alpha1
kind: PropagationPolicy
metadata:
name: nginx-propagation
spec:
resourceSelectors:
- apiVersion: apps/v1
kind: Deployment
name: nginx
placement:
clusterAffinity:
clusterNames:
- member1
- member2
replicaScheduling:
replicaDivisionPreference: Weighted
replicaSchedulingType: Divided
weightPreference:
staticWeightList:
- targetCluster:
clusterNames:
- member1
weight: 1
- targetCluster:
clusterNames:
- member2
weight: 1
clusterAffinityでデプロイ先のクラスタを指定している。
これにより、ControlPlaneにデプロイしたDeploymentをmember1, member2にだけデプロイする。
使ってみる。
kubectl apply -f samples/nginx/propagationpolicy.yaml
apply後、pluginの出番となる。kubectlでは当たり前だがコンテキストが異なるのでpodは取得できないが、karmada pluginがあればコンテキストの切り替えなしで確認できる。
$ kubectl get pod
No resources found in default namespace.
$ kubectl karmada get pod
NAME CLUSTER READY STATUS RESTARTS AGE
nginx-85b98978db-k7fhz member2 0/1 ErrImagePull 0 45s
nginx-85b98978db-gp464 member1 0/1 ErrImagePull 0 45s
※pullに失敗しているのは、dockerhubの429のアレのせい。
実際にコンテキストを切り替えて確認した結果は以下となる。
$ export KUBECONFIG=$HOME/.kube/members.config
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
member1 kind-member1 kind-member1
member2 kind-member2 kind-member2
* member3 kind-member3 kind-member3
$ kubectl get pod
No resources found in default namespace.
$ kubectx member2
Switched to context "member2".
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-85b98978db-k7fhz 0/1 ErrImagePull 0 3m37s
CAPIとは違って、リソースをクラスタ跨ぎで管理できるのは非常に面白いし、pluginもkarmadaを使う際には非常に便利だと言える。
9位:sniff
同率9位のsniff(ksniff)は純粋なkubectl pluginとしてstarを稼いだpluginだ。sniffとは盗聴とか傍受の意味で、言葉通りスニッフィングをするためのpluginである。
以下、オフィシャルサイトの説明文を翻訳したものとなる。
ksniffはkubectlを使用して、静的にコンパイルされたtcpdumpバイナリをPodにアップロードし、その出力をローカルのWiresharkにリダイレクトして、スムーズなネットワークデバッグ体験を提供します。
このように、ローカル(正確にはPATH
で引ける範囲)にwiresharkが入っている必要がある(tsharkはNG)。ただし、-oオプションを使って出力先を変更することでwiresharkなしでも使うことが出来る。
機能紹介
機能を試す前に、前準備としてnginxとcentosのPodを起動し、nginxにアクセスしやすいようexposeもしておく。
kubectl run --image nginx nginx-pod
kubectl run --image centos centos-pod --command -- sleep 365d
kubectl expose pod nginx-pod --port 80
nginxに対してtcpdumpを仕込む。
$ kubectl sniff nginx-pod -o ./test.cap
INFO[0000] using tcpdump path at: '/home/tkg/.krew/store/sniff/v1.6.2/static-tcpdump'
INFO[0000] no container specified, taking first container we found in pod.
INFO[0000] selected container: 'nginx-pod'
INFO[0000] sniffing method: upload static tcpdump
INFO[0000] sniffing on pod: 'nginx-pod' [namespace: 'default', container: 'nginx-pod', filter: '', interface: 'any']
INFO[0000] uploading static tcpdump binary from: '/home/tkg/.krew/store/sniff/v1.6.2/static-tcpdump' to: '/tmp/static-tcpdump'
INFO[0000] uploading file: '/home/tkg/.krew/store/sniff/v1.6.2/static-tcpdump' to '/tmp/static-tcpdump' on container: 'nginx-pod'
INFO[0000] executing command: '[/bin/sh -c test -f /tmp/static-tcpdump]' on container: 'nginx-pod', pod: 'nginx-pod', namespace: 'default'
INFO[0000] command: '[/bin/sh -c test -f /tmp/static-tcpdump]' executing successfully exitCode: '0', stdErr :''
INFO[0000] file found: ''
INFO[0000] file was already found on remote pod
INFO[0000] tcpdump uploaded successfully
INFO[0000] output file option specified, storing output in: './test.cap'
INFO[0000] start sniffing on remote container
INFO[0000] executing command: '[/tmp/static-tcpdump -i any -U -w - ]' on container: 'nginx-pod', pod: 'nginx-pod', namespace: 'default'
Pod内の/tmpにtcpdumpをコピーし、tcpdumpを実行しているのが分かる。
この状態で、centos-podからcurlしてみる。
$ kubectl exec -it centos-pod -- curl nginx-pod:80
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
次に、sniffを実行していたkubectlを止めて、キャプチャしたデータを見てみる。
なお、100.96.1.116はcentos-podのIPである。
$ tshark -r ./test.cap | grep 100.96.1.116 | tail
20 153.916412 100.96.1.116 → 100.96.1.114 TCP 68 59202 → 80 [ACK] Seq=1 Ack=1 Win=64896 Len=0 TSval=1732907482 TSecr=4161453560
21 153.917405 100.96.1.116 → 100.96.1.114 HTTP 141 GET / HTTP/1.1
22 153.917419 100.96.1.114 → 100.96.1.116 TCP 68 80 → 59202 [ACK] Seq=1 Ack=74 Win=64256 Len=0 TSval=4161453562 TSecr=1732907483
23 153.923356 100.96.1.114 → 100.96.1.116 TCP 306 HTTP/1.1 200 OK [TCP segment of a reassembled PDU]
24 153.923462 100.96.1.116 → 100.96.1.114 TCP 68 59202 → 80 [ACK] Seq=74 Ack=239 Win=64768 Len=0 TSval=1732907489 TSecr=4161453568
25 153.923891 100.96.1.114 → 100.96.1.116 HTTP 683 HTTP/1.1 200 OK (text/html)
26 153.923951 100.96.1.116 → 100.96.1.114 TCP 68 59202 → 80 [ACK] Seq=74 Ack=854 Win=64256 Len=0 TSval=1732907490 TSecr=4161453569
27 153.924489 100.96.1.116 → 100.96.1.114 TCP 68 59202 → 80 [FIN, ACK] Seq=74 Ack=854 Win=64256 Len=0 TSval=1732907490 TSecr=4161453569
28 153.925214 100.96.1.114 → 100.96.1.116 TCP 68 80 → 59202 [FIN, ACK] Seq=854 Ack=75 Win=64256 Len=0 TSval=4161453570 TSecr=1732907490
29 153.925282 100.96.1.116 → 100.96.1.114 TCP 68 59202 → 80 [ACK] Seq=75 Ack=855 Win=64256 Len=0 TSval=1732907491 TSecr=4161453570
キャプチャ出来ていることが分かる。めっちゃ便利。
感想
有名OSSが提供しているpluginが上位の半分くらいになってしまったため、万人向けのpluginがあまり紹介できなかった点は残念。
次回はkubectl pluginに特化したプロジェクトに絞ってランキングを作ってみたいと思う。
あと、karmadaは楽しかった。
付録:全187個の完全ランキング
Starの数でソートしたものを貼っておきます。
Name | Description | Stars |
---|---|---|
ctx | Switch between contexts in your kubeconfig | 13000 |
ingress-nginx | Interact with ingress-nginx | 13000 |
ns | Switch between Kubernetes namespaces | 13000 |
cert-manager | Manage cert-manager resources inside your cluster | 9000 |
krew | Package manager for kubectl plugins. | 4900 |
popeye | Scans your clusters for potential resource issues | 3500 |
kyverno | Kyverno is a policy engine for kubernetes | 2600 |
flyte | Monitor, launch and manage flyte executions | 2400 |
karmada | Manage clusters with Karmada federation. | 2300 |
sniff | Start a remote packet capture on pods using tcpdump and wireshark | 2300 |
tree | Show a tree of object hierarchies through ownerReferences | 2200 |
score | Kubernetes static code analysis. | 1800 |
trace | Trace Kubernetes pods and nodes with system tools | 1600 |
tail | Stream logs from multiple pods and containers using simple, dynamic source selection. | 1500 |
starboard | Toolkit for finding risks in kubernetes resources | 1200 |
resource-capacity | Provides an overview of resource requests, limits, and utilization | 1100 |
kudo | Declaratively build, install, and run operators using KUDO. | 1000 |
neat | Remove clutter from Kubernetes manifests to make them more readable. | 1000 |
access-matrix | Show an RBAC access matrix for server resources | 967 |
gadget | Gadgets for debugging and introspecting apps | 904 |
oidc-login | Log in to the OpenID Connect provider | 900 |
stern | Multi pod and container log tailing | 869 |
minio | Deploy and manage MinIO Operator and Tenant(s) | 764 |
node-shell | Spawn a root shell on a node via kubectl | 709 |
deprecations | Checks for deprecated objects in a cluster | 707 |
rbac-lookup | Reverse lookup for RBAC | 632 |
who-can | Shows who has RBAC permissions to access Kubernetes resources | 621 |
pv-migrate | Migrate data across persistent volumes | 540 |
flame | Generate CPU flame graphs from pods | 520 |
tunnel | Reverse tunneling between cluster and your machine | 515 |
exec-as | Like kubectl exec, but offers a user flag to exec as root or any other user. |
479 |
prompt | Prompts for user confirmation when executing commands in critical namespaces or clusters, i.e., production. | 479 |
kadalu | Manage Kadalu Operator, CSI and Storage pods | 456 |
rabbitmq | Manage RabbitMQ clusters | 447 |
rbac-tool | Plugin to analyze RBAC permissions and generate policies | 438 |
cost | View cluster cost information | 429 |
kubesec-scan | Scan Kubernetes resources with kubesec.io. | 410 |
get-all | Like kubectl get all but really everything |
407 |
tap | Interactively proxy Kubernetes Services with ease | 383 |
view-allocations | List allocations per resources, nodes, pods. | 324 |
preflight | Executes application preflight tests in a cluster | 323 |
support-bundle | Creates support bundles for off-cluster analysis | 323 |
cnpg | Manage your CloudNativePG clusters | 318 |
advise-psp | Suggests PodSecurityPolicies for cluster. | 314 |
outdated | Finds outdated container images running in a cluster | 290 |
warp | Sync and execute local files in Pod | 281 |
doctor | Scans your cluster and reports anomalies. | 271 |
hns | Manage hierarchical namespaces (part of HNC) | 266 |
ktop | A top tool to display workload metrics | 257 |
konfig | Merge, split or import kubeconfig files | 254 |
rolesum | Summarize RBAC roles for subjects | 246 |
direct-csi | CSI driver to manage drives in k8s cluster as volumes | 244 |
directpv | Deploys and manages the lifecycle of DirectPV CSI driver | 244 |
lineage | Display all dependent resources or resource dependencies | 228 |
df-pv | Show disk usage (like unix df) for persistent volumes | 201 |
graph | Visualize Kubernetes resources and relationships. | 190 |
view-utilization | Shows cluster cpu and memory utilization | 178 |
images | Show container images used in the cluster. | 170 |
reap | Delete unused Kubernetes resources. | 170 |
moco | Interact with MySQL operator MOCO. | 164 |
slice | Split a multi-YAML file into individual files. | 162 |
view-secret | Decode Kubernetes secrets | 151 |
rbac-view | A tool to visualize your RBAC permissions. | 144 |
datadog | Manage the Datadog Operator | 141 |
sudo | Run Kubernetes commands impersonated as group system:masters | 137 |
explore | A better kubectl explain with the fuzzy finder | 132 |
fuzzy | Fuzzy and partial string search for kubectl | 123 |
hlf | Deploy and manage Hyperledger Fabric components | 120 |
ca-cert | Print the PEM CA certificate of the current cluster | 109 |
rm-standalone-pods | Remove all pods without owner references | 109 |
ice | View configuration settings of containers inside Pods | 107 |
iexec | Interactive selection tool for kubectl exec
|
106 |
fleet | Shows config and resources of a fleet of clusters | 105 |
aws-auth | Manage aws-auth ConfigMap | 102 |
promdump | Dumps the head and persistent blocks of Prometheus. | 102 |
ssh-jump | Access nodes or services using SSH jump Pod | 102 |
view-webhook | Visualize your webhook configurations | 99 |
tmux-exec | An exec multiplexer using Tmux | 97 |
open-svc | Open the Kubernetes URL(s) for the specified service in your browser. | 95 |
auth-proxy | Authentication proxy to a pod or service | 88 |
pexec | Execute process with privileges in a pod | 87 |
dds | Detect if workloads are mounting the docker socket | 81 |
grep | Filter Kubernetes resources by matching their names | 79 |
blame | Show who edited resource fields. | 75 |
capture | Triggers a Sysdig capture to troubleshoot the running pod | 75 |
debug-shell | Create pod with interactive kube-shell. | 75 |
gke-credentials | Fetch credentials for GKE clusters | 75 |
node-admin | List nodes and run privileged pod with chroot | 75 |
pod-logs | Display a list of pods to get logs from | 75 |
pod-shell | Display a list of pods to execute a shell in | 75 |
profefe | Gather and manage pprof profiles from running pods | 74 |
status | Show status details of a given resource. | 74 |
node-restart | Restart cluster nodes sequentially and gracefully | 73 |
eds | Interact and manage ExtendedDaemonset resources | 70 |
relay | Drop-in "port-forward" replacement with UDP and hostname resolution. | 68 |
modify-secret | modify secret with implicit base64 translations | 65 |
whoami | Show the subject that's currently authenticated as. | 65 |
operator | Manage operators with Operator Lifecycle Manager | 62 |
spy | pod debugging tool for kubernetes clusters with docker runtimes | 58 |
passman | Store kubeconfig credentials in keychains or password managers | 53 |
sort-manifests | Sort manifest files in a proper order by Kind | 48 |
edit-status | Edit /status subresources of CRs | 46 |
mc | Run kubectl commands against multiple clusters at once | 46 |
kurt | Find what's restarting and why | 45 |
volsync | Manage replication with the VolSync operator | 45 |
fields | Grep resources hierarchy by field name | 44 |
janitor | Lists objects in a problematic state | 44 |
evict-pod | Evicts the given pod | 43 |
sql | Query the cluster via pseudo-SQL | 43 |
view-serviceaccount-kubeconfig | Show a kubeconfig setting to access the apiserver with a specified serviceaccount. | 42 |
pod-dive | Shows a pod's workload tree and info inside a node | 40 |
gs | Handle custom resources with Giant Swarm | 39 |
config-cleanup | Automatically clean up your kubeconfig | 35 |
resource-versions | Print supported API resource versions | 34 |
secretdata | Viewing decoded Secret data with search flags | 34 |
bulk-action | Do bulk actions on Kubernetes resources. | 32 |
snap | Delete half of the pods in a namespace or cluster | 31 |
view-cert | View certificate information stored in secrets | 31 |
socks5-proxy | SOCKS5 proxy to Services or Pods in the cluster | 30 |
example | Prints out example manifest YAMLs | 29 |
gopass | Imports secrets from gopass | 29 |
pvmigrate | Migrates PVs between StorageClasses | 29 |
net-forward | Proxy to arbitrary TCP services on a cluster network | 26 |
pod-inspect | Get all of a pod's details at a glance | 25 |
resource-snapshot | Prints a snapshot of nodes, pods and HPAs resource usage | 25 |
unused-volumes | List unused PVCs | 25 |
apparmor-manager | Manage AppArmor profiles for cluster. | 24 |
restart | Restarts a pod with the given name | 24 |
topology | Explore region topology for nodes or pods | 24 |
assert | Assert Kubernetes resources | 23 |
shovel | Gather diagnostics for .NET Core applications | 23 |
config-registry | Switch between registered kubeconfigs | 22 |
openebs | View and debug OpenEBS storage resources | 22 |
datree | Scan your cluster resources for misconfigurations | 20 |
ipick | A kubectl wrapper for interactive resource selection. | 20 |
np-viewer | Network Policies rules viewer | 20 |
ssm-secret | Import/export secrets from/to AWS SSM param store | 20 |
eksporter | Export resources and removes a pre-defined set of fields for later import | 19 |
exec-cronjob | Run a CronJob immediately as Job | 19 |
prune-unused | Prune unused resources | 19 |
vpa-recommendation | Compare VPA recommendations to actual resources requests | 19 |
whisper-secret | Create secrets with improved privacy | 19 |
rook-ceph | Rook plugin for Ceph management | 18 |
creyaml | Generate custom resource YAML manifest | 17 |
ks | Simple management of KubeSphere components | 17 |
skew | Find if your cluster/kubectl version is skewed | 17 |
azad-proxy | Generate and handle authentication for azad-kube-proxy | 15 |
cilium | Easily interact with Cilium agents. | 15 |
cluster-group | Exec commands across a group of contexts. | 15 |
htpasswd | Create nginx-ingress compatible basic-auth secrets | 15 |
rename-pvc | Rename a PersistentVolumeClaim (PVC) | 15 |
accurate | Manage Accurate, a multi-tenancy controller | 14 |
allctx | Run commands on contexts in your kubeconfig | 14 |
custom-cols | A "kubectl get" replacement with customizable column presets | 14 |
cyclonus | NetworkPolicy analysis tool suite | 14 |
psp-util | Manage Pod Security Policy(PSP) and the related RBACs | 13 |
sick-pods | Find and debug Pods that are "Not Ready" | 13 |
split-yaml | Split YAML output into one file per resource. | 13 |
sshd | Run SSH server in a Pod | 13 |
advise-policy | Suggests PodSecurityPolicies and OPA Policies for cluster. | 12 |
kuota-calc | Calculate needed quota to perform rolling updates. | 12 |
print-env | Build config files from k8s environments. | 12 |
clusternet | Wrap multiple kubectl calls to Clusternet | 11 |
strace | Capture strace logs from a running workload | 11 |
service-tree | Status for ingresses, services, and their backends | 10 |
cm | Provides commands for OCM/MCE/ACM. | 9 |
karbon | Connect to Nutanix Karbon cluster | 9 |
multinet | Shows pods' network-status of multi-net-spec | 9 |
podevents | Show events for pods | 9 |
roll | Rolling restart of all persistent pods in a namespace | 9 |
nsenter | Run shell command in Pod's namespace on the node over SSH connection | 8 |
safe | Prompts before running edit commands | 8 |
viewnode | Displays nodes with their pods and containers and provides metrics for resources | 8 |
bd-xray | Run Black Duck Image Scans | 7 |
realname-diff | Diffs live and local resources ignoring Kustomize hash-suffixes | 7 |
virt | Control KubeVirt virtual machines using virtctl | 7 |
istiolog | Manipulate istio-proxy logging level without istioctl. | 6 |
multiforward | Port Forward to multiple Kubernetes Services | 6 |
emit-event | Emit Kubernetes Events for the requested object | 5 |
log2rbac | Fine-tune your RBAC using log2rbac operator | 5 |
oulogin | Login to a cluster via OpenUnison | 5 |
dtlogin | Login to a cluster via openid-connect | 4 |
ingress-rule | Update Ingress rules via command line | 4 |
linstor | View and manage LINSTOR storage resources | 4 |
match-name | Match names of pods and other API objects | 4 |
change-ns | View or change the current namespace via kubectl. | 3 |
duck | List custom resources with ducktype support | 3 |
kruise | Easily handle OpenKruise workloads | - |
kuttl | Declaratively run and test operators | - |
mtail | Tail logs from multiple pods matching label selector | - |
pod-lens | Show pod-related resources | - |
reliably | Surfaces reliability issues in Kubernetes | - |
schemahero | Declarative database schema migrations via YAML | - |
vela | Easily interact with KubeVela | - |