반응형

kubectl 도구를 이용하여 Windows에서 기타 서버에 설치되어있는 k8s cluster를 사용할 수 있으며,

k8s 클러스터가 여러개일 경우에도 선택하여 사용가능하다.

 

1. k8s 설치

Window에 Terminal 또는 Powershell을 열어 아래의 명령어를 통해 kubectl을 다운받는다.

curl.exe -LO "https://dl.k8s.io/release/v1.28.4/bin/windows/amd64/kubectl.exe"

 

다운 후 Path에 등록하여도 되고 직접 kubectl 설치되어있는 폴더 호출 하여 사용해도 무관.

# C드라이브 test폴더에서 kubectl 파일 다운받았을 경우
C:\test> ./kubectl

 

 

2. k8s config 파일 복사

서버에 있는 k8s config파일의 내용을 복사한다.

cat ~/.kube/config

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCRXhNelV4TlROYUZ3MHpNekE0TVRneE16VTJOVE5hTUJVeApFekFSQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLCkFvSUJBUURmZTZSREhXZE90Q25qczZnNHFESVprZHFzR2ZRUEE5MXlWYS9LN3AwcTZIRllvRzRQcGZHMkdUeFIKWi9HeXFqU3ZIS01KYWo1WUIvdHJ1TEtrMnoreTFGZXp0eHJFc1JkVi96UXlNOENrcGZVd1FhV2dNMGhSUTF3NgpKcTZGOHhsMlBSaDFlRjJ1eG9YT0pPOFFGam1EV2lUWVQrNEhTL0dRRE5hTlYvNlAxOXllM2VNQWhyZndQeU4xCkJKWXNwRnBTRFJLMTNpNG1IYTk3ZS9WMU9iQkFaQlJNZHhYc3FsaHQvaDR3UWFaRGF4N05tb2huVC9QOGlJTzYKamdtMC82cDBiRmhaaU5nam10TFkwdW9sd2R5Z1JyV1laSCtsclJ6b3FmbW0wUzRieEwrNC9lUXVCeFNlYzBmQwozWjlTaFJPaitiVkt6MFdmRG5PUEQ4S29kTmJqQWdNQkFBR2pXVEJYTUE0R0ExVWREd0VCL3dRRUF3SUNwREFQCkJnTlZIUk1CQWY4RUJUQURBUUgvTUIwR0ExVWREZ1FXQkJSNHR3RnVGY2JTN3VxZXhPcFdCdTEreTFUU0x6QVYKQmdOVkhSRUVEakFNZ2dwcmRXSmxjbTVsZEdWek1BMEdDU3FHU0liM0RRRUJDd1VBQTRJQkFRQUJpSXNhK0EvNgpkdzIzWVNhTm8wU0FaQ3ZUckc1eE1wVWtpRktDcXd0eXU5OFhOR29JNWlhY3pyMllsS2ZueGh6eVNzSFJuWTBNCnZUT3k3aUp2ZGhseldqUlUvcGZMS0hRMVZuSkZ6ZzQ1NDhrdE5MUHQ3eVFTL25HelJDZnJhZGhzc0FKTzJMc1cKTnRxVm5kM3hibVpFTDREamM4ZWNmYVJZMHJTMm9yQ3RoZzZQZFZhMTdQaWlWTk1zS0hGSnJpMVRPdEY5VzdKYQpNQkRLN2ttL2syZThnRmJPYzhlZHc5VGVmS09QTFBLenN6NXVzbWRCNnVyNnZxRFlUYWhtVi9UV2NrQW04aFd6ClU4bkxDcEE1VVllV3hkbTBJSGU2L0NOUmNEeXQzUEtOQTlMZm5zeHcxZjh5c24zSElSSTc2REhyVE9OK3lQUjQKRFpacjI5YjRsWkVtCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    server: https://192.168.1.1:6443
  name: dev-k8s
contexts:
- context:
    cluster: dev-k8s
    user: pangyeon
  name: pangyeon-dev
current-context:  pangyeon-dev
kind: Config
preferences: {}
users:
- name: pangyeon
  user:
    client-certificate-data: LS0tLS1CRUdJTiBSUZJQDQWdtZ0F3SUJBZ0lJSGpubTVYZWxsbk13RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TXpBNE1qRXhNelV4TlROYUZ3MHlOREE0TWpBeE16VTJOVFphTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnp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B3b2tDZ1lFQTdoWUNYSXlXQkpkU3lrMnNPakVndHdLY3AwY2VxUC9sd2QwbGFya2VDU1laSEtweGY5TSsKMm93dGd6UzFTZ1pibHlvRytMQzVFRkF6cXJIK002aHdXZCtMcG8yeWhBZ1hVNm9SMDlNdG56ZUo0UGhBTzI5WQo1ejNiZHp5Q1RNZlN4RUYweWNOL21yZnI1N2VGVk51d1ZnUkVySWxkVGw5NkRaVENXS2ZDb0h3PQotLS0tLUVORCBSU0EgUFJJVkFURSBS0tLQo=

 

 

