-
Notifications
You must be signed in to change notification settings - Fork 128
Expand file tree
/
Copy pathcreate-gke-cluster
More file actions
executable file
·36 lines (30 loc) · 954 Bytes
/
create-gke-cluster
File metadata and controls
executable file
·36 lines (30 loc) · 954 Bytes
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
35
36
#!/bin/bash
set -v
DIR="$(dirname "$0")"
. "${DIR}/config"
# Enable APIs
gcloud services enable \
cloudapis.googleapis.com \
container.googleapis.com \
containerregistry.googleapis.com
# Create GKE cluster
gcloud beta container clusters create ${CLUSTER_NAME} \
--addons HorizontalPodAutoscaling,HttpLoadBalancing \
--zone ${CLUSTER_ZONE} \
--cluster-version ${CLUSTER_MASTER_VERSION} \
--machine-type ${CLUSTER_NODE_MACHINE_TYPE} \
--num-nodes ${CLUSTER_START_NODE_SIZE} \
--min-nodes 1 \
--max-nodes ${CLUSTER_MAX_NODE_SIZE} \
--enable-ip-alias \
--enable-stackdriver-kubernetes \
--enable-autoscaling \
--enable-autorepair \
--scopes cloud-platform
# Credentials
gcloud container clusters get-credentials ${CLUSTER_NAME} \
--zone ${CLUSTER_ZONE}
# Cluster role binding
kubectl create clusterrolebinding cluster-admin-binding \
--clusterrole=cluster-admin \
--user=$(gcloud config get-value core/account)