A Kubernetes Tale: Part II — Gotta Kubernetise ’em all

Make your application join the grown-ups table

Image for post
Image for post
Photo by Andrew Neel on Unsplash
Image for post
Image for post

Before starting

The code 👾

The costs 💸

Setting up the environment

Image for post
Image for post

Create the cluster

Link your terminal with your GCP account

Image for post
Image for post

Connect to your brand new cluster

Image for post
Image for post
This is how your cluster should look like on the list.
Once you run the connect to the cluster, you’ll see a message saying that kubeconfig was correctly configured
Once you run the connect to the cluster, you’ll see a message saying that kubeconfig was correctly configured
Once you run the command, you’ll see something like this, meaning that the connection was successful

Setting up a container registry access

Creating the deployment

Image for post
Image for post
The dotted lines are optional and will depend on the needs of the deployment

Pushing to the Container Registry

unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication
Image for post
Image for post
Image for post
Image for post
On the left, you can observe how the image will appear under the Container Registry. On the right, it’ll show how it’s actually stored in Cloud Storage: the many files there are the different layers of your image.

Create a Service

Create ConfigMap and Secrets

Visit base64decode.org to see the actual values of the Secrets

Putting it all together: Creating the Deployment

Image for post
Image for post

Wrapping up

Image for post
Image for post
Run kubectl get pods -o wide to get a nice overview of your running Pods
Image for post
Image for post
We can see that when requesting the state of our Service, it contains our two Pods with their corresponding ports.

Testing the deployment

Image for post
Image for post
Image for post
Image for post
If you hit it multiple times, you should see that the responding IP changes

One last word

Technology enthusiast. Less is more.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store