kubectl not installed with gcloud SDK

2.5k Views Asked by At

I installed gcloud SDK and everything went fine. However I'm trying to use kubectl and it hasn't been installed.

I run the following commands:

gcloud components update preview
All components are up to date.
gcloud components update alpha
All components are up to date.

So seems like everything is up to date. However command kubectl is not there.

This is not a PATH issue because I checked the file in gcloud's bin folder and it is there as it is in other of my installations where it was installed correctly.

I'm running Ubuntu 14.04 on AWS.

3

There are 3 best solutions below

1
On BEST ANSWER

It appears that you need to run gcloud components update kubectl. I'm not sure why (this didn't used to be required).

0
On

Note that you can also install via homebrew using:

brew uninstall kubernetes-cli

but I wouldn't recommend that, since it was installing version 0.17.1 and gcloud is currently using 18.1.

I just uninstalled the homebrew version and used the accepted answer to grab it via gcloud: gcloud components update kubectl

0
On

Had the same issue, everything was uptodate, but it didn't recognize "kubectl"

Nevertheless, found it here::

find / -name 'kubectl'

/usr/lib/google-cloud-sdk/bin/kubectl

So added the path to /etc/bash.bashrc (ubuntu 14.04)

echo "export PATH=$PATH:/usr/lib/google-cloud-sdk/bin"  >> /etc/bash.bashrc

Relogged in to SDK node and to the google cloud, and now it works fine:

kubectl   

kubectl controls the Kubernetes cluster manager.

Find more information at https://github.com/kubernetes/kubernetes.
...