Skip to content

Instantly share code, notes, and snippets.

@alex-egorov
Created August 23, 2021 20:49
Show Gist options
  • Save alex-egorov/1764a36a8d6380c79805961631c548d7 to your computer and use it in GitHub Desktop.
Save alex-egorov/1764a36a8d6380c79805961631c548d7 to your computer and use it in GitHub Desktop.
kubectl plugins

Install krew

https://krew.sigs.k8s.io/docs/user-guide/setup/install/

(
  set -x; cd "$(mktemp -d)" &&
  OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
  ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
  curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/krew.tar.gz" &&
  tar zxvf krew.tar.gz &&
  KREW=./krew-"${OS}_${ARCH}" &&
  "$KREW" install krew
)
kubectl krew list

kubectl krew search

kubectl krew install ssh-jump

https://github.com/yokawasa/kubectl-plugin-ssh-jump

kubectl krew install tail

kubectl krew install ingress-nginx

kubectl ingress-nginx conf -n kube-system --deployment kublr-ingress-nginx-ingress-controller

kubectl krew install gadget

https://github.com/kinvolk/inspektor-gadget

kubectl gadget bindsnoop --selector run=nginx-app
$ kubectl gadget
Collection of gadgets for Kubernetes developers

Usage:
  kubectl gadget [command]

Available Commands:
  bindsnoop      Trace IPv4 and IPv6 bind() system calls
  capabilities   Suggest Security Capabilities for securityContext
  deploy         Deploy Inspektor Gadget on the worker nodes
  execsnoop      Trace new processes
  help           Help about any command
  network-policy Generate network policies based on recorded network activity
  opensnoop      Trace files
  profile        Profile CPU usage by sampling stack traces
  tcpconnect     Suggest Kubernetes Network Policies
  tcptop         Show the TCP traffic in a pod
  tcptracer      Trace tcp connect, accept and close
  traceloop      Get strace-like logs of a pod from the past
  version        Show version

kubectl krew install trace

https://github.com/iovisor/kubectl-trace

kubectl trace run ip-180-12-0-152.ec2.internal -e "tracepoint:syscalls:sys_enter_* { @[probe] = count(); }"

kubectl trace run ip-180-12-0-152.ec2.internal -f read.bt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment