본문 바로가기
Trouble Shooting

[k8s] GPG key 에러 NO_PUBKEY B53DC80D13EDEF05 사용할 수 없음

by ganyga 2024. 3. 1.

문제 상황)

공식 문서를 보고 kubeadm, kubelet, kubectl 설치하기 위해 kubernetes GPG key를 다운 받고, 리포지터리를 추가한 다음 apt-get update를 한 후 error 발생

# 쿠버네티스 apt 리포지터리를 사용하는데 필요한 패키지 설치
root@master:~# apt-get update
root@master:~# apt-get install -y apt-transport-https ca-certificates curl

# 쿠버네티스 GPG key 다운로드
root@master:~# curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg

# 쿠버네티스 apt 리포지터리 추가
root@master:~# echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

# 확인
root@master:~# cat /etc/apt/sources.list.d/kubernetes.list
deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main

# apt 업데이트 후 kubelet, kubeadm, kubectl 최신 버전으로 설치
root@master:~# apt-get update
Hit:1 https://download.docker.com/linux/ubuntu jammy InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports jammy InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease
Get:2 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8,993 B]
Err:2 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05
Hit:6 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease
Reading package lists... Done
W: GPG error: https://packages.cloud.google.com/apt kubernetes-xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05
E: The repository 'https://apt.kubernetes.io kubernetes-xenial InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

 

에러 코드)

W: GPG error: https://packages.cloud.google.com/apt kubernetes-xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05
E: The repository 'https://apt.kubernetes.io kubernetes-xenial InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

 

원인 분석)

공식 문서 들어가보니, Kubernetes용 Linux 패키지 위치가 변경 됐다는 표시가 뜸

https://v1-28.docs.kubernetes.io/blog/2023/08/31/legacy-package-repository-deprecation/

https://github.com/kubernetes/release/issues/2862#issuecomment-1611049692

 

Ubuntu kubernetes-xenial public key is not available: NO_PUBKEY B53DC80D13EDEF05 · Issue #2862 · kubernetes/release

What happened: $ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - % Total % Received % Xferd Average Speed Time Time Ti...

github.com

 

해결)

바뀐 저장소 위치 변경 후 해결 완료

# 쿠버네티스 GPG key 다운로드
root@master:~# curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg  https://dl.k8s.io/apt/doc/apt-key.gpg

# 쿠버네티스 apt 리포지터리 추가
root@master:~# echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main

# 확인
root@master:~# cat /etc/apt/sources.list.d/kubernetes.list
deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main

 

다시 apt-get update 실행

root@master:~# apt-get update
Hit:1 https://download.docker.com/linux/ubuntu jammy InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports jammy InRelease
Get:4 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease [119 kB]
Get:2 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8,993 B]
Get:5 https://packages.cloud.google.com/apt kubernetes-xenial/main arm64 Packages [68.5 kB]
Hit:6 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease
Get:7 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [110 kB]
Fetched 298 kB in 3s (110 kB/s)
Reading package lists... Done