Install Google Cloud components error from gcloud command

The Cloud SDK component manager only works if you don't install the SDK through another package manager. If you want to use the component manager, you can install using one of these methods:

https://cloud.google.com/sdk/downloads#versioned

https://cloud.google.com/sdk/downloads#interactive

Additional packages are available in our deb and yum repos so all the same components are available, you just need to use your existing package manager to install them:

https://cloud.google.com/sdk/downloads#apt-get

https://cloud.google.com/sdk/downloads#yum


To add some more context to this answer for the Ubuntu OS, these are the steps that I took when I had already installed google-cloud-sdk using the apt-get package manager

  1. Remove the existing installation using

    sudo apt-get remove google-cloud-sdk

  2. Navigate to https://cloud.google.com/sdk/docs/quickstart-linux and follow the steps to download the correct tar.gz package for your system

  3. Navigate to the download directory and unzip the archive using

    tar -zxf google-cloud-sdk-*

  4. Install the SDK using

    ./google-cloud-sdk/install.sh

  5. Make the gcloud command available by either:

    • Running source ~/.bashrc or
    • Closing your current terminal session and opening a new one

Using this installation I was then able to update and install kubectl with the following commands

gcloud components update
gcloud components install kubectl

In case apt or apt-get does not uninstall gcloud try with snap remove google-cloud-sdk.

This might be the case if you use a newer Ubuntu version (eg. LTS 18.04).