-
Notifications
You must be signed in to change notification settings - Fork 0
Ubuntu or WSL2
For instructions on setting up a development environment in WSL2 for Windows, see the official instructions for Visual Studio Code.
The following instructions are written for Ubuntu 24.04LTS using the bash
shell.
Follow the instructions at the Docker website for installing Docker Engine on Ubuntu. We recommend using the apt
method of installation.
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
# Install Docker
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Kubectl is a command-line interface for Kubernetes. The easy way to install kubectl
is via snap. However, since we don't want automatic updates to break, we specify a version during the install:
sudo snap install kubectl --channel=1.31/stable --classic
Optionally, we can install kubecolor
, which adds colour formatting to kubectl
. We can fetch kubecolor
from its GitHub repository:
# Download kubecolor
wget https://github.com/kubecolor/kubecolor/releases/download/v0.4.0/kubecolor_0.4.0_linux_amd64.tar.gz
# Extract only the executable from the archive
tar xvzf kubecolor_0.4.0_linux_amd64.tar.gz kubecolor
# Ensure that kubectl is on a $PATH directory (update your .bashrc file if needed)
mv kubecolor $HOME/.local/bin
Optionally, alias kubectl
to kubecolor
; see below for more detail.
We will use kind for our Kubernetes engine:
- Cluster configuration in
kind
is done using a YAML configuration file. This is consistent with the way Kubernetes resources are defined within the cluster itself.- The YAML configuration file can be used to set up permanent port mappings and bind mounts.
- The use of YAML helps make the Kubernetes configuration reproducible.
-
kind
runs Kubernetes within a Docker container, minimizing chances to mess up the host system. - Another option is
minikube
, which has useful commands such asminikube dashboard
andminikube addons
. However,minikube mount
requires setting the target user and group id for each individual mount. Inkind
, we can use a single cluster mount, with each service mounting a subdirectory within the cluster mount with its own file permissions.
A simple way to install kind
is via go
:
sudo snap install go --classic
# OR
# sudo snap install go --channel=1.23/stable --classic
go install sigs.k8s.io/[email protected]
Helm is a program for deploying Kubernetes configurations. A Helm chart contains template YAML files and a values.yaml
file which fills in variables defined in the templates. These variables can again be overridden by supplying another values
YAML file on the command line. Helm charts can be installed into a Kubernetes cluster from a local directory, Artifact Hub, or a Github repository (for example ).
To install Helm:
sudo snap install helm --classic
We can also install helmfile
for deploying multiple configurations from a YAML configuration file. Choose a release from https://github.com/helmfile/helmfile/releases:
# Download kubecolor
wget https://github.com/helmfile/helmfile/releases/download/v1.0.0-rc.5/helmfile_1.0.0-rc.5_linux_amd64.tar.gz
# Extract only the executable from the archive
tar xvzf helmfile_1.0.0-rc.5_linux_amd64.tar.gz helmfile
# Ensure that kubectl is on a $PATH directory (update your .bashrc file if needed)
mv helmfile $HOME/.local/bin
Tip
We can check the status of our installations so far using the check_deps.sh
script:
cd path/to/project/root
. check_deps.sh
Note that if you have already set your aliases below, the script will show your alias instead of the actual binary path.
You can load a set of useful bash aliases and functions to your bash
session by typing . util.sh
from the project root directory.
Additionally, you may add the following to your .bashrc
or .bash_aliases
file, which are automatically loaded when a new bash
terminal is created:
alias clusters='kind get clusters'
alias dprune='docker system prune --volumes'
alias k='kubectl'
alias kls='k config get-contexts'
alias kubectl='kubecolor'
alias kuse='k config use-context'
alias pods='k get pod'
ns () {
k config set-context --current --namespace=$@
}
knew() {
kind create cluster -n ${1:-kind} && ns ${2:-default}
}
kdel() {
kind delete cluster -n ${1:-kind}
}
Getting started
- Installing Docker, Kubernetes, and Helm
- Ubuntu / WSL2
- Mac OS
- Creating a new cluster
- Installing a service
Installed services
- Traefik
- Admin pod
- Database servers
- MySQL
- InfluxDB (Time series database)
- Neo4j (Graph database)
- Data Ingress and aggregation
- Telegraf MQTT
Developer
- Git best practices
- Helm best practices