Deploy apps Fast with Google Kubernetes (GKE) UI

609 reads

@ alonronin Alon Valadji A JavaScript enthusiast with a mentorship core and a 100% hands-on approach.

As a tech leader and developer, I like to focus my effort in writing code or invest my efforts in architecting web software.

reactions

I like to move fast from code to deploy, especially in the development process, and using great ui solution, such as Google's Cloud Kubernetes Engine is very useful for me, as I can avoid getting deep diving into DevOps orchestration.

reactions

In this article I'll go thru on how to deploy a node containerized application to Google's Kubernetes Cluster using only the GKE UI.

reactions

First we will need to create a GKE Cluster. Just login to google's cloud console and from the menu head to Kubernetes Engine -> Clusters.

reactions

Before we can actually create the cluster, we'll need to wait for the Kubernetes Engine Api beeing enabled.

reactions

Creating a Kubernetes Cluster

Now we can hit the

Create cluster

reactions

button and select our desired configuration. Google offer almost every preset needed to get started, either to play around or to set up a production ready high availability Kubernetes clusters.

We'll go with the default Standard Cluster.

reactions

Select the Zone nearest to you and the Master version (higher the better), leave the rest with the default settings and hit the

Create

reactions

button.

Google will now create the cluster for us. Meanwhile we can dockerize our node application.

reactions

Node.Js Express App

This is our simple express app that will display the request headers and the hostname in JSON:

reactions

And this is Dockerfile we will use:

reactions

To buid the image we will run docker build command with the your dockerhub repo:

reactions

$ docker build -t alonronin/node-env .

And push it to dockerhub's using the docker push command:

reactions

$ docker push alonronin/node-env

Creating a Deployment

Now we can deploy it to our newly created cluster. To do that we will hit the

Deploy

reactions

button at the top.

In the Container section let's choose existing image and enter our dockerhub's image and hit the

Done

Continue

reactions

button and after on thebutton to the Configuration section.

In the application name field we will enter our app name, node-env, scroll down to the

Deploy

reactions

button and press it.

GKE will generate everything for us, it will create the

Deployment

3

1 - 5

reactions

with default ofreplicas and an autoscale (HPA) between

reactions

Creating a Service

Next we will need to create a service for the

Deployment

button

reactions

, let's click on the deployment and hit the expose

The services will be exposed at port

80

3000

reactions

by default, but you can change that to any port you want, and we will need to tell it the target port of the container, which isin our express app listening port.

Let's select Node Port as the service type and click the

Expose

reactions

button.

Now that we have a

Service

Ingress

reactions

Creating an Ingress

we can configure it to receive a traffic from the web, we need to create anfor it.

Just select the service and click the

Create Ingress

reactions

button at the top.

In the Host and path rules select our

Service

reactions

as the Backends service.

In the Frontend configuration we will need to select the type of traffic from the web, let's select

HTTPS

reactions

as the HTTP will be created by default.

We can create an SSL certificate by clicking

Create a new certificate

reactions

from the Certificate drop down.

Let's choose

Create Google-managed

Create

reactions

certificate so it will issued and renewed automatically by google. Add the domain and the name for the certificate and click thebutton.

The google platform will create our

Ingress

Cluster

Ingress

Service

Deployment

reactions

and transfer traffic from Google's Load Balancers to ourand from theto ourand from there to our

When the Ingress is ready it will issue an IP address. We can create an

A

reactions

Check the certificate status

record for our domain to that IP Address.

Clicking on our Ingress and then on the Load Balancer Link, we can check out if our certificate is

Active

Provisioning

reactions

or

This can take up until an hour, according to google's docs, so be patient.

reactions

It's alive!

Going to the domain we configured we can see everything is just fine and our express app is working as expected.

reactions

Conclusion

So we managed to create a Kubernetes cluster, ready for production, only by using the GKE UI.

reactions

We accomplished to:

reactions

Create docker image for our application and push it to Dockerhub's repo.

Create a Kubernets Cluster

Create a Deployment

Create a Service

Create an Ingress

Create an auto managed SSL Certificate

All of these actions can be done using the kubectl command line tool, by applying yaml files configurations or creating a Helm chart.

reactions

If you have any question, suggestion or you find a mistake I've made, feel free to comment on it.

reactions

reactions

reactions

reactions

Share this story @ alonronin Alon Valadji Read my stories A JavaScript enthusiast with a mentorship core and a 100% hands-on approach.

Tags