Deploy apps Fast with Google Kubernetes (GKE) UI

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

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.

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.

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.

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

Creating a Kubernetes Cluster

Now we can hit the

Create cluster

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.

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

Create

button.

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

Node.Js Express App

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

And this is Dockerfile we will use:

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

$ docker build -t alonronin/node-env .

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

$ 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

button at the top.

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

Done

button and after on the

Continue

button to the Configuration section.

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

Deploy

button and press it.

GKE will generate everything for us, it will create the

Deployment

with default of

3

replicas and an autoscale (HPA) between

1 - 5

.

Creating a Service

Next we will need to create a service for the

Deployment

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

button

.

The services will be exposed at port

80

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 is

3000

in our express app listening port.

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

Expose

button.

Now that we have a

Service

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

Ingress

for it.

Creating an Ingress

Just select the service and click the

Create Ingress

button at the top.

In the Host and path rules select our

Service

as the Backends service.

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

HTTPS

as the HTTP will be created by default.

We can create an SSL certificate by clicking

Create a new certificate

from the Certificate drop down.

Let’s choose

Create Google-managed

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

Create

button.

The google platform will create our

Ingress

and transfer traffic from Google’s Load Balancers to our

Cluster

and from the

Ingress

to our

Service

and from there to our

Deployment

.

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

A

record for our domain to that IP Address.

Check the certificate status

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

Active

or

Provisioning

.

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

It’s alive!

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

Conclusion

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

We accomplished to:

  • 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.

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

read original article here