Now Google cloud sdk support python3.9 as well. Lets start.
Without any surprise,use your copy-paste skills to fire following script into your innocent terminal.
pkg install python3 openssh
curl -o sdk.sh sdk.cloud.google.com
chmod +x sdk.sh
./sdk.sh --install-dir=$PREFIX
Previous version with python2
python 2.7 requires because gcloud does't support python 3.9
pkg install python2 openssh
export CLOUDSDK_PYTHON='python2.7'
echo "export CLOUDSDK_PYTHON='python2.7'" >> ~/.bashrc
echo "export PATH=$PATH:$PREFIX/google-cloud-sdk/bin"
curl -o sdk.sh sdk.cloud.google.com
chmod +x sdk.sh
./sdk.sh --install-dir=$PREFIX
gcloud auth login
copy link and paste in your default browser, Choose account and copy code then fill that in terminal. now done. Let's do ssh in cloud shell.
gcloud cloud-shell ssh
You don't need to use "alpha" components for connecting to cloud shell.
Works as well, if you have up-to-date sdk.
Also it perfectly works with python3.9.
There also hidden limitations. You have a hidden network quota. After reaching it, your VM will be force terminated. If you restart it multiple times but still continue to use a lot network, e.g. uploading 2-4 GB somewhere like transfer.sh, your ability to use cloud-shell will be disabled for some time.