매번 잊어먹어서 기록을 위해 작성

 

[ Reference ]

- https://kubernetes.io/ko/docs/tasks/tools/install-kubectl-linux/

 

 

[ Environment ]

- `kubectl` 설치할 환경은 다음과 같다.

  . OS: Ubuntu 18.04

  . Shell: zsh

 

- `kubernetes master(control plane)` 환경은 다음과 같다.

  . IP: 192.168.100.200

 

 

[ kubectl - Install ]

- `curl` 이용하여 설치

> mkdir /srv/install/kubectl
> cd /srv/install/kubectl

> curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

> sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

 

 

[ shell 자동완성 ]

- zsh 을 위한 completion 적용

> nano ~/.zshrc

---add---
source <(kubectl completion zsh)
---------

> source ~/.zshrc

 

 

[ connect K8s Cluster ]

- K8s Cluster에 접근할 수 있는 권한 얻기

> mkdir ~/.kube
> scp vagrant@192.168.100.200:/home/vagrant/.kube/config ~/.kube/

> nano ~/.kube/config

---modify---
- server: https://127.0.0.1:6443
+ server: https://192.168.100.200:6443
---------

 

 

[ Check ]

- K8s master(control plane)을 잘 찾는지 확인해보자

❯ kubectl cluster-info
Kubernetes control plane is running at https://192.168.100.200:6443

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

 

반응형

+ Recent posts