3. 복사한 파일 이동 및 조회

아래 두가지 방법으로 사용가능

 

3.1 Windows 계정 폴더로 이동

C:\Users\본인계정\  으로 이동하여 .kube 폴더 생성 후 아래에 config파일 이동

 

C:\Users\본인계정\.kube\config 에 파일이 있을 경우 바로 사용가능하다.

# C드라이브 test에 kubectl 파일이 있는 경우
PS C:\test> ./kubectl get pods -A
NAMESPACE       NAME                                                READY   STATUS        RESTARTS       AGE
ingress-nginx   ingress-nginx-controller-6544f7745b-z4lsr           1/1     Running       1 (52m ago)    24h
kube-system     coredns-5dd5756b68-2tl8x                            1/1     Terminating   0              1d
kube-system     coredns-5dd5756b68-6b55b                            1/1     Terminating   0              1d
kube-system     coredns-5dd5756b68-7fxrc                            1/1     Running       8 (52m ago)    1d
kube-system     coredns-5dd5756b68-h982d                            1/1     Running       9 (52m ago)    1d
kube-system     etcd-ubuntu                                         1/1     Running       0              1d
kube-system     kube-apiserver-ubuntu                               1/1     Running       0              1d
kube-system     kube-controller-manager-ubuntu                      1/1     Running       0              1d
kube-system     kube-proxy-2sngh                                    1/1     Running       9 (52m ago)    1d
kube-system     kube-proxy-mmsbf                                    1/1     Running       10 (52m ago)   1d
kube-system     kube-proxy-zh22k                                    1/1     Running       0              1d
kube-system     kube-scheduler-ubuntu                               1/1     Running       0              1d
kube-system     weave-net-94f8g                                     2/2     Running       24 (52m ago)   1d
kube-system     weave-net-gszsj                                     2/2     Running       30 (51m ago)   1d
kube-system     weave-net-hxknh                                     2/2     Running       1 (99d ago)    1d

 

 

3.2 사용하기 편한곳에 config 파일두고 kubectl --kubeconfig 옵션을 통해 사용

# C드라이브 내 test폴더에 config파일이 있을 경우
./kubectl get pods -A --kubeconfig=C:\test\config
NAMESPACE       NAME                                                READY   STATUS        RESTARTS       AGE
ingress-nginx   ingress-nginx-controller-6544f7745b-z4lsr           1/1     Running       1 (52m ago)    24h
kube-system     coredns-5dd5756b68-2tl8x                            1/1     Terminating   0              1d
kube-system     coredns-5dd5756b68-6b55b                            1/1     Terminating   0              1d
kube-system     coredns-5dd5756b68-7fxrc                            1/1     Running       8 (52m ago)    1d
kube-system     coredns-5dd5756b68-h982d                            1/1     Running       9 (52m ago)    1d
kube-system     etcd-ubuntu                                         1/1     Running       0              1d
kube-system     kube-apiserver-ubuntu                               1/1     Running       0              1d
kube-system     kube-controller-manager-ubuntu                      1/1     Running       0              1d
kube-system     kube-proxy-2sngh                                    1/1     Running       9 (52m ago)    1d
kube-system     kube-proxy-mmsbf                                    1/1     Running       10 (52m ago)   1d
kube-system     kube-proxy-zh22k                                    1/1     Running       0              1d
kube-system     kube-scheduler-ubuntu                               1/1     Running       0              1d
kube-system     weave-net-94f8g                                     2/2     Running       24 (52m ago)   1d
kube-system     weave-net-gszsj                                     2/2     Running       30 (51m ago)   1d
kube-system     weave-net-hxknh                                     2/2     Running       1 (99d ago)    1d

 

 

4. k8s 클러스터가 여러개일경우

config 파일에 등록한다.

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCVENDQWUyZ0F3SUJBZ0lJTC9XdXZlY1ZxL013RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TXpBNE1qRXhNelV4TlROYUZ3MHpNekE0TVRneE16VTJOVE5hTUJVeApFekFSQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13Z2dFaU1BMEdDU3FH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JSNHR3RnVGY2JTN3VxZXhPcFdCdTEreTFUU0x6QVYKQmdOVkhSRUVEakFNZ2dwcmRXSmxjbTVsZEdWek1BMEdDU3FHU0liM0RRRUJDd1VBQTRJQkFRQUJpSXNhK0EvNgpkdzIzWVNhTm8wU0FaQ3ZUckc1eE1wVWtpRktDcXd0eXU5OFhOR29JNWlhY3pyMllsS2ZueGh6eVNzSFJuWTBNCnZUT3k3aUp2ZGhseldqUlUvcGZMS0hRMVZuSkZ6ZzQ1NDhrdE5MUHQ3eVFTL25HelJDZnJhZGhzc0FKTzJMc1cKTnRxVm5kM3hibVpFTDREamM4ZWNmYVJZMHJTMm9yQ3RoZzZQZFZhMTdQaWlWTk1zS0hGSnJpMVRPdEY5VzdKYQpNQkRLN2ttL2syZThnRmJPYzhlZHc5VGVmS09QTFBLenN6NXVzbWRCNnVyNnZxRFlUYWhtVi9UV2NrQW04aFd6ClU4bkxDcEE1VVllV3hkbTBJSGU2L0NOUmNEeXQzUEtOQTlMZm5zeHcxZjh5c24zSElSSTc2REhyVE9OK3lQUjQKRFpacjI5YjRsWkVtCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    server: https://192.168.2.1:6443
  name: stg-k8s
