GCP Notes
retrieve gserviceaccount key:
gcloud iam service-accounts keys create key.json --iam-account=drx-payment-deployer@ld-drx-prod.iam.gserviceaccount.com
Activate Service Account:
gcloud auth activate-service-account --key-file=service-account-key-file.json
gcloud auth activate-service-account serves the same function as gcloud auth login but uses a service account rather than Google user credentials.
See list of active account:
gcloud auth list
See configuration for log sink:
gcloud logging sinks describe ld-drx-prod --project=ld-shipyard | grep serviceAccount
gcloud container clusters get-credentials prod-nezbleu --region us-east1 --project ld-shipyard
In stateless we don't need blue green. We can use rolling deployment.
********************************* GCE *********************************
Login to a machine you own which does not have an external IP. This will work only if IAP is enabled.
gcloud compute ssh machine-name --tunnel-through-iap
********************************* SERVICES *********************************
Command to check the list of services that are enable currently for this project
gcloud services list
********************************* ORG *********************************
If you don't want default VPC create on project creation you can disable it at organization level
********************************* GKE *********************************
How do you upgrade the GKE Cluster
-----------------------------------------------------------------------------------------------------------------
Connect to a GKE cluster using a service account. SSH into a POD using a service account
# kubectl config view - just to check current kubectl config
gcloud auth activate-service-account --key-file=/Documents/code/payment-dec-sa.json
# gcloud auth list - to verify that service account has been activated
gcloud container clusters get-credentials prod-blue --region us-east1 --project my-shipyard
kubectl config use-context gke_ld-shipyard_us-east1_prod-blue
kubectl config set-context --current --namespace=drx-payment-dev
# kubectl config view - to verify the changes
# kubectl get pods -n drx-payment-dev - to verify access
kubectl exec my-payment-service-f87794d64-gxp4g -it -- /bin/bash
-----------------------------------------------------------------------------------------------------------------
export GOOGLE_APPLICATION_CREDENTIALS="[PATH]"
Comments
Post a Comment