Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. ####################
  2. # Create a cluster #
  3. ####################
  4.  
  5. PROJECT=[...] # Replace `[...]` with the name of the GCP project (e.g. jx).
  6.  
  7. CLUSTER_NAME=[...] # Replace `[...]` with the name of the cluster (e.g., jx-boot)
  8.  
  9. gcloud auth login
  10.  
  11. gcloud container clusters \
  12. create $CLUSTER_NAME \
  13. --project $PROJECT \
  14. --region us-east1 \
  15. --machine-type n1-standard-2 \
  16. --enable-autoscaling \
  17. --num-nodes 1 \
  18. --max-nodes 2 \
  19. --min-nodes 1
  20.  
  21. kubectl create clusterrolebinding \
  22. cluster-admin-binding \
  23. --clusterrole cluster-admin \
  24. --user $(gcloud config get-value account)
  25.  
  26. #######################
  27. # Destroy the cluster #
  28. #######################
  29.  
  30. gcloud container clusters \
  31. delete $CLUSTER_NAME \
  32. --region us-east1 \
  33. --quiet
  34.  
  35. # Remove unused disks to avoid reaching the quota (and save a bit of money)
  36. gcloud compute disks delete \
  37. --zone us-east1-b \
  38. $(gcloud compute disks list \
  39. --filter="zone:us-east1-b AND -users:*" \
  40. --format="value(id)") --quiet
  41. gcloud compute disks delete \
  42. --zone us-east1-c \
  43. $(gcloud compute disks list \
  44. --filter="zone:us-east1-c AND -users:*" \
  45. --format="value(id)") --quiet
  46. gcloud compute disks delete \
  47. --zone us-east1-d \
  48. $(gcloud compute disks list \
  49. --filter="zone:us-east1-d AND -users:*" \
  50. --format="value(id)") --quiet
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement