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

Solution 1:

via apt-key:

# curl -s | apt-key add -
# apt-get update
Ign:1 stretch InRelease
Hit:2 stretch/updates InRelease
Hit:3 stretch-updates InRelease
Hit:4 stretch-backports InRelease           
Hit:5 stretch Release                       
Get:6 cloud-sdk-stretch InRelease [6,377 B]
Get:7 google-compute-engine-stretch-stable InRelease [3,843 B]
Ign:8 stable InRelease
Get:9 google-cloud-packages-archive-keyring-stretch InRelease [3,876 B]
Hit:10 stable Release
Hit:12 stretch InRelease
Get:13 cloud-sdk-stretch/main amd64 Packages [32.5 kB]
Get:14 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-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-sdk main

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

deb 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