Window에 kubectl 설치 및 minikube 연결하기

2023. 3. 1. 23:39k8s

kubeclt 설치

# 파일 다운로드
curl.exe -LO "https://dl.k8s.io/release/v1.26.0/bin/windows/amd64/kubectl.exe"

# 파일 옮기기
copy kubectl.exe C:\Windows\System32\

minikube 연결

# 서버의 파일 환경 파일 복사
scp 계정@192.168.0.28:/home/계정/.kube/config C://Users/계정/.kube/

# 환경변수 등록
KUBECONFIG=C://Users/계정/.kube

# 명령실행
# 에러 발생
kubectl get pods
----------------------------
Error in configuration:
* unable to read client-cert .\.minikube\profiles\minikube\client.crt for minikube due to open ... The system cannot find the path specified.
* unable to read client-key .\.minikube\profiles\minikube\client.key for minikube due to open ... The system cannot find the path specified.
* unable to read certificate-authority .\.minikube\profiles\ca.crt for minikube due to open ... The system cannot find the path specified.
----------------------------

# 인증서 복사(인증서 3개 복사)
scp 계정@192.168.0.28:/에러에 나오는 인증서 위치 C://Users/계정/.kube/원하는 위치

# 앞에서 복사한 환경파일(config) 수정
--------------------------------------
- cluster:
    certificate-authority: 복사한 위치\ca.crt

users:
- name: minikube
  user:
    client-certificate: 복사한 위치\client.crt
    client-key: 복사한 위치\client.key    
--------------------------------------

# 명령실행
# 에러 발생
kubectl get pods
--------------------------------
E0116 20:52:21.511281   10924 memcache.go:238] couldn't get current server API group list: Get "https://192.168.49.2:8443/api?timeout=32s": dial tcp 192.168.49.2:8443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
--------------------------------

# 환경파일(config) 수정
--------------------------------------
- cluster:
    certificate-authority: \ca.crt

    server: https://minikube가 설치된 PC의 IP:8443 
--------------------------------------

# 명령실행
# 에러 발생
kubectl get pods
--------------------------------------
E0116 20:56:42.667357   14364 memcache.go:238] couldn't get current server API group list: Get "https://minikube IP:8443/api?timeout=32s": dial tcp minikube IP:8443: connectex: No connection could be made because the target machine actively refused it.
--------------------------------------

'k8s' 카테고리의 다른 글

minikube 설정 테스트  (0) 2023.04.08
miniKube LoadBalancer 설정(metallb)  (0) 2023.03.19
minikube echo server 외부 오픈  (0) 2023.03.18
minikube 명령어  (0) 2023.03.18
우분투에 Minikube 설치  (0) 2023.02.25