Skip to content

Instantly share code, notes, and snippets.

@WillianTomaz
Last active July 8, 2023 19:03
Show Gist options
  • Save WillianTomaz/25eff833edb9a2ca3d6e0165ed2104fc to your computer and use it in GitHub Desktop.
Save WillianTomaz/25eff833edb9a2ca3d6e0165ed2104fc to your computer and use it in GitHub Desktop.

Saturday, July 08, 2023

Running a Cluster for local tests with K3D

  • Was used:

    • Windows 11 (x64) with WSL 2 (Ubuntu 22.04.2 LTS)

Installing K3D:

### Installing from the script provided by k3d.io (https://k3d.io/v5.5.1/#install-script)
wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash

Creating a local cluster with k3d:

### Note: In WSL you need to start docker -> sudo dockerd
k3d cluster create <dev-cluster-name> -p "8081:80@loadbalancer" -p "8443:443@loadbalancer" --agents=2  --agents-memory 3G --k3s-arg "--disable=traefik@server:0"

Deleting a local cluster with k3d:

k3d cluster delete <dev-cluster-name>

Removing a context with kubectx:

kubectx -d <context-name>

Commands to see more information about the Cluster you just created:

kubectl cluster-info
kubectl get nodes
kubectl get namespaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment