How to connect to GKE (Google cloud Kubernetes)
Before you start you need proper GCP and GKE access.
Install Gcloud SDK:
1. DOWNLOAD THE BINARY Install the gcloud CLI | Google Cloud CLI Documentation
If you have MAC, you can use Hoebrew: https://formulae.brew.sh/cask/google-cloud-sdk
Install command:
brew install --cask google-cloud-sdk
2. Extract the binary and run
3. Run the installation script using the following command:./google-cloud-sdk/install.sh
4. To initialize the gcloud CLI, run gcloud init
:
5. Download and install kubectl for kubernetes :
Windows: Install and Set Up kubectl on Windows
Linux: Install and Set Up kubectl on Linux
macOS: Install and Set Up kubectl on macOS
or you may install kubectl through gcloud
gcloud components install kubectl
Configure Google Cloud
Perform the following actions to authenticate and set project:
gcloud auth login
gcloud config set project <PROJECT NAME>
Configure Kubectl
Take a backup of your existing KUBECONFIG file, if any.
Run the following commands to create a KUBECONFIG file: you can get the command from "Connect" option of GKE cluster in gcloud console.
gcloud container clusters get-credentials <GKE CLUSTER Name> --region <GKE Cluster Region>
No comments