DEV Community

Cover image for Use this starter kit to quickly implement Kubernetes
Raman Sharma for DigitalOcean

Posted on • Edited on • Originally published at digitalocean.com

Use this starter kit to quickly implement Kubernetes

Organizations interested in adopting Kubernetes are often discouraged by its complexity and the time it takes to implement. Kubernetes isn’t easy to understand, and although community support for developers interested in learning about Kubernetes is robust, sifting through the seemingly endless tools and resources available can be overwhelming. DigitalOcean’s starter kit for Kubernetes is designed to help organizations save weeks of learning time in bootstrapping a production-ready cluster using curated, open tools with pre-configured examples.

The software lifecycle in the cloud

When developers discuss the software lifecycle in the cloud, it’s often broken down into Day 0, Day 1, and Day 2 Operations. Day 0 Operations focus on learning about the tool they’re interested in using, while Day 1 and Day 2 Operations is where developers typically begin to configure and deploy applications and focus on operational tasks.

Day 0 Operations for Kubernetes

Day 0 Operations focus on the developers’ understanding of Kubernetes. In this phase, developers will research Kubernetes requirements, explore high-level use cases, and learn best practices for setting up their clusters. There are many resources and tools available through the vibrant Kubernetes community to help developers develop a simple understanding of the basics of the Kubernetes cluster orchestration system.

Day 1 Operations for Kubernetes

Day 1 operations take developers through spinning up a Kubernetes cluster using a managed service and deploying their application. It’s very simple to create a cluster using DigitalOcean—it’s possible to spin up a cluster with just one command. Builders are free to choose how they prefer to create their cluster, often making a choice between a web interface, the command line interface, or terraform. Spinning up the Kubernetes cluster and deploying your application during Day 1 Operations allows you to verify that Kubernetes is a viable choice for your app.

Day 2 Operations for Kubernetes

Day 2 Operations for Kubernetes include the operational tasks like setting up logging, monitoring, ingress, security, backups, and optimization. Day 2 Operations is where developers often get stuck. There’s a significant time commitment to learning and implementing all the details of making a cluster production-ready. By using DigitalOcean’s starter kit for Kubernetes developers can learn through example configurations using step-by-step tutorials. And finally, they can bootstrap their own operations-ready cluster using GitOps (ArgoCD or Flux).

The DigitalOccean Kubernetes Starter Kit

Since Day 2 Operations is where developers most often find themselves stuck or moving slowly, DigitalOcean’s starter kit focuses on simplifying Day 2 operations. The step-by-step guide takes you through important operations like logging and monitoring, ingress, enabling backups, autoscaling, automation, and optimizing your cluster in a way that makes sense for you and your customers.

Logging and monitoring

Without logging and monitoring, it’s difficult to recognize areas of issue within your containers. If you run into a problem and don’t have logging and monitoring in place, you have nothing to troubleshoot and no way of finding out where the issue is.

Logging in relation to Kubernetes allows you to track errors and refine the performance of your containers. Logging is an essential function of Kubernetes management, and there are many open source strategies for cluster-level monitoring and logging. The starter kit uses Loki for logging, using promtail to send worker nodes and application logs to Loki, Grafana for visualizing and analyzing logs, and DigitalOcean block storage, or Spaces, for logs.

Monitoring allows for easier management of Kubernetes clusters through detailed reporting of memory, CPU usage, and storage. Using Kube-prom-stack, organizations can monitor the DigitalOcean control plane, nodes, and applications and receive metrics data stored in DigitalOcean block storage. Developers can also configure alertmanager to deliver important notifications through slack or email.

Ingress

In many cases, developers start with the load balancer available to them through their cloud provider. Adding one load balancer for every service can get expensive. To avoid using one Load Balancer per service, developers need a proxy inside the cluster. That’s Ingress. Ingress helps route incoming traffic to appropriate backend services. Nginx is a popular Ingress Controller and is covered in detail. For developers who need an API gateway, Ambassador is provided through the starter kit. Using Ambassador as the API gateway provides benefits such as automatic certificate management, authentication, and API publishing.

Backups

Creating backups is an absolutely critical best practice for Kubernetes management. With Velero, developers are able to back up the cluster and application configuration and data, schedule backups with pre and post hooks, and restore in the event of a disaster or when migrating over to another cluster in the same or even a different cloud.  The starter kit provides step-by-step tutorials on two of the most popular backup solutions, Velero and Triliovault, and developers can choose which one best suits their needs.

Auto-scaling

Kubernetes provides several resources that allow developers to run multiple instances of an application and create high availability configurations, but there’s still a level of uncertainty around the amount of CPU needed at any given time. Developers will often set up cluster management based on monitoring application response to load over time, but this requires manually adjusting the values and manually making changes if applications misbehave. This also doesn’t account for a load decrease, wasting resources such as CPU and RAM when applications don’t automatically scale down.

With the HorizontalPodAutoscaler (HPA), a dedicated controller automatically changes the replica set value for your application deployments. Based on the load, the HorizontalPodAutoscaler will automatically scale your deployments up or down.

Automation

GitOps is an operational approach for platform engineers and software developers where every aspect of a project’s infrastructure, including infrastructure as code files, configuration files, and application code files, are stored in git repositories.  GitOps keeps your system state synchronized with a Git repository and works with infrastructure that can be observed and described declaratively (like Kubernetes, for example). ****When a git commit is pushed to source control, it triggers a change that updates the cloud infrastructure or application. With continuous delivery, GitOps tools like  Flux CD or Argo CD fetch current configuration from the Git repository and apply required changes to your Kubernetes cluster to maintain the desired state.

When adopting GitOps, the cluster state is stored in Git. This has sensitive configuration data like secrets. Hence, sensitive configuration data should not be kept in a Git repo in clear text. The sealed secrets controller is used to encrypt the secrets outside the cluster. The step-by-step tutorials include the sealed secrets controller as part of the GitOps chapter.

Try it today

Spin up a DigitalOcean Kubernetes cluster today and test the starter kit for yourself! For those looking for more of a UI experience, you can use equivalent DigitalOcean Kubernetes 1-clicks. Those are maintained at par with the starter kit.

Try today for free
DigitalOcean Referral Badge

Top comments (0)