I wanted to really understand the flow of Go code to production at my work. I looked at all the IaC code they had in place and was overwhelmed — so many tools involved, so much configuration. So I did the code monkey thing, and went off to a dark corner and implemented the bare minimum myself to learn.

This is a long post, but stick with it, look in the associated repository, and you’ll be able to create a program and deploy it into a Kubernetes cluster all on your own machine — not too shabby.

The Plan

The overall lesson plan here is to achieve, all on a single Mac:

  • Write a simple Go program
  • Get it into a docker container
  • Use Helm to get the container into Kubernetes

Additional specific goals for each of the above will be covered as we go.

Prerequisites

We’ll need a bunch of tools, and recent versions of all of them should work, but I grabbed:

  • Docker Desktop 2.3.0.5
  • golang 1.15.1
  • helm 3.3.3
  • kubectl 1.19.2
  • kubectx 0.9.1

Getting the Prerequisites

For Docker Desktop just head over to their site and do the needful. I grabbed Edge but Stable should work fine. For all the others, there are a bunch of ways to deal with the installations, but I’m going to suggest a one stop shopping solution that I like — asdf. Yup yet another installation tool! It’s worth it. Head over to their install guide and to do the needful. With asdf in place:

asdf plugin-add golang https://github.com/kennyp/asdf-golang.git
asdf install golang 1.15.1

asdf plugin-add helm https://github.com/Antiarchitect/asdf-helm.git
asdf install helm 3.3.3
asdf plugin-add kubectl https://github.com/Banno/asdf-kubectl.git
asdf install kubectl 1.19.2
asdf plugin add kubectx
asdf install kubectx 0.9.1
## Go to the directory you'll be working in...
asdf local golang 1.15.1
asdf local helm 3.3.3
asdf local kubectl 1.19.2
asdf local kubectx 0.9.1

Done. Why do I advocate asdf? Because it allows you to maintain multiple versions easily, and for these tools, different projects will have very specific version requirements and I don’t want to impose a single version for the entire machine

#go #helm #os-x #kubernetes #docker-desktop

Go: Helm, Kubernetes & Docker Desktop
2.40 GEEK