This article has been archived. Please see Coder Docs for the updated version.
This deployment guide shows you how to set up a Google Kubernetes Engine (GKE) cluster on which Coder can deploy.
Step 1: Set Up the GKE Cluster
You can set up a GKE cluster:
- Through the cloud console
- Using the command line
Option 1: Use the Cloud Console
- Log in to Google Cloud Console and navigate to the Kubernetes Engine page
- Click CREATE CLUSTER
- Provide a Name for your cluster and indicate the number of nodes
- Select the Location type you'd like, then choose the desired zone or region for your cluster
- Choose a Master version; Coder has been tested to work with versions greater than 1.14.6
- In the left sidebar, select your Node Pool and click Nodes. Select a Machine Configuration that will work appropriately for your expected workloads; any option is fine as long as its resource allocation is greater than the resource requirements specified
- In the left sidebar, click Networking. Near the bottom, select Enable HTTP load balancing to disable the GCE ingress controller, as well as Enable network policy to enable the networking.k8s.io/v1 Kubernetes extension
- Click Create to proceed.
Next, go to the post-deployment steps at the end of this guide to finish setting up your local environment.
Option 2: Use the Command Line
Before proceeding, make sure that the gcloud CLI is installed on your machine.
The following will spin up a Kubernetes cluster using the gcloud
command; replace the parameters and environment variables as needed to reflect those for your environment.
PROJECT_ID="MY_PROJECT_ID" CLUSTER_NAME="MY_CLUSTER_NAME" \
gcloud beta container --project "$PROJECT_ID" \
clusters create "$CLUSTER_NAME"
--zone "us-central1-a" \
--no-enable-basic-auth \
--cluster-version "1.14.7-gke.14" \
--machine-type "n1-standard-4" \
--image-type "COS" \
--disk-type "pd-standard" \
--disk-size "100" \
--metadata disable-legacy-endpoints=true \
--scopes "https://www.googleapis.com/auth/cloud-platform" \
--num-nodes "2" \
--enable-stackdriver-kubernetes \
--enable-ip-alias \
--network "projects/${PROJECT_ID}/global/networks/default" \
--subnetwork "projects/${PROJECT_ID}/regions/us-central1/subnetworks/default" \
--default-max-pods-per-node "110" \
--addons HorizontalPodAutoscaling,HttpLoadBalancing \
--enable-autoupgrade \
--enable-autorepair \
--enable-network-policy \
--enable-autoscaling
--min-nodes "2"
--max-nodes "8" \
--region "us-central1-c"
Step 2: Post-Deployment
After deploying your GKE, configure kubectl to point to your cluster:
-
Install the gcloud CLI (if you haven't already)
-
Install kubectl
gcloud components install kubectl
-
Initialize kubectl with the cluster credentials
gcloud container clusters get-credentials [CLUSTER_NAME]
-
We recommend running Coder in a separate namespace; to do so, run
kubectl create namespace coder
-
If you're running Coder in a separate namespace, change the kubectl context to point to your newly created namespace
kubectl config set-context --current --namespace=coder
Comments
0 comments
Please sign in to leave a comment.