When you’ve done the SDK installation in your Linux workstation. list the components you have installed, then you will see the full list additional components from gcp SDK:
gcloud components list
gcloud components install <COMPONENT_ID>
gcloud components install kubectl
Then follow the instruction from the kubernetes official documentation, check the “bash-completion” and finally issue the command below:
echo "source <(kubectl completion bash)" >> ~/.bashrc
Even you can go directly through your .bashrc (sudo) to add manually, it should look like:
1# User specific aliases and functions
2
3# The next line updates PATH for the Google Cloud SDK.
4
5if [ -f '/home/jose/Downloads/google-cloud-sdk/path.bash.inc' ]; then . '/home/jose/Downloads/google-cloud-sdk/path.bash.inc'; fi
6
7# The next line enables shell command completion for gcloud.
8
9if [ -f '/home/jose/Downloads/google-cloud-sdk/completion.bash.inc' ]; then . '/home/jose/Downloads/google-cloud-sdk/completion.bash.inc'; fi
10source <(kubectl completion bash)
I hope could it be useful; it will save a lot of time typing.