title | description |
---|---|
GCP Google Kubernetes Engine Access to Multiple Clusters |
Implement GCP Google Kubernetes Engine Access to Multiple Clusters |
- We should have the two clusters created and ready
- standard-cluster-private-1
- autopilot-cluster-private-1
- Configure access to Multiple Clusters
- Understand kube config file $HOME/.kube/config
- Understand kubectl config command
- kubectl config view
- kubectl config current-context
- kubectl config use-context
- kubectl config get-context
- kubectl config get-clusters
- Verify if you have any two GKE Clusters created and ready for use
- standard-cluster-private-1
- autopilot-cluster-private-1
# Clean existing kube configs
cd $HOME/.kube
>config
cat config
- Understand commands
- kubectl config view
- kubectl config current-context
# View kubeconfig
kubectl config view
# Configure kubeconfig for kubectl: standard-cluster-private-1
gcloud container clusters get-credentials standard-cluster-private-1 --region us-central1 --project kdaida123
# View kubeconfig
kubectl config view
# View Cluster Information
kubectl cluster-info
# View the current context for kubectl
kubectl config current-context
# Configure kubeconfig for kubectl: autopilot-cluster-private-1
gcloud container clusters get-credentials autopilot-cluster-private-1 --region us-central1 --project kdaida123
# View the current context for kubectl
kubectl config current-context
# View Cluster Information
kubectl cluster-info
# View kubeconfig
kubectl config view
- Understand the kubectl config command use-context
# View the current context for kubectl
kubectl config current-context
# View kubeconfig
kubectl config view
Get contexts.context.name to which you want to switch
# Switch Context
kubectl config use-context gke_kdaida123_us-central1_standard-cluster-private-1
# View the current context for kubectl
kubectl config current-context
# View Cluster Information
kubectl cluster-info
# List Contexts
kubectl config get-contexts
# List Clusters
kubectl config get-clusters