As we build increasingly complex applications, leveraging the right orchestration tools will optimize the way your team manages and deploys resources to different parts of your codebase, saving your business time and development resources. Let’s talk about why Kubernetes is relevant today, and how we use it in conjunction with Kustomize and Crossplane.
Kubernetes (or K8s), is an open-source tool developed by Google that can orchestrate containerized apps and workloads. Kubernetes has become increasingly relevant as companies shift from writing monolithic applications (everything written in a single codespace) to splitting the code into more manageable microservices that can be deployed individually.
Kubernetes offers us the ability to manage these microservices, and operates on these fundamental principles:
These are some of the basic objects that Kubernetes operates with:
Kubernetes takes care of networking, security, and management of these microservices – but even then, it can be complicated to use. For example, developers need to make sure they use namespaces and definitions properly to avoid disrupting other environments that may have highly similar or identical objects. This is where add-ons come in.
Kustomize is a tool that helps us customize Kubernetes configurations. Using plain, easy-to-read YAML files, Kustomize allows us to deploy Kubernetes objects as a series of layers or patches, and manage customized Kubernetes configurations with ease. For example, we can use overlays on a deployment to change things like the number of replicas, or to use a specific image. The naming feature also lets us assign all objects to the same namespace without touching the other files. Plugins offer even more freedom to alter specific instances, such as adding tags to images.
Crossplane is an open-source add-on for Kubernetes that transforms it into a consistent interface that can manage cloud-based services like databases and other cloud resources. Crossplane is useful in keeping resources near where they are being used. It handles cloud resources as Kubernetes resources, for example; you could deploy an AWS database as a Kubernetes resource so that everything stays in Kubernetes. By using Kubernetes’ native structure to reconcile the desired state, we don’t need to create a state file. Crossplane will also manually revert actions performed to reach the deployed state. For example, if a database gets deleted, Crossplane will automatically recreate it.
So, what’s the catch? Here were a few things we noticed while using Kustomize and Crossplane that are worth noting when a team is looking to integrate them into their stack:
All in all, our experience in leveraging this set of tools has vastly improved the way we build and manage applications. Kubernetes is a powerful orchestration tool, and leveraging Kustomize and Crossplane help us maximize its utility. Kustomize helps us avoid duplications in deployment, easily create new namespaces to test new features in a cloud environment, and maintain a standard environment. Meanwhile, Crossplane helps streamline the process by keeping resources near where they’re used in the cloud.