contexts:
- context:
    cluster: dev-k8s
    user: pangyeon-dev
  name: pangyeon-dev
- context:
    cluster: stg-k8s
    user: pangyeon-stg
  name: pangyeon-stg
current-context: pangyeon-dev
kind: Config
preferences: {}
users:
- name: pangyeon-dev
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJSGpubTVYZWxsbk13RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TXpBNE1qRXhNelV4TlROYUZ3MHlOREE0TWpBeE16VTJOVFphTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV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eWZTbUZXNzdHMTdRc1RWQy9uVXVueHRMNGNiVEhaRndVMgo2dXVIUUg2QUNMS2p1ek03djJ3MERsZUNlbG1TKzFaelZvS2I2Mmc2S3pUZXZ2bWhrczI0Vkxtc1BMT0lta1pGCndHSmJoT1lFcDhXcktZalZQNzJXSmg4bXhLVFBUSVhFNTZKSzZIL1pBb0dCQU0yQXUxaHhqdVU3M1IyMGxRK00KTkRyL3hrN3l4QktVUTBOZkFWWU5tUThLU25kanJYSnQyVnFyNi80cStHZ2VieDBnbmozOEJKbG9Rc1pSdUVOWgpBR2FJVy9kN2hsTkFDNFN5K3NqSGlRWmZKYVhtL2RaSEdoNkhRaFo1cnhOenZjNDNBc1BQaGp0TzBYWkt1UDVMClliY01FcHdCcHJCbmlIV0NTUEZ1MHI2bEFvR0FSUGdYUlJIZ3J2dUlDV1NYYmgwSTZMUFkwRGRtaFNtbExiK1cKMGhqMUF1Q1ZjUkc4UE04Vkc4cXdOTGdkS0d0Q0FXckw2bExwRC9lK0ZjaE9ja3dQODg4WGdvR3VMVW9oY0k4cgpqZXY3WEx6dDMzZWM3NkdIZDgrcE5sR2lBME9ObkNCdXhhOTh3eElNdDh4enhWQnBnOWhrMmZIRDkyZE1XMXFlCmJaaTB3b2tDZ1lFQTdoWUNYSXlXQkpkU3lrMnNPakVndHdLY3AwY2VxUC9sd2QwbGFya2VDU1laSEtweGY5TSsKMm93dGd6UzFTZ1pibHlvRytMQzVFRkF6cXJIK002aHdXZCtMcG8yeWhBZ1hVNm9SMDlNdG56ZUo0UGhBTzI5WQo1ejNiZHp5Q1RNZlN4RUYweWNOL21yZnI1N2VGVk51d1ZnUkVySWxkVGw5NkRaVENXS2ZDb0h3PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=

 

 

5. use-context 옵션을 통해 클러스터를 선택한다.

PS C:\test> ./kubectl config use-context pangyeon-dev
Switched to context "pangyeon-dev".

 

 

6. 선택 후 조회

./kubectl get pods -A
NAMESPACE       NAME                                                READY   STATUS        RESTARTS       AGE
ingress-nginx   ingress-nginx-controller-6544f7745b-z4lsr           1/1     Running       1 (52m ago)    24h
kube-system     coredns-5dd5756b68-2tl8x                            1/1     Terminating   0              1d
kube-system     coredns-5dd5756b68-6b55b                            1/1     Terminating   0              1d
kube-system     coredns-5dd5756b68-7fxrc                            1/1     Running       8 (52m ago)    1d
kube-system     coredns-5dd5756b68-h982d                            1/1     Running       9 (52m ago)    1d
kube-system     etcd-ubuntu                                         1/1     Running       0              1d
kube-system     kube-apiserver-ubuntu                               1/1     Running       0              1d
kube-system     kube-controller-manager-ubuntu                      1/1     Running       0              1d
kube-system     kube-proxy-2sngh                                    1/1     Running       9 (52m ago)    1d
kube-system     kube-proxy-mmsbf                                    1/1     Running       10 (52m ago)   1d
kube-system     kube-proxy-zh22k                                    1/1     Running       0              1d
kube-system     kube-scheduler-ubuntu                               1/1     Running       0              1d
kube-system     weave-net-94f8g                                     2/2     Running       24 (52m ago)   1d
kube-system     weave-net-gszsj                                     2/2     Running       30 (51m ago)   1d
kube-system     weave-net-hxknh                                     2/2     Running       1 (99d ago)    1d

 

 

참고

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

https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/

반응형

+ Recent posts