Skip to main content

Etc


kubectl

asdf plugin add kubectl
asdf list all kubectl
asdf install kubectl 1.24.10
asdf global kubectl 1.24.10
asdf local kubectl 1.24.10
asdf current kubectl
.zshrc
# kubectl
source <(kubectl completion zsh)
alias k=kubectl
complete -F __start_kubectl k

krew

(
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/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
)
.zshrc
# krew
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"

ctx

kubectl krew install ctx
kubectl ctx

ns

kubectl krew install ns
kubectl ns

oidc-login

kubectl krew install oidc-login
.kube/config
apiVersion: v1
kind: Config
preferences: {}
users:
- name: <name>
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
command: kubectl
args:
- oidc-login
- get-token
- --oidc-issuer-url=<issuer-url>
- --oidc-client-id=<client-id>
- --oidc-client-secret=<client-secret>

ksniff

ksniff는 static-tcpdump 바이너리를 Pod에 주입하여 실행한 후 출력되는 로그를 wireshark에서 읽을 수 있도록 변환해주는 툴입니다. 권한 문제로 캡쳐가 안되는 경우에는 -p 옵션을 사용하여 같은 Node에 새로운 Pod을 추가하여 캡쳐를 수행할 수 있습니다.

kubectl krew install ksniff
kubectl sniff <pod> [-n <namespace>] [-p]

node-shell

kubectl krew install node-shell
kubectl node-shell <node>

k9s

sudo pacman -S k9s

Popeye

sudo mkdir -p /opt/popeye/0.10.1 \
&& cd /opt/popeye/0.10.1 \
&& sudo wget https://github.com/derailed/popeye/releases/download/v0.10.1/popeye_Linux_x86_64.tar.gz \
&& sudo tar xzf popeye_Linux_x86_64.tar.gz
.zshrc
export PATH=/opt/popeye/0.10.1:$PATH

kubent

sudo mkdir -p /opt/kubent/0.7.0 \
&& cd /opt/kubent/0.7.0 \
&& sudo wget https://github.com/doitintl/kube-no-trouble/releases/download/0.7.0/kubent-0.7.0-linux-amd64.tar.gz \
&& sudo tar xzf kubent-0.7.0-linux-amd64.tar.gz
.zshrc
export PATH=/opt/kubent/0.7.0:$PATH