These are the three things we love about, Kubernetes, our container orchestration tool of choice
Infrastructure decisions are important. The tools you choose to build with could end up causing your business headaches down the road. At Bond, we are thoughtful and thorough when selecting the tools we use. The margins for error in financial services are slim, which heightens the importance of our initial set of decisions.
The largest fork in the road that we came across was concerning how we would host our services as there are an array of choices; some providers handle almost all of the complexity for you, operating as a DevOps black box. While this would have been easy in the short-term, the long-term feasibility of these solutions was, shall we say, sub-optimal. Kubernetes, on the other hand, is a container orchestration tool that is equally well known for its steep learning curve and kick-a** functionality. We’re not scared of a challenge so we dove in headfirst.
Here are the three things that we love most about Kubernetes:
It's scalable
Web traffic is variable throughout any given day and your infrastructure should be, too. Kubernetes allows horizontal and vertical scaling of resources which means that a given application can be automatically scaled to utilize more of the overall resources of the cluster and the overall resources of the cluster can be scaled up depending on the utilization of the current resources. As a result, we can kick our feet up and trust that our systems are resilient.
Additionally, plugins like Grafana give us observability into the cluster’s exact performance metrics. These customizable time-series dashboards allow us to know exactly what happened,when it happened and how our system responded.
It's flexible
It’s vital for engineering teams to avoid vendor lock-in; platform providers may love it, but we sure don’t. One of Kubernetes’ key selling points is that it is cloud-agnostic and, if we wanted to, we could wake up tomorrow and move all of our Kubernetes infrastructure over to a provider like Google Cloud or Microsoft Azure. Two key things make this so easy.
First, it is based on containerized software. Docker images published to a container registry of your choice will still be accessible if you were to spin up a Kubernetes cluster on another cloud provider. Second, it’s easy to create manifests. Manifests are able to bottle representations of a desired application state into YAML files and then be deployed on any cluster across the globe. The deployed YAML (or JSON, if you’re feeling adventurous) will perform exactly the same as it would on any other cluster.
It's fast
Everything about Kubernetes, except for the learning curve, is fast. One of the best displays of its speed is highlighted in deployments. Through the usage of zero down-time deployments, services can be live around the clock. With Canary releases, businesses can expose a small portion of traffic to a new software version and then quickly rollback to the tried and true version in the event of errors. This agility facilitates rapid iteration. With these tools, we’re able to delight customers faster and better than ever.
To give you an idea of how fast and easy it is to deploy and expose an application to the world, here’s a quick YAML file that contains all of the necessary instructions to create a publicly available website.
# hello-kubernetes.yaml
apiVersion: v1
kind: Service
metadata:
name: hello-kubernetes
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 8080
selector:
app: hello-kubernetes
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-kubernetes
spec:
replicas: 3
selector:
matchLabels:
app: hello-kubernetes
template:
metadata:
labels:
app: hello-kubernetes
spec:
containers:
- name: hello-kubernetes
image: paulbouwer/hello-kubernetes:1.7
ports:
- containerPort: 8080
Make sure that the file is saved as hello-kubernetes.yaml, that kubectl is installed and that you’re on an active Kubernetes cluster. Then simply run:
kubectl apply -f hello-kubernetes.yaml
Give it a minute, then run in the command line:
kubectl get svc
You should be able to find a public URL in the response. Visit it and voila!