Image for post
Image for post
Kubernetes Consulting at HiFX

What Goes Into a Successful Kubernetes Deployment?

Mohan Thomas
Nov 24, 2020 · 5 min read

Kubernetes or K8s is an open-source system used to automate deployment, management of containerized applications, and scaling. This system aims to group containers to make an application into logical units that allow for easier management and discovery. With 15 years of experience running production workloads at Google, Kubernetes gives you the accessibility of utilizing on-premises, hybrid, or public cloud infrastructure. As useful as Kubernetes is, actually using it is tricky, which is why one must know the most efficient way of deploying and managing it to optimize the value it can bring to your organization.

What’s the Best Way to Deploy and Manage the Kubernetes System?

Terraform for Provisioning

While you can use other CLI-based tools to manage your Kubernetes system, the most efficient choice would be to choose Terraform as your provider. One of the most basic yet practical benefits that Terraform offers is using the same configuration language to provision the Kubernetes infrastructure and deploy its applications. Simultaneously, Terraform also provides full life cycle management that makes the provisioning process much quicker. This management entails that Terraform won’t just create resources. It will also offer a single command for creating, updating, and deleting tracked resources without you having to inspect the API to identify them. To further optimize the provisioning process, manage your infrastructure as code. This change will allow you to keep all updates under a version control system and review them before deployment.

AWS EKS for Simpler Management

AWS EKS or Amazon Elastic Kubernetes Service is the most critical complimentary service for Kubernetes. The AWS EKS makes it easy to run Kubernetes without needing to install, operate, or maintain your Kubernetes control plane. It does this by automatically managing the availability and scalability of the Kubernetes control plane nodes responsible for starting and stopping pods, scheduling pods on virtual machines, and storing cluster data. Simultaneously, AWS EKS also detects and replaces unfavorable control plane nodes for each cluster that further optimizes the Kubernetes system’s management.

Helm for Deployment

Given the Kubernetes system’s complexity, the best way to deploy it would be to simplify the process without tarnishing its efficacy. Helm does that for a Kubernetes system. It can be challenging to write and manage Kubernetes YAML manifests. For the simplest of deployments, you would need a minimum of 3 YAML manifests that have duplicated and hard-coded values.

Helm is a client/server application that simplifies this process by creating a single package advertised to your cluster. To be more specific, Helm allows for Kubernetes YAML manifests to be converted to and managed as Helm charts that are YAML manifests combined into one package. Since introducing a Helm chart to your cluster is as simple as running a single Helm install, this makes the deployment and management of applications easier.

Envoy to Facilitate the EKS

Envoy Proxy typically offers a multi-team, scalable, API-driven ingress tier capable of routing internet traffic to various upstream Kubernetes clusters. In this case, you will be using this proxy as an ingress controller to enable the ingress to the EKS cluster.

What Kind of Alert and Metric System Should I Set Up?

When it comes to Kubernetes, the most compatible alert system for it would be ElastAlert. It is a system that combines rule types and alerts, which means that the Elasticsearch gets queried frequently, and the data passes to the rule type, which determines the match. If a match occurs, it updates with one or more alerts, enabling the system to find more matches. One of the reasons why ElastAlert is the most useful is the feature, which saves its state to Elasticsearch and resumes where it stopped when initiated again. Simultaneously, any alerts that throw errors may be retired for some time by the system itself.

On the other hand, for an efficient metric system, one should pair the Kubernetes Metrics Server and the Kube-State Metric server for maximum efficiency. The Kubernetes Metrics Server is a significant source of container resource metrics and offers a single deployment that would work on most clusters. Simultaneously, it also provides callable support of up to 5000 node clusters. On the flip side, the Kube-State Metric Server is used to generate metrics from Kubernetes API objects without modification.

Which Autoscaler to Use?

The most efficient autoscaler to use from within the Kubernetes system is the Horizontal Pod Autoscaler. It implements an API resource and controller for Kubernetes. It is perfect for high traffic endpoints in the application as any case of resource starvation is handled using the cluster level autoscaler. Simultaneously, the resource determines the controller’s behavior, which allows the controller to periodically adjust the number of replicas in a replication controller or deployment to match the evaluated average CPU utilization to the specified target.

How to Optimize the Detailed Monitoring for the Kubernetes System?

Fluentd for Data Collection

The best system to utilize as a data collector and function as a DaemonSet for Kubernetes is the Fluentd. It allows you to unify the data collection so that you can understand and analyze it better. It does this efficiently by decoupling data sources from the backend system by placing a unified logging layer in between.

Elasticsearch and Kibana for Processing and Forensics

By utilizing Elasticsearch and Kibana together, the task of processing the data and logs becomes much simpler. Elasticsearch functions as a real-time, scalable search engine which provides a full-text, structured search alongside analytics. It siphons through large volumes of log data and typically deploys alongside Kibana, which acts as a useful data visualization frontend and dashboard for Elasticsearch. Combining the two software programs allows you to explore your Elasticsearch log data through a web interface to get a better insight into your Kubernetes applications.

StatsD and Grafana to Display Metrics

While StatsD fetches the metrics for the detailed monitoring of endpoints traffic, they are stored in Elasticsearch and displayed in Grafana. StatsD is a set of tools used to send, collect, and aggregate the custom metrics from any application, and they are considered the standard for business backend. Similarly, Grafana is perhaps the best technology to compose observability dashboards for metrics at this point.

Prometheus for Pod’s Resource-Based Monitoring

Being one of the best free monitoring software out there, Prometheus is utilized for resource-based monitoring and alerting. It can record real-time metrics, monitor your servers, and analyze your applications and infrastructure’s performance.

Conclusion

Our in-depth experience with containerization using docker helped in to re-engineer and deploy a large-scale web application to Kubernetes managed application for a client of ours. This resulted in faster deployment, better management and cost saving. The successful implementation was a result of months of research to identify the right tools/components to use in this migration project.

The Startup

Medium's largest active publication, followed by +752K people. Follow to join our community.

Mohan Thomas

Written by

Mohan is the co-founder and director of engineering at HiFX, helping organizations leverage the power of cloud and big data analytics.

The Startup

Medium's largest active publication, followed by +752K people. Follow to join our community.

Mohan Thomas

Written by

Mohan is the co-founder and director of engineering at HiFX, helping organizations leverage the power of cloud and big data analytics.

The Startup

Medium's largest active publication, followed by +752K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

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