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.
Now we can hit the
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
Google will now create the cluster for us. Meanwhile we can dockerize our node application.
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
Now we can deploy it to our newly created cluster. To do that we will hit the
button at the top.
In the Container section let's choose existing image and enter our dockerhub's image and hit the
button and after on the
button to the Configuration section.
In the application name field we will enter our app name, node-env, scroll down to the
button and press it.
GKE will generate everything for us, it will create the
with default of
replicas and an autoscale (HPA) between
1 - 5
Next we will need to create a service for the
, let's click on the deployment and hit the expose
The services will be exposed at port
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
in our express app listening port.
Let's select Node Port as the service type and click the
Now that we have a
we can configure it to receive a traffic from the web, we need to create an
Just select the service and click the
button at the top.
In the Host and path rules select our
as the Backends service.
In the Frontend configuration we will need to select the type of traffic from the web, let's select
as the HTTP will be created by default.
We can create an SSL certificate by clicking
from the Certificate drop down.
Create a new certificate
certificate so it will issued and renewed automatically by google. Add the domain and the name for the certificate and click the
The google platform will create our
and transfer traffic from Google's Load Balancers to our
and from the
and from there to our
When the Ingress is ready it will issue an IP address. We can create an
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
This can take up until an hour, according to google's docs, so be patient.
Going to the domain we configured we can see everything is just fine and our express app is working as expected.
So we managed to create a Kubernetes cluster, ready for production, only by using the GKE UI.
We accomplished to:
If you have any question, suggestion or you find a mistake I've made, feel free to comment on it.
Create your free account to unlock your custom reading experience.