Tag Archives: google

Kubernetes Cluster on Google Cloud and Expose Couchbase Service

kubernetes-logo

This blog is part of a multi-part blog series that shows how to run your applications on Kubernetes. It will use the Couchbase, an open source NoSQL distributed document database, as the  Docker container.

The first part (Couchbase on Kubernetes) explained how to start the Kubernetes cluster using Vagrant. The second part (Kubernetes on Amazon) explained how run that setup on Amazon Web Services.

This third part will show:

  • How to setup and start the Kubernetes cluster on Google Cloud
  • Run Docker container in the Kubernetes cluster
  • Expose Pod on Kubernetes as Service
  • Shutdown the cluster

Here is a quick overview:

Kubernetes Cluster on Google Cloud

Let’s get into details!

Getting Started with Google Compute Engine provide detailed instructions on how to setup Kubernetes on Google Cloud.

Download and Configure Google Cloud SDK

There is a bit of setup required if you’ve never accessed Google Cloud on your machine. This was a bit overwhelming and wish can be simplified.

  • Create a billable account on Google Cloud
  • Install Google Cloud SDK
  • Configure credentials: gcloud auth login
  • Create a new Google Cloud project and name it couchbase-on-kubernetes
  • Set the project: gcloud config set project couchbase-on-kubernetes
  • Set default zone: gcloud config set compute/zone us-central1-a
  • Create an instance: gcloud compute instances create example-instance --machine-type n1-standard-1 --image debian-8
  • SSH into the instance: gcloud compute ssh example-instance
  • Delete the instance: gcloud compute instances delete example-instance

Setup Kubernetes Cluster on Google Cloud

Kubernetes cluster can be created on Google Cloud as:

Make sure KUBERNETES_PROVIDER is either set to gce or not set at all.

By default, this provisions a 4 node Kubernetes cluster with one master. This means 5 Virtual Machines are created.

If you downloaded Kubernetes from github.com/kubernetes/kubernetes/releases, then all the values can be changed in cluster/aws/config-default.sh.

Starting Kubernetes on Google Cloud shows the following log. Google Cloud SDK was behaving little weird but taking the defaults seem to work:

There are a couple of unbound variables and a WARNING message, but that didn’t seem to break the script.

Google Cloud Console shows:

Google Cloud Compute Instances On Kubernetes Cluster

Five instances are created as shown – one for master node and four for worker nodes.

Run Docker Container in Kubernetes Cluster on Google Cloud

Now that the cluster is up and running, get a list of all the nodes:

It shows four worker nodes.

Create a Couchbase pod:

Notice, how the image name can be specified on the CLI. This command creates a Replication Controller with a single pod. The pod uses arungupta/couchbase Docker image that provides a pre-configured Couchbase server. Any Docker image can be specified here.

Get all the RC resources:

This shows the Replication Controller that is created for you.

Get all the Pods:

The output shows the Pod that is created as part of the Replication Controller.

Get more details about the Pod:

Expose Pod on Kubernetes as Service

Now that our pod is running, how do I access the Couchbase server?

You need to expose it outside the Kubernetes cluster.

The kubectl expose command takes a pod, service or replication controller and expose it as a Kubernetes Service. Let’s expose the replication controller previously created and expose it:

Get more details about Service:

The Loadbalancer Ingress attribute gives you the IP address of the load balancer that is now publicly accessible.

Wait for 3 minutes to let the load balancer settle down. Access it using port 8091 and the login page for Couchbase Web Console shows up:

Google Cloud Kubernetes Couchbase Login Page

Enter the credentials as “Administrator” and “password” to see the Web Console:

Google Cloud Kubernetes Couchbase Web Console

And so you just accessed your pod outside the Kubernetes cluster.

Shutdown Kubernetes Cluster

Finally, shutdown the cluster using cluster/kube-down.sh script.

Enjoy!

Source: http://blog.couchbase.com/2016/march/kubernetes-cluster-google-cloud-expose-service

Minecraft Server on Google Cloud – Tech Tip #82

Minecraft Logo

Bukkit Logo

If you’ve not followed the Minecraft/Bukkit saga over the past few months, Bukkit and CraftBukkit downloads were taken down by DMCA because a developer (@wolvereness) wanted Mojang to open up. Mojang (@vubui) posted an official statement in their forums. The general feeling is that @wolvereness left the Bukkit community hanging, and Mojang is not responsible for this debacle.

One of my friends (@ryanmichela), and a contributor to Bukkit, prepared a slide deck explaining the unfortunate debacle:

Anyway, leaving all the gory details behind, this blog will show how to get started with Bukkit 1.8.3.

What?

You just said, Bukkit was shutdown by DMCA.

SpigotMC LogoHail Spigot for reviving Bukkit, and updating to 1.8.3!

Its still not clear how did Spigot get around DMCA shutdown but the binaries seem to be available again, at least for now.

As a refresher, Bukkit is the API used by developers to make plugins. CraftBukkit is the modified Minecraft server that can understand plugins made by the Bukkit API.

Minecraft Server Hosting on OpenShift already explained how to setup a Minecraft server on OpenShift. This Tech Tip will show how to get a Minecraft server running on Google Cloud.

Lets get started!

Get Started with Google Cloud

Google Cloud Platform logo

  1. Sign up for a free trial at cloud.google.com. This gives you credit of $300, which should be pretty decent to begin with.

Create and Configure Google Compute Engine

  1. Go to console.developers.google.com and create a new project by specifying the values as shown:Create Project on Google Cloud
  2. In console.developers.google.com, go to “Compute”, “Compute Engine”, “Networks”, “default”, “New firewall rule” and enter the values as shown and click on “Create”.Google Cloud Firewall Rule
  3. In the left menu bar, click on “VM Instances” under “Compute Engine”, “Create instance”. Take everything default except:
    1. Provide a name as “minecraft-instance”
    2. Change Image to Ubuntu 14.10.
    3. Change External IP to “New static IP address” and fill in the details. IP address is automatically assigned.

    Exact values are shown here:

    Google Cloud Create Instance

    And click on “Create”.

    Note down the IP address, this will be used later to connect from Minecraft launcher.

  4. Click on the newly created instance, “Add tags”, and specify “minecraft” tag. Exact same tag on the VM instance and Firewall rule ensures that the rule is applied to the appropriate instance.

Install JDK, Git, and Spigot

In console.developers.google.com, select the recently created instance, click on “SSH”, “Open in browser window”. The software is installed in the shell window.

Install JDK

Make sure to answer questions and accept license during the install. Using OpenJDK 8 to install Spigot gives the following exception:

Install Git

This is required for installing Spigot.

Install Spigot

Download and Install Spigot

A successful completion of this task shows the following message:

Start Minecraft Server on Google Cloud

Run the server as:

This will generate “eula.txt”. Accept license agreement by giving the following command:

Run server as:

This will start the CraftBukkit 1.8 server in background.

Connect to Minecraft Server from the Client

Launch Minecraft client and create a new Minecraft server as:

Google Cloud Minecraft Multiplayer

Clicking on Done shows:

Google Cloud Multiplayer Minecraft Server

Now your client can connect to the Minecraft server running on Google Cloud.
Google Cloud Minecraft Client

The server is now live. Add 104.155.38.193  to your Minecraft launcher and put some Google resources to test :)

I was hoping to provide a script that can be run using Google Cloud SDK but the bundled CLI seems to have some issues creating the project. CLI equivalent for other commands can be easily seen from the console itself.

Enjoy and happy Minecrafting!