Catching Up: Kubernetes and Pneumonia

Rian Schmidt

July 24, 2024

Table of Contents:

Hey, Rian. Your site's been busted for weeks.
Kubernetes for Organizational Purposes
Docker Compose and Ansible
What works at five doesn't work at fifty.
Enter MicroK8s, Ansible, and GitHub Actions

Hey, Rian. Your site's been busted for weeks.

Yeah, I know. Sorry. I was off there for a minute. OK, some months. But I have an excuse. I went to Europe with my kid and his choir, and it was ah-may-zing. One of those trips you remember forever. Like angels, those kids. Truly a high-point in my life.

And I got Covid. And pneumonia. Gotta take the good with the bad, I guess. Annnnnyway.

On the tech front, I've also been spending a lot of time on a couple of interesting things lately. So as not to give myself carpal tunnel, I'll just talk about Kubernetes today.

Kubernetes for Organizational Purposes

Now, I've worked on Kubernetes before, but it's usually been for big, gnarly systems that required all the self-healing, load-balancing, scaling goodness that Kubernetes provides. Kubernetes (or k8s, for short) has a bit of a learning curve. There are ingresses and persistent volumes and pods and services. It's all a little abstract, and wiring the whole thing up can require enough work that you really have to want it for its benefits.

Lately, though, I've been using it for more of an organizational thing. At my day job, and for my clients, I have loads of applications running-- some are more complex back-end API-type things, and some are simply websites or data-processing jobs. I discovered a package called microk8s on Ubuntu that really strips down the setup, but it's a relatively full-featured implementation, as opposed to minikube.

Docker Compose and Ansible

For most of these things, like most of us, I started with bare metal apps sharing a host, then virtual environments of one sort or another, then Docker containers, and, most recently, I'd defaulted to running them in Docker containers and orchestrating that with Docker Compose. That's a pretty neat option. Neat as in clean, not neat as in nifty.

Then, I'd use Ansible to manage the deployments across hosts. That frees me from having to manage the hosts directly and infastructure-as-code makes it really easy to manage scaling and disaster recovery and such.

What works at five doesn't work at fifty.

Eventually, though, I had so many of these little things running that each became it's own little mental load detail that I had to manage. Deployment got messy. If you have thirty apps out there, staging and prod versions of most, it gets to be a headache.

I really wanted some nice way to have a dashboard that showed me what was running, what wasn't, resource consumption, and an easy path to deployment that I didn't have to intervene with.

Enter MicroK8s, Ansible, and GitHub Actions

Well, this is running on, but you see where I'm going I hope. By spinning up a small microk8s cluster, managing the setup with Ansible, and allowing GitHub Actions to do my container builds and deploys for me, all I have to do is push to staging to deploy it and check it out. Then, when I'm happy pull that into prod, push that, and it's deployed in a minute with little to no downtime.

Microk8s really just takes a few minutes to set up, and it can (apparently) run up to a small 10-20 node cluster. I put the requisite setup YAML files in the repository along with a GitHub Action to deploy on pushes, and everything sort of handles itself. And the Kubernetes dashboard and kubectl command line tool allow me to manage things, rarely having to log in to my systems. You can even run a shell on a container remotely from your desktop if you need to, say, drop and restore a database or whatever.

So far, I'm loving the streamlined process. It makes my little one-man-show just that much more efficient and resilient.

I hope to get into some of the nifty things you can do with it in future articles. If you'd like to hear more about any of it, drop me a line.

Circinaut is a Fractional CTO services provider, based in Portland, Oregon, working with clients all across the country. I focus on application development, technology advising, and ongoing support for small and medium-sized businesses.
If your business is in need of a part-time CTO, a fractional CTO, or a contract technical consultant, drop me a line. I'm happy to have a quick chat to discuss your situation with no sales pressure at all (really!).