provision-k8s.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. #
  3. # This script is intended to be used for internal testing only, to create the artifacts necessary for
  4. # testing and deploying this code in a sample GKE cluster.
  5. PROJECT=neo4j-helm
  6. CLUSTER=${1:-helm-test}
  7. ZONE=us-central1-a
  8. MACHINE=n1-highmem-4
  9. NODES=4
  10. API=beta
  11. echo "Creating GKE cluster $CLUSTER... without using beta"
  12. gcloud container clusters create $CLUSTER \
  13. --zone "$ZONE" \
  14. --project $PROJECT \
  15. --machine-type $MACHINE \
  16. --num-nodes $NODES \
  17. --enable-ip-alias \
  18. --no-enable-autoupgrade \
  19. --max-nodes "10" \
  20. --enable-autoscaling \
  21. --cluster-version "1.20"
  22. echo "Fixing kubectl credentials to talk to $CLUSTER"
  23. gcloud container clusters get-credentials $CLUSTER \
  24. --zone $ZONE \
  25. --project $PROJECT
  26. # Configure local auth of docker so that we can use regular
  27. # docker commands to push/pull from our GCR setup.
  28. # gcloud auth configure-docker
  29. # Bootstrap RBAC cluster-admin for your user.
  30. # More info: https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control
  31. echo "Creating cluster role binding for $CLUSTER"
  32. kubectl create clusterrolebinding cluster-admin-binding \
  33. --clusterrole cluster-admin --user $(gcloud config get-value account)
  34. echo "Done"
  35. exit 0