Etc
kubectl
asdf plugin add kubectl
.zshrc
# kubectl
source <(kubectl completion zsh)
alias k=kubectl
complete -o default -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
ksniff
ksniff는 static-tcpdump 바이너리를 Pod에 주입하여 실행한 후 출력되는 로그를 wireshark에서 읽을 수 있도록 변환해주는 툴입니다. 권한 문제로 캡쳐가 안되는 경우에는 -p
옵션을 사용하여 같은 Node에 새로운 Pod을 추가하여 캡쳐를 수행할 수 있습니다.
kubectl krew install sniff
kubectl sniff <pod> [-n <namespace>] [-p]
node-shell
kubectl krew install node-shell
kubectl node-shell <node>
k9s
asdf plugin add k9s
k9s info
plugin
~/.config/k9s/plugins.yaml
plugins:
log2jq:
shortCut: Shift-L
confirm: false
background: false
description: "Log to jq"
scopes:
- pods
command: sh
args:
- -c
- |
echo 'kubectl logs -f --context $CONTEXT -n $NAMESPACE $NAME \\
| jq -rRC --unbuffered '"'"'. as $line | try fromjson catch $line'"'"' \\
| sed '"'"'s/\\\\n/\\n/g; s/\\\\t/\\t/g'"'\n\n"
kubectl logs -f --context $CONTEXT -n $NAMESPACE $NAME \
| jq -rRC --unbuffered '. as $line | try fromjson catch $line' \
| sed 's/\\n/\n/g; s/\\t/\t/g'
node-shell:
shortCut: s
confirm: false
background: false
description: Shell
scopes:
- nodes
command: sh
args:
- -c
- |
echo 'kubectl node-shell --context $CONTEXT $NAME'
kubectl node-shell --context $CONTEXT $NAME
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
asdf plugin add kubent