Skip to main content

Platform Engineering

· 3 min read

I came across Puppet's 2020 State of DevOps report and noticed how closely it mapped to questions I ask candidates. I've been helping with hiring lately.

We ask a deliberately broad question. The wording varies, but it usually comes down to this:

note

How would you build a highly available Kubernetes cluster on bare metal or in a public cloud, with enough capacity for heavy workloads and room to scale across development teams? Walk us through your reasoning and what you'd do in practice, starting from the very first step.

We want to deliver a platform at the push of a button. That takes IaC and a few other pieces. I'd break the work into three steps that fit together well enough to make deployment a roughly one-button operation:

  1. compute bootstrapping provisions the physical servers or VMs, networks, and other resources that will host the OS and Kubernetes. In most cases I'd use Terraform with the AWS, GCP, VMware, or OpenStack provider.

  2. provisioning configures the OS and installs a highly available Kubernetes cluster on that compute using configuration management. Managed Kubernetes in a public cloud can handle this step for you.

  3. cluster configuration adds the pieces a bare cluster needs to be useful, including public ingress, metrics and logs, and secret storage and delivery. There are two ways to install those components:

    • CiOps stores the infrastructure application definitions in Git. A pipeline runner with cluster access applies the manifests or installs the charts. Kubernetes is declarative, but the operation itself is imperative and may fail to be idempotent.
    • GitOps adds a controller that compares the running cluster with the manifests or Helm charts in Git. It reports configuration drift and can correct it automatically when self-healing is enabled.

Deployment on AWS with GitOps​

Terraform provisions the AWS infrastructure and creates an Amazon EKS cluster. EKS supplies the managed Kubernetes control plane, so there is no separate step to install it. Once the cluster is up, bootstrap Argo CD inside it. Argo CD pulls the desired state from Git and syncs platform components into Kubernetes; Git doesn't push changes to the cluster.

Takeaway: At the time, this looked like the most promising way to build Kubernetes infrastructure and worth exploring in more depth.

Links

Vagrant - DevOps Environment

· 3 min read

Inspiration​

I recently wrote about building a Vagrant box, and I've finally finished it 🎉. It comes in two versions:

  • A server version you access over SSH.
  • A GUI version with desktop apps preinstalled 💻.

asciicast

Here's the same process as a diagram:

Installing on Windows​

Check the resources available on your host OS:

CPU

WMIC CPU Get DeviceID,NumberOfCores,NumberOfLogicalProcessors

Look for the OS version and total RAM:

systeminfo |findstr /c:"OS Name" /c:"Total Physical Memory"

img

"Recommended resources"
  • 2 vpcu
  • 4Gi RAM

You'll need:

VirtualBox Guest Additions​

6.4. Installing the VirtualBox Guest Additions

vbguest vagrant plugin​

danger

This only worked once for me 💀.

vagrant plugin uninstall vagrant-vbguest
vagrant destroy -f
vagrant up
vagrant plugin install vagrant-vbguest
vagrant vbguest --do install

ansible galaxy​

Use my example. The Ansible role installs Guest Additions.

caution

I can't promise it will work on every machine, but it should take very little tweaking.

The secret option​

You can always search the web or YouTube for how to make VirtualBox go full screen 😉.

Good luck, and may the Force be with you!

tip

If you haven't seen this yet, now's your chance:

Toggle me!

🦖 🦕

Links

Links and articles that helped me build this:

Links

AWS Free Tier and a Packer Tutorial

· 2 min read

Background​

When I was learning AWS from a YouTube playlist, I built a VPC across two Availability Zones with several subnets. The private subnets used NAT gateways. The course never mentioned that NAT gateways were outside the Free Tier. The two gateways cost me about $6 in a couple of days. That stung, so I set up a billing alarm.

#!NOTE

Here's the ADV-IT course.

What happened​

I had recently been learning to build artifacts with Packer. After experimenting on AWS, I deleted all the AMIs in the relevant region through the console and moved on.

A week later I saw another email from AWS. My personal Gmail sometimes gets billing reports from them, usually empty, and invitations to re:Invent.

alert

I'd used 85% of my Free Tier allowance for EBS snapshots.

info

The AWS Free Tier page lists the monthly allowances for each resource.

It turns out Packer had created these snapshots alongside the AMIs.

snapshots

Lessons learned
  • Start by setting up a non-root identity. Then set up billing alerts. I'd pick a 50% threshold because I burned through my allowance fast.
  • If you're writing a tutorial, call out which resources fall outside the Free Tier and which have tight limits.

Selfmade Vagrant box

· 2 min read

I couldn't find a good box with a GUI on Vagrant Cloud.

Build process​

info

I'll use Docker as an analogy throughout.

config file​

We describe the Vagrant box (think Docker image) in an HCL configuration, much like Terraform.

source "vagrant" "ubuntu" {
add_force = true
communicator = "ssh"
provider = "virtualbox"
source_path = "ubuntu/focal64"
}

build {
name = "learn-packer"
sources = [
"source.vagrant.ubuntu"
]
}
tip

Useful commands:

packer validate packer.hcl # Validate the file
packer fmt . # Format the files and, I believe, validate them too

build​

Build the image with Packer, which plays a role similar to the Docker engine here.

packer build packer.hcl

After a while, a .box file will appear in the learn-packer directory. Think of it as the Docker image.

push​

Upload the file to Vagrant Cloud. You'll need its checksum, which you can calculate with md5, for example.

provisioner​

note

Ansible is my preferred provisioner, though shell works too.

source "vagrant" "ubuntu" {
add_force = true
communicator = "ssh"
provider = "virtualbox"
source_path = "ubuntu/focal64"
}

build {
name = "learn-packer"
sources = [
"source.vagrant.ubuntu"
]
provisioner "ansible" {
playbook_file = "./ansible/packer-playbook.yml"
}
}

post-processors​

caution

I haven't tested this.

These steps run after the build, for example publishing to Vagrant Cloud, much like docker push.

GitHub repo