Local Kubernetes Development
1/8/2023
Introduction
I am continually researching technology for both my professional work and personal projects. Recently, I’ve been exploring the current state of local Kubernetes (K8S) development. This is significant because it allows developers to test and iterate on Kubernetes-based applications in a controlled environment without relying on cloud infrastructure. There are now numerous options that support local, remote, and hybrid development, which is a significant improvement compared to just a few years ago.
Why Tilt?
After evaluating several tools, I decided to use Tilt, one of the more popular and mature projects in this space. Tilt stood out due to its seamless integration with local Kubernetes environments, its powerful live update feature, and its ability to streamline the local development workflow, making it a strong choice for rapid iteration and debugging. Notably, the Tilt team recently joined Docker, which, I believe, will help the project grow and evolve with additional resources, such as Docker’s extensive experience in containerization, infrastructure management, and access to a broader developer community. Tilt is simple, easy to use, well-documented, and effective—perfect for the use case presented in the video accompanying this blog post.
CNCF Projects: The Open-Source Cloud
I’ve also been exploring various projects being incubated by the Cloud Native Computing Foundation (CNCF). Looking at the landscape of CNCF projects, it’s clear that many key products and services typically offered by cloud providers are available as open-source solutions. This is beneficial for developers and businesses because open-source projects provide more flexibility, avoid vendor lock-in, and often have active communities that drive innovation and rapid feature development. For example, Prometheus offers robust monitoring capabilities similar to cloud monitoring services, while Argo CD provides continuous delivery functionality akin to managed CI/CD tools. CNCF is incubating projects that run on K8S, which can effectively replace many of the core services provided by cloud vendors. Essentially, CNCF is building an open-source cloud ecosystem. Once I realized this, I decided to dive deeper into CNCF — incubated projects to better understand what, I believe, is the future of the cloud ecosystem.
The Importance of Versatility and Cost Control
The significance of a tech stack like this lies in its versatility—it can be deployed anywhere: from a home lab to an on-premises data center, cloud providers, or any hosting provider that allows you to spin up servers. One of the main advantages of Kubernetes for most projects is its ability to balance cost control and scalability by enabling efficient resource allocation and offering granular control over infrastructure, which helps in managing expenses more effectively. While cloud-hosted serverless platforms charge based on usage, Kubernetes allows you to establish a baseline with fixed costs, including hardware, hosting fees, and maintenance. This baseline can then be flexibly expanded to handle increased workloads, providing the ability to scale without the unpredictability of purely serverless solutions. With a well-architected, event-driven approach, Kubernetes offers both cost stability and the flexibility to adapt to changing demands, ensuring smooth operations at reasonable costs.
When to Choose Kubernetes
For simple web applications with basic APIs, there are plenty of hosting providers that offer such services for nearly free. However, when dealing with more advanced applications that require always-on services, background processes, multiple components, and constant data processing, hosted serverless platforms can become prohibitively expensive. As a cost-conscious and pragmatic engineer, I appreciate the control and flexibility that Kubernetes provides, without the risks associated with sudden traffic spikes or potential DDoS attacks. These types of scenarios could dramatically increase costs on a hosted serverless platform, or even lead to service outages due to acceptable use limits imposed by those platforms.
Demonstration: Local Kubernetes Development
💪 local-k8s-demo
As part of my learning process, I’ve created a video demonstration that walks through building a basic project, showcasing one of the effective methods for developing a project locally using Kubernetes.
🎁 What is included
- Monorepo
- Local K8S development
- Web Application / API
- Worker Service
- Database
- Queue
- Event based auto-scaling