k9s 셋팅 및 사용법

2022. 6. 17. 00:11OpenSource/K8s

반응형

k9s란?
k8s(쿠버네티스) 클러스터를 제어하기 위해 보통 kubectl 을 사용하는데 오늘 한 크루가 k9s라는것을 사용하는것을 보았다.
터미널에서 제어를 하는거였는데 좀 더 편하게 쿠버네티스를 제어할 수 있다고 한다. 그래서 설치를 해보고 사용해보려고 한다.
장단점으로 k9s를 바로 사용한다면 kubctl의 명령어들에 대해서 점점 더 잊혀질 가능성이 크다.
하지만 매우 편할것 같긴하다. 일단 둘 다 사용해보는걸로 하자!

셋팅-macOS 기준

brew install k9s 명령어로 인스톨 해줍니다.

brew install k9s
Running `brew update --preinstall`...
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:1f50bf80583bd436c9542d4fa5ad47df0ef0f0bea22ae710c4f04c42d7560bca
#=#=-  #       #                                                                                                                                                                                                                                               #=O=#     #        #                                                                                                                                                                                                                                           -#O=- #      #          #                               ######################################################################################################################################################################################################################################################### 100.0%
==> Pouring portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
aws-nuke             dtrx                 eget                 groestlcoin          jackett              maclaunch            nali                 ohdear-cli           pacmc                pg_partman           stencil              teller               yorkie
cfonts               dump1090-mutability  glider               install-peerdeps     kics                 mariadb@10.7         oak                  opencl-headers       pg_cron              redis@6.2            synergy-core         toxcore              zx
==> New Casks
amazon-luna                        audiostellar                       elephicon                          localxpose                         orion                              psst                               sol                                swiftcord
app-fair                           ecamm-live                         jpc-qlcolorcode                    orangedrangon-android-messages     phpwebstudy                        rustdesk                           sonixd

You have 46 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.

==> Downloading https://ghcr.io/v2/homebrew/core/k9s/manifests/0.25.18
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/k9s/blobs/sha256:f341e0a3c66071e280207a46716a2b354f784a253539960d4335118ba4328537
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:f341e0a3c66071e280207a46716a2b354f784a253539960d4335118ba4328537?se=2022-06-16T14%3A35%3A00Z&sig=ggUJk7gxmgLi8m2qCnj4LFNE3c5TyGpp6V%2FRNhicqL0%3D&sp=r&spr=https&sr=b&sv=2019-12-12
######################################################################## 100.0%
==> Pouring k9s--0.25.18.big_sur.bottle.tar.gz
==> Caveats
zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/k9s/0.25.18: 9 files, 65MB
==> Running `brew cleanup k9s`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

k9s가 설치가 되었으니 이제 사용을 해보자.
우선 help 명령어로 어떤 명령어들이 있는지 확인해보자.
k9s help

k9s help
K9s is a CLI to view and manage your Kubernetes clusters.

Usage:
  k9s [flags]
  k9s [command]

Available Commands:
  completion  generate the autocompletion script for the specified shell
  help        Help about any command
  info        Print configuration info
  version     Print version/build info

Flags:
  -A, --all-namespaces                 Launch K9s in all namespaces
      --as string                      Username to impersonate for the operation
      --as-group stringArray           Group to impersonate for the operation
      --certificate-authority string   Path to a cert file for the certificate authority
      --client-certificate string      Path to a client certificate file for TLS
      --client-key string              Path to a client key file for TLS
      --cluster string                 The name of the kubeconfig cluster to use
  -c, --command string                 Overrides the default resource to load when the application launches
      --context string                 The name of the kubeconfig context to use
      --crumbsless                     Turn K9s crumbs off
      --headless                       Turn K9s header off
  -h, --help                           help for k9s
      --insecure-skip-tls-verify       If true, the server's caCertFile will not be checked for validity
      --kubeconfig string              Path to the kubeconfig file to use for CLI requests
      --logFile string                 Specify the log file (default "/var/folders/01/fvtf676d7b5_jpnvxs9vwjg40000gn/T/k9s-terrypark.log")
  -l, --logLevel string                Specify a log level (info, warn, debug, trace, error) (default "info")
      --logoless                       Turn K9s logo off
  -n, --namespace string               If present, the namespace scope for this CLI request
      --readonly                       Sets readOnly mode by overriding readOnly configuration setting
  -r, --refresh int                    Specify the default refresh rate as an integer (sec) (default 2)
      --request-timeout string         The length of time to wait before giving up on a single server request
      --screen-dump-dir string         Sets a path to a dir for a screen dumps
      --token string                   Bearer token for authentication to the API server
      --user string                    The name of the kubeconfig user to use
      --write                          Sets write mode by overriding the readOnly configuration setting

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

명령어

k9s -c 옵션으로 pod를 쳐보자.
k9s -c pod

k9s -c pod 의 내용

원하는 pod에서 l 키를 누르면 로그가 나오고 d를 누르면 pod에 대한 상세설명이 나온다.

그리고 ? 누르면 k9s에서 사용가능한 전체 단축기들이 나온다.

뭔가 UI로 보이니 편하긴한것 같다.
kubctl 과 k9s 모두 사용해보도록 하자~

끝~

반응형
LIST

'OpenSource > K8s' 카테고리의 다른 글

k9s 셋팅 및 사용법  (0) 2022.06.17
helm chart storm  (0) 2022.01.19
pv, pvc terminating 말고 완전 삭제하기!  (0) 2022.01.11
k8s와 docker 주저리  (0) 2021.12.30
k8s 자격증?  (0) 2020.11.12
repository does not exist or may require 'docker login' k8s  (0) 2020.02.20