All Day DevOps - Blog

Microservice Architecture on Kubernetes

Written by Derek Weeks | Aug 12, 2019 6:22:56 PM

Istanbul is home to architectural wonders of the ancient world, such as the Hagia Sophia and the Basilica Cistern, but today Istanbul brings us microservice architecture, where smaller is better.

Huseyin Babal is in Istanbul, where he is a DevOps Consultant with Kloia and the organizer of Docker Istanbul, NodeSchool Istanbul, and DevOps Underground (not held in the Basilica Cistern). At last year's All Day DevOps conference, he demonstrated how to implement a microservice architecture using Kubernetes. Huseyin’s talk was focused on an architectural overview rather than how to install Kubernetes.

Microservices divide your application’s functions into chunks that are independently deployable. Microservices are becoming an increasingly utilized tool in DevOps and CI/CD, and it is a popular subject at All Day DevOps (check out some other posts here). Kubernetes is an open-source platform to manage microservices. It is deployable on the cloud provider of your choice. AWS, Azure, and Google Cloud all provide managed instances of Kubernetes, and you can use kubespray to deploy Kubernetes in your datacenter. It helps you focus on the architecture rather than the infrastructure-level operations.

Huseyin begins talking about architecture at the high level. Most organizations need development, staging, and production environments, at a minimum. You can organize these in clusters in isolation, as you probably already do.

Or he suggests a better way - namespace-level isolation, along with this pro-tip, “Do not put all things in the default namespace, as it will be very hard to manage them in the future.”

Once your system is setup, you need to make sure you monitor everything. Prometheus is a tool you can use, and Huseyin walks through several of its capabilities and mentions an open-source tool to handle k8s-specific metrics automatically.

When you are ready to expose your application to the outside world, there are several options, such as a load balancer. However, creating a load balancer for each instance will be hard to manage and costly, so he recommends Nginx Ingress to automatically create a load balancer.

Of course, deploying Kubernetes, load balancing, and monitoring doesn’t mean you have implemented microservices. You need to have a solid architecture using best practices. Part of this is making sure the microservices can communicate well. Huseyin recommends striving to achieve the glory of REST.

Huseyin also covers using secrets, deployment scripts, project file structure, basic CI/CD with Kubernetes, distributed configuration, client code generation, and logging. Additionally, he recommends a couple tools for daily Kubernetes management: kubectx for managing your Kubernetes context and kubens for managing your Kubernetes namespace, both provided by Ahmet Alp Balkan.

You can watch his whole presentation, for free, here.


photo: Konevi

Interested in more DevOps? Register for the next All DayDevOps, November 6, 2019. ADDO is a global discussion of security, CI/CD, cloud native infrastructure, cultural transformation, site reliability engineering, and more.