bootstrap simple projects on kubernetes with kind and k3s
Project description
smol k8s lab 🧸
A tool to get up and running quickly with slimmer k8s distros on your local machine. Also helpful for benchmarking various k8s distros! :)
Getting Started
Installation
If you've already got Python3.11 and brew installed, you should be able to:
# install the CLI
pip3.11 install smol-k8s-lab
# Check the help menu before proceeding
smol-k8s-lab --help
Configuration
We've got a Quickstart guide for you to jump right in, but for sake of getting you up and running quickly, please run the following:
# create the directory structure. smol-k8s-lab will also use XDG base dir spec.
# if you'd like XDG, change the below line to: mkdir -p $XDG_CONFIG_HOME/smol-k8s-lab
mkdir -p ~/.config/smol-k8s-lab
# this doesn't have to be vim, you can use any editor of your choice :)
vim config.yaml
In the newly created config.yaml
, add the following:
# FQDN to access your web interfaces: all of these are only required if you
# specify optional app installs, such as argocd
domain:
# your base domain for use with subdomains below
# if commented out, you need to provide the entire domain name for each app below
base: "coolwebsitefordogs.com"
# subdomain for Argo CD, if you had base set, this would be:
# argocd.coolwebsitefordogs.com
argo_cd: "argocd"
# metallb IPs used for DNS later (make sure they're not in use)
metallb_address_pool:
enabled: true
# Example of required full CIDR notation
# - 192.168.90.01/32
# Used for letsencrypt-staging, to generate certs, change this to your email
email: "coolemailfordogs@verygooddogs.net"
# Use the external secrets provider with gitlab (only gitlab is currently supported)
external_secrets:
enabled: false
gitlab:
# token from here: https://gitlab.com/-/profile/personal_access_tokens
access_token: "kjdfsk758934fkldsafds"
namespace: "nextcloud"
log:
# logging level, Options: debug, info, warn, error
level: "info"
# optional: path of file to log to
# file: "./smol-k8s-log.log"
# a list of extra k3s args you'd like to pass in
extra_k3s_args: []
There's also full tutorials to manually set up different distros in the docs we maintain as well as BASH scripts for basic automation of each k8s distro in:
./bash_scripts/{NAME_OF_K8S_DISTRO}/bash_full_quickstart.sh
Under the hood
Note: this project is not officially afilliated with any of the below tooling or applications.
Supported k8s distributions
We always install the latest version of kubernetes that is available from the distro's startup script.
Distro | Description |
---|---|
k0s |
Simple, Solid & Certified Kubernetes Distribution |
k3s |
The certified Kubernetes distribution built for IoT & Edge computing |
KinD |
kind is a tool for running local Kubernetes clusters using Docker container “nodes”. kind was primarily designed for testing Kubernetes itself, but may be used for local development or CI. |
We tend to test first on k3s first, then the other distros.
Stack We Install on K8s
Version is the helm chart version, or manifest version.
Application | Version | Description |
---|---|---|
🐄 Local Path Provisioner |
latest | [k3s only] Default simple local file storage for persistent data |
metallb |
0.13.10 | loadbalancer for metal, since we're mostly selfhosting |
nginx-ingress |
4.7.1 | The ingress controller allows access to the cluster remotely, needed for web traffic |
cert-manager |
1.12.3 | For SSL/TLS certificates |
Optionally installed
Application/Tool | Version | Description |
---|---|---|
ESO |
0.9.1 | external-secrets-operator integrates external secret management systems like GitLab |
Argo CD |
5.42.1 | Gitops - Continuous Deployment |
Kyverno |
latest | Kubernetes native policy management to enforce policies on k8s resources |
KeyCloak |
16.0.2 | Self hosted IAM/Oauth2 solution |
k9s |
latest | Terminal based dashboard for kubernetes |
Tooling Used for the CLI itself and interface
smol-k8s-lab is written in Python and built and published using Poetry. You can check out the pyproject.toml
for the versions of each library we install below:
- rich (this is what makes all the pretty formatted text)
- PyYAML (to handle the k8s yamls and configs)
- bcrypt (to pass a password to argocd and automatically update your Bitwarden)
- click (handles arguments for the CLI)
We also utilize the Bitwarden cli, for a password manager so you never have to see/know your argocd password.
Troubleshooting
If you're stuck, checkout the Notes to see if we also got stuck on the same thing at some point :) Under each app or tool, we'll have notes on how to learn more about it, as well as any errors we've already battled.
Other Notes
Check out the optional
directory for quick examples on apps this script does not default install.
e.g. for postgres, go to ./optional/postgres
Status
This is still in later alpha, as we figure out all the distros we want to support, and pin all the versions, but if you'd like to contribute or just found a :bug:, feel free to open an issue (or pull request), and we'll take a look! We'll try to get back to you asap!
Contributors
JesseBot |
Max! |
And more!
Want to get started with argocd? If you've installed it via smol-k8s-lab, then you can jump here. Otherwise, if you want to start from scratch, start here
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for smol_k8s_lab-0.11.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d231ca5b202392b455dcc31a97ff54489f0a8873312fda964dd69271d49d70e9 |
|
MD5 | 46a2a7e9b785c02d7200193304fb3bb5 |
|
BLAKE2b-256 | 9898a1c25506bc937ae2c451ac39ed856c1dcceb923e9293d3d9c81fe44bdfcd |