[VMware Tanzu] Tanzu CLI

Seunghyun Moon·2022년 10월 13일
0

vmware

목록 보기
5/9
post-custom-banner

먼저 워커 클러스터 컨텍스트로 바꾼다.

Tanzu CLI 사용

tanzu init

Management cluster

login - MC 선택

tanzu login

create

tanzu mangement-cluster create {이름} --ui

tanzu mc create {이름} --file {file}

delete

안되면 kubectl에서 지워줘야하는듯해보임.

tanzu mc delete {mc name}

tanzu config server list
tanzu config server delete {mc name}

클러스터 설정 파일(kubeconfig) 위치
.kube/config << 워커 클러스터
.kube-tkg/config << mgmt 클러스터

Kubectl

클러스터, 컨텍스트, 유저 확인

[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config current-context
tce-management-cluster-admin@tce-management-cluster
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config get-contexts
CURRENT   NAME                                                  CLUSTER                  AUTHINFO                       NAMESPACE
*         tce-management-cluster-admin@tce-management-cluster   tce-management-cluster   tce-management-cluster-admin

[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config get-clusters
NAME
tce-management-cluster
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config get-users
NAME
tce-management-cluster-admin

클러스터, 컨텍스트, 유저 삭제 방법

[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config delete-context tce-mgmt-cluster-admin@tce-mgmt-cluster
deleted context tce-mgmt-cluster-admin@tce-mgmt-cluster from /home/brewinstall/.kube/config
[brewinstall@tanzu-bootstrap-cluster ~]$
[brewinstall@tanzu-bootstrap-cluster ~]$ vi /home/brewinstall/.kube/config
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config delete-cluster tce-mgmt-cluster-admin@tce-mgmt-cluster
error: cannot delete cluster tce-mgmt-cluster-admin@tce-mgmt-cluster, not in /home/brewinstall/.kube/config
[brewinstall@tanzu-bootstrap-cluster ~]$ vi /home/brewinstall/.kube/config
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config delete-cluster tce-mgmt-cluster
deleted cluster tce-mgmt-cluster from /home/brewinstall/.kube/config
[brewinstall@tanzu-bootstrap-cluster ~]$ vi /home/brewinstall/.kube/config
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config delete-user tce-mgmt-cluster-admin
deleted user tce-mgmt-cluster-admin from /home/brewinstall/.kube/config

컨텍스트 스위치

kubectl config use-context my-cluster-admin@my-cluster

클러스터 정보

kubectl cluster-info

아래 에러떴을때

[ec2-user@ip-10-0-31-78 ~]$ kubectl get po

The connection to the server localhost:8080 was refused - did you specify the right host or port?

[ec2-user@ip-10-0-31-78 ~]$ kubectl api-versions
error: couldn't get available api versions from server: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused

resolution

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
profile
I live fullest
post-custom-banner

0개의 댓글