Create a Kubernetes Cluster in GCE in 5 minutes

Pubudu Gunatilaka
3 min readMar 19, 2018

--

Prerequisites

When you create an account in GCE and you will get $300 worth credits.

Go to the Google compute engine and create a Kubernetes cluster as below.

Based on your requirements, change the machine type and the number of cluster nodes.

To connect to the Kubernetes cluster, you need to do the followings.

  1. Obtain credentials for google cloud

Enter the following command in your terminal. This will create a browser session for you to enter the google account credentials.

gcloud auth login

2. Configure kubectl CLI for the cluster

In the Kubernetes clusters menu, click on the Connect button to view the command to connect to the cluster. Enter the command in your terminal.

3. Start a proxy to connect to the Kubernetes API

Use the following command to run the proxy to connect. It will start to serve in port 8001.

kubectl proxy

4. Access the Kubernetes dashboard with the following link.

http://localhost:8001/ui

To sign in, you need to have an access token.

5. Get an access token

Use the following command to find the access token.

kubectl config view

With the access token you can sign in to the Kubernetes dashboard.

Notes:

  1. You can use kubectl command line instead of the Kubernetes dashboard.

2. By default, incoming traffic which come from outside network is blocked. You need to open relevant ports such as 80, 443 by applying a firewall rule. Under VPC Network menu, you can find the firewall rules menu.

--

--

Pubudu Gunatilaka

Senior Technical Lead @ WSO2 | Committer and PMC Member - Apache Stratos | PaaS Enthusiastic