32.6 Deployment Strategies: Blue/Green and Canary with Argo Rollouts

Right, so you’ve got your app containerized, your YAML files are in order, and you’re happily deploying to Kubernetes with kubectl apply. It works. But let’s be honest, it’s a bit like performing open-heart surgery with a sledgehammer. One apply and you’ve replaced every single running instance of your application at once. If you’ve ever felt a cold sweat at that moment, congratulations, you’re not a psychopath. You’ve just outgrown basic deployments.

32.5 GitLab CI with Kubernetes Integration

Right, so you’ve got a Kubernetes cluster humming along, and now you want to get your code onto it without manually kubectl apply-ing until 3 AM. Good call. Let’s talk about using GitLab CI to do this properly. It’s a powerful combo because GitLab isn’t just a CI/CD tool; it’s a whole integrated platform. This means less configuration hell, but also a few GitLab-isms you need to understand to avoid pulling your hair out.

32.4 Tekton: Kubernetes-Native CI/CD Pipelines

Alright, let’s talk Tekton. If you’ve been slapping Jenkins or GitLab runners onto your Kubernetes cluster and hoping for the best, you’re going to love this. Tekton is different. It’s not just another CI/CD tool that runs on Kubernetes; it’s a framework built from Kubernetes resources. This isn’t a square peg in a round hole. It’s a round peg made of the same wood as the hole. The entire pipeline—every task, every step—is defined and runs as a Kubernetes Pod. This means you get to use kubectl to manage your CI/CD infrastructure. No more bespoke APIs or weird configuration languages. It’s all just YAML, my friend. Beautiful, terrifying, powerful YAML.

32.3 GitHub Actions: Build, Push, and Deploy to Kubernetes

Right, so you’ve got some code, a Kubernetes cluster, and a deep-seated aversion to doing things manually more than twice. Good. Let’s automate this thing into oblivion. We’re going to use GitHub Actions because, well, it’s right there next to your code and it’s surprisingly competent once you wrestle it into shape. The goal is simple: every time you push to main, we build a new container image, push it to a registry, and tell your Kubernetes cluster to pull it and get on with its life.

32.2 Vulnerability Scanning: Trivy, Grype, and Snyk

Right, let’s talk about scanning your container images for vulnerabilities. This isn’t a “nice-to-have”; it’s your digital immune system. You’re constantly pulling in code from strangers on the internet (yes, that FROM node:18 base image counts), and you need to know if they’ve given you the software equivalent of a cold. We’re going to look at three top scanners: Trivy, Grype, and Snyk. My job is to make you understand not just how to run them, but why you’d pick one and how to actually use the results without losing your mind.

32.1 Container Image Build and Push in CI

Right, let’s get your code into a container and shoved into a registry. This is the part of CI/CD that feels like alchemy to most people, but I promise you, it’s just following a recipe with a few sharp knives. Screw this up, and your entire deployment process becomes a house of cards. Let’s build a foundation of granite instead. The Humble Dockerfile: Your Blueprint, Not Your Scratch Pad Your Dockerfile isn’t a suggestion; it’s the single source of truth for your image. The first thing everyone does wrong is treat it like a shell script they found in a ditch. It’s not. It’s a layered document, and each instruction has consequences.

— joke —

...