Creating a Kubernetes Cluster
This page shows how to run Kubernetes on Google Kubernetes Engine (GKE)

Installing Google Cloud SDK

To install gcloud and kubectl, perform the following steps:
  1. 1.
    Install the Cloud SDK, which includes the gcloud command-line tool.
  2. 2.
    Install the kubectl command-line tool
1
$ gcloud components install kubectl
Copied!

Configure default settings

Here we set the project id that will be the home for our Kubernetes nodes and the primary geographic zone for the cluster.
1
PROJECT_ID=beaconchain
2
​
3
CLUSTER_NAME=cardano
4
CLUSTER_ZONE=us-central1-a
5
​
6
# Setting a default project ID
7
$ gcloud config set project $PROJECT_ID
8
​
9
# Setting a default compute zone or region
10
$ gcloud config set compute/zone $CLUSTER_ZONE
Copied!

Creating a GKE cluster

Lets create a single zone cluster with two medium size nodes.
1
$ gcloud container clusters create $CLUSTER_NAME \
2
--disk-size=32GB \
3
--machine-type=e2-medium \
4
--node-locations=$CLUSTER_ZONE \
5
--zone=$CLUSTER_ZONE \
6
--num-nodes=2
7
​
8
Creating cluster cardano in us-central1-a... Cluster is being health-checked (master is healthy)...done.
9
​
10
NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS
11
cardano us-central1-a 1.18.12-gke.1210 34.123.140.191 e2-medium 1.18.12-gke.1210 2 RUNNING
Copied!
Great, to install Kubernetes on two nodes and network them together to form a cluster took about 1min.

Get credentials for the cluster

1
$ gcloud container clusters get-credentials $CLUSTER_NAME
2
​
3
Fetching cluster endpoint and auth data.
4
kubeconfig entry generated for cardano.
Copied!
We should now be able to use the kubectl command
1
$ kubectl cluster-info
2
​
3
Kubernetes master is running at https://34.123.140.191
4
GLBCDefaultBackend is running at https://34.123.140.191/api/v1/namespaces/kube-system/services/default-http-backend:http/proxy
5
KubeDNS is running at https://34.123.140.191/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
6
Metrics-server is running at https://34.123.140.191/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy
Copied!
Last modified 10mo ago