본문 바로가기
시스템/쿠버네티스

[쿠버네티스] 플러그인 패키지 매니저 krew설치

by cbwstar 2024. 1. 12.
728x90
반응형

홈페이지 : https://krew.sigs.k8s.io/docs/user-guide/quickstart/

 

Quickstart · Krew

© 2023 The Kubernetes Authors. Krew is a Kubernetes SIG CLI project. Edit Page ·

krew.sigs.k8s.io

1. 다운로드 & 설치

(
  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
)

2. 환경변수 설정

vi .bashrc

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
#    . /etc/bash_completion
#fi
source <(kubectl completion bash)

# krew 환경변수 추가
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"

적용

source .bashrc   

3. krew가 실행 되는지 확인

root@master:~# kubectl krew
krew is the kubectl plugin manager.
You can invoke krew through kubectl: "kubectl krew [command]..."

Usage:
  kubectl krew [command]

Available Commands:
  help        Help about any command
  index       Manage custom plugin indexes
  info        Show information about an available plugin
  install     Install kubectl plugins
  list        List installed kubectl plugins
  search      Discover kubectl plugins
  uninstall   Uninstall plugins
  update      Update the local copy of the plugin index
  upgrade     Upgrade installed plugins to newer versions
  version     Show krew version and diagnostics

Flags:
  -h, --help      help for krew
  -v, --v Level   number for the log level verbosity

Use "kubectl krew [command] --help" for more information about a command.

4. 사용가능한 플러그인 검색

 - kubectl krew update

 - kubectl krew search

검색 키워드를 인수로 지정할 수 있습니다.

kubectl krew search pod

NAME                DESCRIPTION                                         INSTALLED
evict-pod           Evicts the given pod                                no
pod-dive            Shows a pod's workload tree and info inside a node  no
pod-logs            Display a list of pods to get logs from             no
pod-shell           Display a list of pods to execute a shell in        no
rm-standalone-pods  Remove all pods without owner references            no
support-bundle      Creates support bundles for off-cluster analysis    no
플러그인에 대해 자세히 알아보기
플러그인에 대한 자세한 정보를 얻으려면 다음을 실행하세요 kubectl krew info <PLUGIN>.

 kubectl krew info tree

NAME: tree
VERSION: v0.4.0
DESCRIPTION:
  This plugin shows sub-resources of a specified Kubernetes API object in a
  tree view in the command-line. The parent-child relationship is discovered
  using ownerReferences on the child object.
...

 

root@master:~# kubectl krew search exec-as
NAME      DESCRIPTION                                         INSTALLED
exec-as   Like kubectl exec, but offers a `user` flag to ...  no
htpasswd  Create nginx-ingress compatible basic-auth secrets  no

/* 검색후 설치 */

kubectl krew install exec-as

 

728x90
반응형

댓글



"이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다."

loading