본문 바로가기
devops/docker

docker desktop 에서 rancher desktop로 kubenetes certificate signed by unknown authority

by 아이티.파머 2025. 10. 10.
728x90

docker desktop 에서 rancher로 변경후 kubectl 명령어를 실행시 오류바 발생했다.

 ~ kubectl version
Client Version: v1.34.0
Kustomize Version: v5.7.1
Unable to connect to the server: tls: failed to verify certificate: x509: certificate signed by unknown authority
➜  ~ kubectl get nodes
Unable to connect to the server: tls: failed to verify certificate: x509: certificate signed by unknown authority

인증서가 잘못되었다. 즉 신뢰 할수 없다는 경고문이 떳고 ? 인테넷을 검색해보니 여러가지 경우가 존재했다.

나의 경우는 Rancher UI에 접속해보니 이런 알림이 존재했다.

 

 

kubenetes의 컨텍스트를 rancher-desktop이 아니라 docker-desktop을 사용한다는 알림이었다. rancher-desktop을 사용중인데 docker-desktop이라니?

gpt의 힘을빌려 해당 경고에 대한 검색을 했고, context에 대해 조사해보라고 팁을 주어 확인해보았다.

➜  ~ kubectl config get-contexts
CURRENT   NAME              CLUSTER           AUTHINFO          NAMESPACE
*         docker-desktop    docker-desktop    docker-desktop
          rancher-desktop   rancher-desktop   rancher-desktop

두개의 컨텍스트가 있고 현재 선택된건 docker-desktop이라 다음명령어를 사용하여 rancher-desktop으로 변경하였다.

➜  ~ kubectl config use-context rancher-desktop
Switched to context "rancher-desktop".

이후 정상적으로 동작되는 걸 확인 할 수 있었다.

➜  ~ kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:6443
CoreDNS is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/services/https:metrics-server:https/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
➜  ~ kubectl get nodes
NAME                   STATUS   ROLES                  AGE   VERSION
lima-rancher-desktop   Ready    control-plane,master   32d   v1.33.4+k3s1

문제원인

  • Mac에 Rancher desktop과 docker desktop 둘다 설치되어 있음
  • 기본 context가 docker desktop으로 설정되어있음
  • reacher desktop 클러스터 인증서를 사용하지 않음으로 TLS 오류 발생

해결 방법

  • kubectl 로 context 변경