Mac kubectl 설치Mac
컨텐츠 정보
- 306 조회
- 0 추천
- 목록
본문
# Brew 설치
https://brew.sh
```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
# Kubectl 설치
```
brew install kubernetes-cli
```
(output)
```
==> Fetching kubernetes-cli
==> Downloading https://ghcr.io/v2/homebrew/core/kubernetes-cli/manifests/1.27.3
######################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/kubernetes-cli/blobs/sha256:0f6
######################################################################### 100.0%
==> Pouring kubernetes-cli--1.27.3.arm64_ventura.bottle.tar.gz
==> Caveats
zsh completions have been installed to:
/opt/homebrew/share/zsh/site-functions
==> Summary
? /opt/homebrew/Cellar/kubernetes-cli/1.27.3: 230 files, 57.7MB
==> Running `brew cleanup kubernetes-cli`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
❯ kubectl --version
error: unknown flag: --version
See 'kubectl --help' for usage.
❯ kubectl
```
# Kubectl 자동완성
https://kubernetes.io/docs/reference/kubectl/cheatsheet/
## alias
```
alias k=kubectl
complete -o default -F __start_kubectl k
```
## Bash
```
source <(kubectl completion bash) # set up autocomplete in bash into the current shell, bash-completion package should be installed first.
echo "source <(kubectl completion bash)" >> ~/.bashrc # add autocomplete permanently to your bash shell.
```
## Zsh
```
source <(kubectl completion zsh) # set up autocomplete in zsh into the current shell
echo '[[ $commands[kubectl] ]] && source <(kubectl completion zsh)' >> ~/.zshrc # add autocomplete permanently to your zsh shell
```
관련자료
댓글 0
등록된 댓글이 없습니다.