Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
k8s
gcloud config set project ${PROJECT_ID}
gcloud sql instances create ex-kills-db-us-west1 --region=us-west1 --database-version=POSTGRES_9_6 --tier=db-f1-micro
gcloud sql instances describe ex-kills-db-us-west1 #=> connectionName: ex-kills:us-west1:ex-kills-db-us-west1
gcloud sql users set-password postgres --instance=ex-kills-db-us-west1 --prompt-for-password #=> 123456
gcloud container clusters create ex-kills-cluster-us-west1 --num-nodes=1 --zone=us-west1 --scopes=gke-default,sql-admin
gcloud container clusters get-credentials --zone=us-west1 ex-kills-cluster-us-west1
gcloud config set container/cluster ex-kills-cluster-us-west1
mkdir -p /tmp/cloudsql
cloud_sql_proxy -dir=/tmp/cloudsql
psql -h /tmp/cloudsql/ex-kills:us-west1:ex-kills-db-us-west1 -U postgres
gcloud builds submit --substitutions=_TAG=v2 .
gcloud container images list
gcloud builds list
kubectl run ex-kills-web --image=gcr.io/ex_kills/ex_kills:v10 # --port 8080 #=> deployment.apps/ex-kills-web created
kubectl get pods
kubectl logs ex-kills-web-684474fddc-jl9dh
# upgrade
kubectl set image deployment/ex-kills-web ex-kills-web=gcr.io/ex_kills/ex_kills:v3
pg_dump -U postgres -h /tmp/cloudsql/ex-kills:europe-west2:ex-kills-db ex_kills_repo > ex_kills.pgsql
pg_dump --column-inserts --data-only ex_kills_repo > ex_kills.pgsql
# pg_dump --table=<table> <database>
psql -h /tmp/cloudsql/ex-kills:us-west1:ex-kills-db-us-west1 -U postgres ex_kills_repo < ex_kills.pgsql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment