EightKB is back!

We’re back!

The first EightKB back in July was a real blast. Five expert speakers delivered mind-melting content to over 1000 attendees!

We were honestly blown away by how successful the first event was and we had so much fun putting it on, we thought we’d do it again 🙂

The next EightKB is going to be on January 27th 2021 and the schedule has just been announced!

Once again we have five top-notch speakers delivering the highest quality sessions you can get! Expect a deep dive into the subject matter and demos, demos, demos!

Registration is open and it’s completely free! You can sign up for the next EightKB here

We also run a monthly podcast called Mixed Extents where experts from the industry join us to talk about different topics related to SQL Server. They’re all on YouTube or you can listen to the podcasts wherever you get your podcasts!

EightKB and Mixed Extents are 100% community driven with no sponsors…so, we’ve launched our own Mixed Extents t-shirts! Any money generated from these t-shirts will be put straight back into the events.

EightKB was setup by Anthony Nocentino (b|t), Mark Wilkinson (b|t), and myself as we wanted to put on an event that delved into the internals of SQL Server and we’re having great fun doing just that 🙂

Hope to see you there!

Migrating SQL Server container images to the Github Container Registry

A couple of months ago Docker announced that they would be implementing a 6 month retention policy for unused images in the Docker Hub.

This was due to kick in on the 1st of November but has now been pushed back until mid 2021.

I’ve had multiple Windows SQL Server container images up on the Docker Hub for years now. It’s been a great platform and I’m very thankful to them for hosting my images.

That being said, I want to make sure that the images that I’ve built are always going to be available for the community so I have pushed my SQL Server images to the Github Container Registry.

In the Docker Hub I have the following public SQL Server images: –

dbafromthecold/sqlserver2012express:rtm
dbafromthecold/sqlserver2012dev:sp4
dbafromthecold/sqlserver2014express:rtm
dbafromthecold/sqlserver2014dev:sp2
dbafromthecold/sqlserver2016dev:sp2

These images won’t be removed (by myself) and I will update this post in the event of them being removed.

But they are now available on the Github Container Registry: –

ghcr.io/dbafromthecold/sqlserver2012:express
ghcr.io/dbafromthecold/sqlserver2012:dev
ghcr.io/dbafromthecold/sqlserver2014:express
ghcr.io/dbafromthecold/sqlserver2014:dev
ghcr.io/dbafromthecold/sqlserver2016:dev

Bit of a disclaimer with these images…they’re LARGE! The 2012 dev image is ~20GB which is gigantic for a container image. So if you going to use them (for dev and test only please 🙂 ) you’ll need to pre-pull them before running any containers.

Thanks for reading!

The SQL Server and Containers Guide

I’ve been blogging about running SQL Server in Docker containers for a while now and, to be honest, my blogs are scattered over a few years and some need to be archived as they’re out of date.

So what I wanted to do was have one place where I could collate all the blogs I’ve written about running SQL Server in a container. This would make it easy for people to access information and make it easy for me to keep it all up-to-date as well.

So introducing, The SQL Server and Containers Guide!

This wiki contains everything needed to get up and running with SQL Server in Docker containers, and it delves a little bit deeper as well.

Topics covered are: –

  • Quick Start – Get up and running with SQL in a container
  • Running SQL in container – Explore the ins and outs of running SQL in a container
  • Persisting data – Have a look at the options for persisting data in a container
  • Docker images – Build your own custom SQL images
  • Container networking – Explore the default docker network and create a custom network
  • Docker Compose – Use Docker Compose to spin SQL up in a container
  • Docker commands – Details of various Docker commands

Each post has code and screenshots to walk through each topic…and the Github repository contains all the code from the posts so that it can be pulled down locally.

I’ll be adding to this some more over the next few weeks…Rob Sewell (b|t) awesomely contributed code to generate Azure Data Studio Notebooks from the wiki which I may (ok, definitely) have broken. But once I’ve (or more likely Rob) has fixed that…they’ll be added into the repository.

If there’s anything missing please feel free to contact me via dbafromthecold@gmail.com or submit a PR!

Thanks for reading!

New Pluralsight Course – Kubernetes Package Administration with Helm

My first course Kubernetes Package Administration with Helm has been published on Pluralsight and is now available!

Check out the course overview here

This course is aimed at anyone who wants to get into working with Helm to deploy and manage applications running on Kubernetes.

It’s divided into three modules covering: –

Helm Overview

  • A guide to what Helm is and its history
  • Setting up your local environment to work with Helm
  • Installing Helm and adding the Stable Helm repository

Exploring Helm Releases

  • Deploying a Helm Chart to Kubernetes
  • Retrieving information about a Helm Release
  • Upgrading a Helm Release
  • Rolling back a Helm Release
  • Downloading and exploring a Helm Chart

Configuring Helm Repositories

  • How to create and package a Helm Chart
  • Pushing a Chart to a local/remote Helm repository

All modules are accompanied with demos to take you through each topic discussed. The code for the demos is available on Github here

By the end of the course you’ll have the skills to confidently work with applications deployed to Kubernetes with Helm.

A kubectl plugin to decode secrets created by Helm

Last week I wrote a blog post about Decoding Helm Secrets.

The post goes through deploying a Helm Chart to Kubernetes and then running the following to decode the secrets that Helm creates in order for it to be able to rollback a release: –

kubectl get secret sh.helm.release.v1.testchart.v1 -o jsonpath="{ .data.release }" | base64 -d | base64 -d | gunzip -c | jq '.chart.templates[].data' | tr -d '"' | base64 -d

But that’s a bit long winded eh? I don’t really fancy typing that every time I want to have a look at those secrets. So I’ve created a kubectl plugin that’ll do it for us!

Here’s the code: –

#!/bin/bash

# get helm secrets from Kubernetes cluster
SECRET=$(kubectl get secret $1 -o jsonpath='{ .data.release }' ) 

# decode the secrets
DECODED_SECRET=$(echo $SECRET | base64 -d | base64 -d | gunzip -c )

# parse the decoded secrets, pulling out the templates and removing whitespace
DATA=$(echo $DECODED_SECRET | jq '.chart.templates[]' | tr -d '[:space:]' )

# assign each entry in templates to an array
ARRAY=($(echo $DATA | tr '} {' '\n'))

# loop through each entry in the array
for i in "${ARRAY[@]}"
do
        # splitting name and data into separate items in another array
        ITEMS=($(echo $i | tr ',' '\n'))

        # parsing the name field
        echo "${ITEMS[0]}" | sed -e 's/name/""/g; s/templates/""/g' | tr -d '/:"'

        # decoding and parsing the data field
        echo "${ITEMS[1]}" | sed -e 's/data/""/g' | tr -d '":' | base64 -d

        # adding a blank line at the end
        echo ''
done  

It’s up in Github as a Gist but to use the plugin, pull it down with curl and drop it into a file in your PATH environment variable. Here I’m dropping it into /usr/local/bin: –

curl https://gist.githubusercontent.com/dbafromthecold/fdd1bd8b7e921075d3d37fcb8eb9a025/raw/afa873b0ef343859ed4119eeb9f41bf733e8cea2/DecodeHelmSecrets.sh > /usr/local/bin/kubectl-decodehelm

Make it executable: –

chmod +x /usr/local/bin/kubectl-decodehelm

Now confirm that the plugin is there: –

sudo kubectl plugin list


N.B. – I’m running this with sudo as I’m in WSL which will error out when checking my Windows paths if I don’t use sudo

Let’s test it out! I’m going to deploy the mysql chart from the stable repository: –

helm install mysql stable/mysql

Once deployed, we’ll have one secret created by Helm: –

kubectl get secrets

Now let’s use the plugin to decode the information in that secret: –

kubectl decodehelm sh.helm.release.v1.mysql.v1

And there’s the decoded secret! Well, just a sample of it in that screenshot as the mysql Chart contains a few yaml files.

The format of the output is: –

  • Filename (in the above example… NOTES.txt
  • Decoded file (so we’re seeing the text in the notes file for the mysql Chart)

Thanks for reading!