The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB

Solution 1:

via apt-key:

# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
OK
# apt-get update
Ign:1 http://deb.debian.org/debian stretch InRelease
Hit:2 http://security.debian.org stretch/updates InRelease
Hit:3 http://deb.debian.org/debian stretch-updates InRelease
Hit:4 http://deb.debian.org/debian stretch-backports InRelease           
Hit:5 http://deb.debian.org/debian stretch Release                       
Get:6 http://packages.cloud.google.com/apt cloud-sdk-stretch InRelease [6,377 B]
Get:7 http://packages.cloud.google.com/apt google-compute-engine-stretch-stable InRelease [3,843 B]
Ign:8 https://artifacts.elastic.co/packages/6.x/apt stable InRelease
Get:9 http://packages.cloud.google.com/apt google-cloud-packages-archive-keyring-stretch InRelease [3,876 B]
Hit:10 https://artifacts.elastic.co/packages/6.x/apt stable Release
Hit:12 https://download.docker.com/linux/debian stretch InRelease
Get:13 http://packages.cloud.google.com/apt cloud-sdk-stretch/main amd64 Packages [32.5 kB]
Get:14 http://packages.cloud.google.com/apt google-cloud-packages-archive-keyring-stretch/main amd64 Packages [380 B]
Fetched 32.9 kB in 0s (37.8 kB/s)                           
Reading package lists... Done
# 

Solution 2:

The accepted answer didn't work for me.

Eventually I noticed that to install the google sdk I used the following, copied directly from the google documentation:

echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get install apt-transport-https ca-certificates gnupg
sudo apt-get update && sudo apt-get install google-cloud-sdk

Eventually I noticed that /etc/apt/sources.list.d/google-cloud-sdk.list had a reference to a gpg file, which I thought might be the offending "NO_PUBKEY 6A030B21BA07F4FB" mismatch:

deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main

When I went to open the gpg file (/usr/share/keyrings/cloud.google.gpg) it didn't exist. So I edited google-cloud-sdk.list to remove the reference:

deb https://packages.cloud.google.com/apt cloud-sdk main

And after that, I was able to update with apt-get update without issue.

Slightly off topic - fixing previous google sdk install

Then I remembered that installed the google sdk and kubectl using snap, because I got an error, and I hoped this might fix it. The installer suggested snap when it couldn't find the proper repositories.

My original install commands:

snap install google-cloud-sdk --classic
snap install google-cloud-sdk --classic

So, I removed the snap versions and installed the regular versions.

snap remove google-cloud-sdk
snap remove kubectl
sudo apt-get install kubectl
sudo apt-get install google-cloud-sdk