A person at work chatted me, commenting on my recent blog posts on the Raspberry Pi Kuberentes Clusters that are being built, and wondered “why should I care about Kubernetes or Docker or any of that stuff?”
Great question, and I’m figuring it out myself. There’s lots of resources out there but none that spoke my language, so here’s my thoughts and how I explain it.
“Hey, I have this great new blog app!”
“Sure, first make sure you have this version of Windows/Linux, this version of .NET/Python/Node, and these prerequisites.”
“Hang on, lemme call you next week when that’s handled.
This is how software was built for years. Now let’s deploy it.
“Here’s the code/dlls/application zipped up.”
“Lemme FTP/SFTP/Drag this from one Explorer Window to another.”
“Is this version of that file set to this?”
“Make sure that system/boss/dll/nounjs is version 18.104.22.168, they patched it.”
“Ok, Imma shush* into production.”
Again, we’ve all been there, even if we refuse to admit. It’s 2018 and there’s more folks doing this than you care to admin.
Enter Virtual Machines! Way better, right? Here’s a USB key with a file that is EVERYTHING you need. Handled.
“Forget that, use this. It’s better than a computer, it’s a Virtual Machine. But be aware, It doesn’t know it’s Virtual, so respect the lie.”
“OK, email it to me.”
“Well, it’s 32 gigs. Lemme UPS it.”
Your app is only 100 megs, and this VM is tens of gigs. Why does a 150 pound person need a 6000lb Hummer? Isolation, I guess.
“The app is getting more complex, but it’s cool. There’s four VMs now. One for the DB, one for Redis, and a front end one, and the shopping cart gets one. It’s microservices!”
“I’m loving it.”
“Here’s a 2 TB drive.”
Nice that we’re breaking it up, but not so nice that we’re getting bloated. Now we have to run apt upgrade/windows update on all these things and maintain them. Why drive a Hummer when I can get a Lyft?
“Ok I got them all running on this beefy machine under my desk.”
“Cool, we’re moving to the cloud.”
“Sigh. I need to update all these connection strings and start uploading VMs.”
“It’ll be great. It’s like a machine under your desk, except your desk is in the cloud.”
“What’s the cloud?”
“It’s a server room you can’t see. Basically it’s the computers under your desk. But invisible.”
Most VM infrastructure is pretty sloppy. It’s hard coded IP addresses, it’s poorly named VMs living in the same subnets, then we’ll move them to the cloud (lift and shift!) but then they are still messy, but they’re in the Cloud™, right?
“You know, all these VMs are heavy. I have to maintain and move a bunch of stuff that ISN’T the app. Containers are the way. Just define the app’s base requirement and share everything else.”
“I’ve been hearing about this. I can type “docker run hello-world” and on any machine it’ll load the hello world image (based on Ubuntu) from a central hub and run it in a mostly isolated way. Guaranteed to work and run, even as time passes.”
“Nice, because more and more parts of our app are in .NET Core on Linux, but there’s also some Python and node.”
“Yep and it’ll all just run as the prerequisites are clearly listened in the container…and the prereqs are in fact references to other container images.”
“It’s containers all the way down.”
Now the DB, Redis, the front end, and the shopping cart can call be defined in some simple text files. Rather than your Host OS (the main computer…the metal) loading up a bunch of Guest OS’s (literally copies!) and then loading all the apps and prerequisites, you’ll share OSes, and when appropriate, the binaries and libraries.
“OK, now we have a bunch of containers running in Docker, but sometimes they go down or stop.”
“Run them again?”
“It’s more that that, we need to sometimes have 3 shopping cart containers, and other times we need 2 or more DB containers. Plus their IPs sometimes change”
“So we need something to keep them running, scale or auto-scale them, as well manage networking and naming/dns.”
Enter a container orchestrator. There’s Docker Swarm, Meso Marathon, Azure Service Fabric, and others, but for this post we’ll use Kubernetes.
“So Kubernetes runs my containers, keeps them running, and helps manage the network?”
“Yes, and no. Parts of Kubernetes – or k8s, as cool people like me who have been using it for nearly 3 hours say – are part of the master components, like etcd for key value storage, and the kube-scheduler for selecting what node to run a “pod” on (a pod is cooler to say than container, but sometimes a pod is more than one container. Still, very cool.)
“I’ll need to make a glossary.”
“Darn tootin’ you will.”
Kubernetes has basically pluggable everything. Don’t like their networking setup? There’s literally over a dozen options. Want better charts and graphs? Whole world of options.
Just as one Dockerfile can
explain declare what’s needed to run an app, a Kubernetes YAML file describes not only the containers, but the ports need, the number of replicas of each (think web farm), names, environment variables, and more. Here’s a file that shows a front end, back end, and load balancer. Everything is there, connection strings become internal DNS lookups, ever service has a load balancer (if you like), and you can scale manually or auto-scale.
“Ok so why should I care?”
“A few reasons. In the past, to install our app I’d need to give you a Word document and a weekend. Now you type kubectl apple theapp.yaml and it’s running in less than a minute.”
“I’m still billing for the weekend.”
Simply stated, we are at the beginning of a new phase of DevOps. One that is programmatic, elastic, and declarative. It’s consistent and clear and modular.
I recommend you check out Julia Evens’ “Reasons Kubernetes is cool” as well as reading up on how to make a Kubernetes cluster (and the management VMS are free) in Azure.
* I’m trying to make shush a thing. We don’t Es Es Eaytch into machines! We shush in! It’s pronounced somewhere between shush and shoosh. Make sure you throw in a little petit jeté when you say it.
Sponsor: Unleash a faster Python Supercharge your applications performance on future forward Intel® platforms with The Intel® Distribution for Python. Available for Windows, Linux, and macOS. Get the Intel® Distribution for Python* Now!