A taste of Kubernetes (like eating Pizza!)
Anil Murty
VP - Product, Eng & Partnerships @ Overclock Labs - Decentralized Cloud Compute
If you are anywhere in the software/ IT/ Infrastructure/ application development space you have probably heard the term “Kubernetes” or K8s (in short) alongside others like “Microservices”, “Containers”, “Public Clouds”, “Orchestration/ Kubernetes”, “CI/ CD/ Spinnaker”, “Application monitoring/ observability”, “DevOps/ CloudNative”. In this post I’ll attempt to provide a quick overview of why I think K8s is something you should really care about if you build software products. I’ll also provide a few references that I found useful in ramping up on K8s along with a couple hands-on lab type resources for those that are like me and like to geek out.
TL;DR: This post isn’t intended to provide a deep philosophical or technical discussion about why K8s is a good or bad idea or how K8s work internally or how some other alternatives are better/ worse. There are plenty of articles on the web for that content. Instead my goal here is to provide a quick overview of why you (regardless of whether you are a product/ engineering leader or a practitioner writing code or managing production grade software at scale) should care about K8s by taking a “business value delivered” perspective and then provide some ways in which you can dig deeper and get hands on (if you are like me and learn technology best by “rolling up your sleeves”)
And yes, I do get to the pizza reference in a minute… but first things first...
Why should you care about Kubernetes?
If you lead product development in any capacity in practically any industry, you should probably know and care about kubernetes for the same reasons that you should care about containers and microservices (as I outlined in my post about them):
- Leaders in companies of all sizes and in various types of non-tech industries are now more than even faced with the challenge of trying to figure out what their “digital strategy” is. How should they be using technology to help them increase the value (or reduce the cost) of the products and services they provide to their customers. Or stated differently, how can they avoid being disrupted by the latest upstart out of silicon valley.
- Those in tech companies are constantly faced with the challenge of keeping up the pace of product development, building teams that are autonomous and agile, all the while making sure the quality of the products and services does not suffer (particularly so for the “XaaS” offerings, that don’t have the cushion afforded to traditional “installed” software, in that everything hits customers more or less “instantaneously”)
- Microservices based application architectures (coupled with DevOps practices) allow software teams to move faster by allowing for greater autonomy among sub teams (in deciding the specifics of the internal architecture of their piece, choice of programming language, development process etc).
- Containers provide the perfect platform to deploy microservices because of their size, portability and immutability. Stated differently, containers allow you reduce/ eliminate the risk associated with frequent application/ service deployments by decreasing the number of variables (environment, framework, dependencies, versions...) that change between dev and production.
If you are a practitioner (software developer, QA engineer, SDET, DevOps engineer, Infrastructure engineer/ admin) then you should absolutely care about K8s because a significant portion of software application workloads are going to be run/ managed using it, in the coming years.
At this point you’re probably thinking “OK, all that sounds great but where does this K8s thing fit into all this? And what value does K8s bring above what containers and microservices already provide?” -- if you had that question, you’re on the right track with your thinking. As it turns out, while containers and microservices are great at allowing organizations move fast in shipping code, they introduce more complexity when it comes to managing and scaling those workloads in production. Think of it this way, if you thought it was challenging enough to scale up/ down a handful of services/ apps running on tens (or even hundreds) or VMs (EC2 instances for example) imagine what happens when the number of services increases by 10x or 100x and the number of those instances of applications/ services also increases by 100x. This is the crux of the “running microservices at scale” problem. And this is exactly what Kubernetes (and other container orchestrator technologies like it) aim to solve/ alleviate. To steal from the official Kubernetes website:
“ Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.”
That sounds great (and easy) at a high level, how do I start to wrap my head around the details?
And, more importantly...
While there are many approaches to learning new technologies and what approach you take depends on your learning style as well as your role (which guides how deeply technical you may or may not wish to get) -- here is the general approach I find to be the most effective for me (an engineer-turned-PM in a fairly fast moving and high growth market, who has to quickly know enough to be able to make key product decisions):
- Read up
- Validate your learning
- Spread the knowledge (to improvise on an age old saying, if I may… “teach a man to fish and you become a better fisherman yourself”? ;-) )
With that, here are a few things I’ve found useful along the way
Reading List: Here are a few resources I have found to be useful:
- https://kubernetes.io/ - the documentation there is pretty much the bible
- https://hackr.io/tutorials/learn-kubernetes
- Coursera
- Udacity
- edX
- Tons of articles on Medium, LinkedIn and elsewhere.
- Find people on the original K8s team or active contributors to the open source community whoe are worth following on twitter.
- If you really get into the weeds, read the Google Borg paper (K8s evolved from Borg, which is the cluster management system Google has used for over a decade to manage their services at scale).
Validation of Learning:
I. Roll up your sleeves (a bit or a lot) and get hands on:
- Try the easiest way of getting familiar with K8s using the Katacoda browser tutorials - no downloads, installs or configurations necessary (I’ll confess that I haven’t tried this yet because I wanted to do the harder ways first). If you have never tried pizza before, the equivalent of this would be ordering a pizza from Pizza Hut or Papa Johns or <insert most well known pizza chain>.
- Try the slightly harder way by running a local K8s cluster with MiniKube (I have done this and have details below). This would be like buying a frozen pizza from the grocery store and baking it at home or maybe buying a cheese pizza, scraping some of the cheese off and adding your own toppings (if you haven’t tried that, I definitely recommend it ;-) )
- Try the hard way by installing K8s from scratch using the awesome reference provided by Kelsey Hightower of Google (I have done this too and have details below). This would be the equivalent of buying a pizza base, buying the sauce, the toppings etc, putting them together at home and baking the pizza.
II. Consider taking a certification class and test your knowledge:
- I did the class from edX and thought it was worth the time. The nice and shiny certificate wasn't bad either!
- I’m considering working towards getting the KCAD and CKA certifications from CNCF as well.
III. Spread the knowledge:
- Write, share, like posts like this one. ;-)
- Attend local meetups and conferences (I’ll be at Kubecon in December)
- Discuss with other folks within your companies/ organizations. I’m happy to be part of any of those conversations too :-)
- Get involved in the open source community for K8s and everything around it (tools, other products…).
To wrap this up, I’ll leave you with some bits and pieces of me running through 1b and 1c above (in the learning approaches)
Kubernetes the (relatively) Easy Way using Minikube
Minikube is a tool that can be used to run a Kubernetes cluster locally over a virtual machine (VM).
Minikube is based on localKube - a open source tool developed by Redspread (a tiny startup of two people that was focused on developing tools for K8s) that was first acquired by CoreOS and then CoreOS was acquired by RedHat and now (literally as I write this blog) RedHat just got acquired by IBM.
Minikube uses Localkube to run the cluster and libmachine to provision VMs.
If you want to dig into the minikube code itself and contribute, you can do so here: https://github.com/kubernetes/community/blob/master/contributors/design-proposals/cluster-lifecycle/local-cluster-ux.md
To install Minukube just follow the instructions here: https://kubernetes.io/docs/tasks/tools/install-minikube/
They do say that you can run it directly on your host OS (without a VM) but I haven’t tried that. I tried running it with VMWare Fusion (because I already had that installed on my Mac) but I kept running into issues with it (I checked and there were already some bugs filed on this) so I installed VirtualBox and was able to get it up and running easily:
Minikube does tend to be very CPU intensive and so you'll likely see your battery drain out pretty fast if you're not plugged in. Also, don't forget to shutdown minikube when you are not using it or you'll be caught offguard in a meeting when you see your battery notification and realize minikube has been running in the background
Kubernetes the Hard-Way -- installing each piece manually
Google Developer Advocate Kelsey Hightower has created an absolutely awesome set of instructions and scripts for spinning up each piece of a Kubernetes cluster manually on Google Cloud.
He starts by walking you through installing all the required prerequisites, including the google cloud SDK and CLI so that you can instantiate and manage the VMs that will make up your Master (Controller) and Nodes (workers) for your K8s cluster and then goes through setting up every single thing that needs to happen to get your cluster up and running down to provisioning the CA and generating TLS certificates used by the various components to communicate securely with each other.
Finally, he walks through a series of Smoke Tests that include deploying an NGINX server to the cluster, exposing it via a service and inspecting logs on it.
I had absolutely no problems running through that and strongly recommend it for anyone with an above average interest in Kubernetes. Here is my Kubernetes Cluster running in GCP with the control plane (masters) implemented as 3 nodes (Ubuntu VMs) and 3 worker nodes (also Ubuntu VMs)
Once you have the set up up and running and remote access enabled you can pretty much deploy and administer the cluster from your CLI:
Lastly, it is worth mentioning that Kubernetes is NOT the only way to do container orchestration. There are several other products/ services out there like Docker Swarm, Mesos Marathon, Amazon ECS and Hashicorp Nomad to name just a few, but K8s is arguably the one that has received the most traction and adoption in the recent times.
I hope you enjoyed reading that and it inspired you to get hands-on with K8s. If you did, you may also like a post I did about getting hands on with Containers and Microservices (that one is a lot more detailed that this and involves setting up a ecommerce website!). If you are running K8s in production, I would be very interested in chatting with you about your experience with it.
==============================================================
Disclaimer: Views expressed here are entirely mine and not of anyone else, including my current or past employers.
==============================================================
Technical Specialist @ Standard Chartered Bank | Agile Transformation, Scrum Master
6 年Good read Anil.
Assistant Vice President at Barclays Global Solution Center
6 年Absolutely awesome explanation Anil! The pizza analogy made it all the more simpler to understand. Thank you for this Kubernetes article and keep writing more!!
AI Product Marketing at Microsoft
6 年If you havent already, also tryout some GKE tutorials, they have some fully fledged microservices based apps, they are super fun! My favorite was one polyglot ecommerce app, which you could standup with a couple of commands.