Kubernetes 体验 kubecolor
- kubecolor 概述
- Github 地址
- 安装 kubecolor
- 设置`.bashrc`
- 使用 kubecolor
kubecolor 概述
对你的kubectl输出进行着色。
kubecolor在内部调用kubectl命令并尝试对输出进行着色,因此你可以将kubecolor作为kubectl的一个完整的替代品。这意味着你可以在你的.bash_profile中这样写。
alias kubectl="kubecolor"
Github 地址
https://github.com/hidetatz/kubecolor
安装 kubecolor
访问https://github.com/hidetatz/kubecolor/releases查看最新版本,
export VERSION=0.0.25
cd /tmp
wget https://github.com/hidetatz/kubecolor/releases/download/v${VERSION}/kubecolor_${VERSION}_Linux_x86_64.tar.gz
tar zxvf kubecolor_${VERSION}_Linux_x86_64.tar.gz
sudo install -m 755 kubecolor /usr/local/bin/
设置.bashrc
echo '# kubectl get resource' >> ~/.bashrc
echo 'alias kubectl="kubecolor"' >> ~/.bashrc
echo 'alias k="kubecolor"' >> ~/.bashrc
echo 'alias kn="kubectl get nodes -o wide"' >> ~/.bashrc
echo 'alias kp="kubectl get pods -o wide"' >> ~/.bashrc
echo 'alias kd="kubectl get deployment -o wide"' >> ~/.bashrc
echo 'alias ks="kubectl get svc -o wide"' >> ~/.bashrc
echo '# kubectl describe resources' >> ~/.bashrc
echo 'alias kdp="kubectl describe pod"' >> ~/.bashrc
echo 'alias kdd="kubectl describe deployment"' >> ~/.bashrc
echo 'alias kds="kubectl describe service"' >> ~/.bashrc
echo 'alias kdn="kubectl describe node"' >> ~/.bashrc
echo 'complete -o default -F __start_kubectl k' >> ~/.bashrc
source ~/.bashrc
使用 kubecolor
kn
输出示例,
kp -A
输出示例,
完结!