Rancher 의 기능을 GUI 와 더불어 CLI 로 사용학 위한 설정 및 사용법
- 랜처 서버가 설치된 서버와 동일 서버에서 CLI 설정을 진행
- 필요사항: 랜처 서버 URL, BearerToken
$ wget https://github.com/rancher/cli/releases/download/v2.4.12/rancher-linux-amd64-v2.4.12.tar.gz
$ tar -xvf rancher-linux-amd64-v2.4.12.tar.gz
$ cd rancher-v2.4.12/
$ ./rancher login https://[URL] --token token-[BEARER_TOKEN]
Do you want to continue connecting (yes/no)? yes
NUMBER CLUSTER NAME PROJECT ID PROJECT NAME PROJECT DESCRIPTION
1 cluster1 c-jd9j2:p-4zwbp Default Default project created for the cluster
2 cluster1 c-jd9j2:p-rj7lz System System project created for the cluster
3 local local:p-8bdk6 System System project created for the cluster
4 local local:p-gp5c6 Default Default project created for the cluste
rancher CLI 를 통해 kubectl 명령어 사용을 위해서는 kubectl 설치가 필요함
1) Download the latest release with the command
$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 154 100 154 0 0 911 0 --:--:-- --:--:-- --:--:-- 911
100 44.7M 100 44.7M 0 0 45.1M 0 --:--:-- --:--:-- --:--:-- 81.8M
2) Validate the binary (optional)
$ curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 154 100 154 0 0 900 0 --:--:-- --:--:-- --:--:-- 900
100 64 100 64 0 0 156 0 --:--:-- --:--:-- --:--:-- 156
$ echo "$(<kubectl.sha256) kubectl" | sha256sum --check
kubectl: OK
3) Install kubectl
$ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
4) Test to ensure the version you installed is up-to-date
$ kubectl version --client
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.2", GitCommit:"8b5a19147530eaac9476b0ab82980b4088bbc1b2", GitTreeState:"clean", BuildDate:"2021-09-15T21:38:50Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"linux/amd64"}