Dok Docs
Github Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

kubectl-plugins

Overview

The following are the kubectl plugins pre-installed in DOK, as well as simple instructions for use.

krew

krew is a tool used to manage kubectl plugins. In addition, krew needs to install tools such as git to use it in an offline environment, so krew may not be very useful in private cluster.

export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"

kubectl-iexec

This plugin can interactively select the container under the current Namespace to enter in the terminal. In addition, DOK configures an alias for kubectl-iexec, which is kiexec.

kubectl iexec
kubectl-iexec
kiexec

img_1.png

kubectl-example

Through this plugin, you can render the yaml of some commonly used resource objects, which is convenient for local editing and deployment.

kubectl example deploy
kubectl-example pod

img.png

kubectl-df-pv

This plugin can query PV usage, but there will be some minor problems during installation. If you want to use kubectl df-pv, you can refer to this [issue](https://github.com/yashbhutwala/kubectl-df -pv/issues/14#issuecomment-1000214876).

df-pv

img_4.png

kube-capacity

This plugin mainly depends on the capacity of resources, and can make statistics according to many dimensions, such as Namespace, Node, Pod and so on.

kube-capacity
kube-capacity --available

img_2.png

img_3.png

kubectl-kail

This plugin can output Pod logs similar to kubectl logs --tail.

kubectl kail
kubectl-kail

img_5.png

kubectl debug

kubectl debug is not a plug-in of kubectl, it belongs to its function (it is indeed a plug-in in the earlier kubectl), which is very useful in the process of debugging. If you are interested, you can learn about the relevant implementation. DOK clusters are temporarily enabled by default. The feature-gate of the container.

kubectl run ephemeral-demo --image=k8s.gcr.io/pause:3.4.1 --restart=Never
kubectl debug -it ephemeral-demo --image=busybox:1.31.1 --target=ephemeral-demo

kubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1dA
kubectl debug myapp -it --image=ubuntu --share-processes --copy-to=myapp-debug
kubectl debug myapp --copy-to=myapp-debug --set-image=*=ubuntu
kubectl delete pod myapp myapp-debuga

kubectl debug node/mynode -it --image=ubuntu

img_6.png

Reference

  1. 临时容器
  2. 共享Namespace
  3. debug-running-pod
  4. 使用临时调试容器来进行调试
  5. 通过Pod副本调试