/
create_cluster.sh
34 lines (30 loc) · 1.29 KB
/
create_cluster.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Create kubernetes cluster with 4 nodes for self-sup experiments
CLUSTER_NAME=self-sup
MIN_NODES=0
MAX_NODES=1 # 16
START_NODES=1 # 8
gcloud beta container --project "beyond-dl-1503610372419" \
clusters create "$CLUSTER_NAME" \
--zone "europe-west4-a" --no-enable-basic-auth \
--cluster-version "1.15.12-gke.6002" \
--machine-type "n1-standard-4" \
--image-type "UBUNTU" \
--disk-type "pd-standard" \
--disk-size "20" \
--metadata disable-legacy-endpoints=true \
--scopes "https://www.googleapis.com/auth/cloud-platform" --preemptible \
--max-nodes "$MAX_NODES" \
--min-nodes "$MIN_NODES" \
--num-nodes "$START_NODES" \
--enable-ip-alias \
--enable-stackdriver-kubernetes \
--network "projects/beyond-dl-1503610372419/global/networks/default" \
--subnetwork "projects/beyond-dl-1503610372419/regions/europe-west4/subnetworks/default" \
--default-max-pods-per-node "110" \
--no-enable-master-authorized-networks --addons HorizontalPodAutoscaling,HttpLoadBalancing \
--enable-autoupgrade --enable-autorepair \
--max-surge-upgrade 1 --max-unavailable-upgrade 0 --enable-tpu
# Apply a quota to the cluster that matches preemptible resources
kubectl create namespace quota-pod
kubectl apply -f quota.yaml --namespace=quota-pod
gcloud beta container clusters update $CLUSTER_NAME --autoscaling-profile optimize-utilization