Deploying loklak on Google Cloud Platform with Kubernetes

Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.


Follow these 10 steps to get an instance of loklak running on Google Cloud platform using Kubernetes.

Note: The document uses predefined names for various properties like project ID and docker image name to avoid confusion. You may want to change them when needed.

1. Create Google Cloud Platform Account

Visit and follow on-screen instructions to create an account and get the free trial.

2. Create a Project

Create a new project with desired name and ID.


3. Create a Container Engine for the Project

Go to and wait for the container engine to get ready. You may need to select the project from the project section in the top-left corner.

4. Open the Google Cloud Shell

In the top-right panel, click the shell button.

screenshot from 2017-05-14 20-11-27

You’ll be greeted by an online console.

screenshot from 2017-05-14 20-19-07

5. Clone the loklak project

$ git clone
$ cd loklak_server/

6. Build the Docker Image and Push to Google Container Registry

$ docker build -t .
$ gcloud docker -- push

This makes our cloud registry ready. Let us create a Kubernetes cluster where we can deploy this.

7. Creating a Container Cluster

gcloud provides easy to use interface for creating clusters. Let us take a look at the properties that we can configure while creating a cluster.

| Argument | Function | Allowable Values | |————-|————|———————-| | --num-nodes | Number of nodes in the cluster. | A natural number | | --machine-type | Type of each machine in the cluster. |

  • f1-micro
  • g1-small
  • n1-standard-{1,2,4,8}
  • n1-highmem-{2,4,8}
  • n1-highcpu-{2,4,8} | | --zone | Zone where nodes would be located. | See Compute Engine Docs |

    For this example, let us create a cluster with following command -

    $ gcloud container clusters create loklak-cluster --num-nodes 3 --machine-type n1-standard-1 --zone us-central1-c

    This will take a few minutes to complete. After done, you can see a new cluster active on your console.

    screenshot from 2017-05-14 21-01-12

  • 8. Create a Deployment for the Container Registry

    $ kubectl run loklak --port=80
    deployment "loklak" created

    You can see a list of deployments by running the following commands -

    $ kubectl get deployments
    loklak    1         1         1            1           2m

    9. Expose the Deployment

    With the server now deployed internally on Google Cloud Platform, we need to expose it to the Internet. For this, we use the following command -

    $ kubectl expose deployment loklak --type=LoadBalancer
    service "loklak" exposed

    Now, the platform will assign an external IP to the application. This may take some time. Run the following command to see the assigned external IP -

    $ kubectl get services
    NAME         CLUSTER-IP    EXTERNAL-IP     PORT(S)        AGE
    kubernetes   <none>          443/TCP        10m
    loklak   80:30287/TCP   1m

    10. Visit the Webpage

    On a browser, visit the deployment using the external IP ( in this case).