Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Created April 5, 2021 00:35
Show Gist options
  • Save vfarcic/b025359ef5ba33353476bbfe881ec5c3 to your computer and use it in GitHub Desktop.
Save vfarcic/b025359ef5ba33353476bbfe881ec5c3 to your computer and use it in GitHub Desktop.
#################################
# K3d #
# How to run Kubernetes locally #
# https://youtu.be/mCesuGk-Fks #
#################################
# Referenced videos:
# - How to run local multi-node Kubernetes clusters using kind: https://youtu.be/C0v5gJSWuSo
# - Kaniko - Building Container Images In Kubernetes Without Docker: https://youtu.be/EgwVQN6GNJg
#########
# Setup #
#########
# Install `k3d` CLI (https://k3d.io/#installation)
#################################
# Creating single-node clusters #
#################################
export KUBECONFIG=$PWD/kubeconfig.yaml
k3d cluster create my-cluster
docker container ls
kubectl get pods -A
kubectl get nodes
################################
# Creating additional clusters #
################################
k3d cluster create another-cluster \
--image rancher/k3s:v1.20.4-k3s1
docker container ls
#####################
# Deleting clusters #
#####################
k3d cluster delete my-cluster
k3d cluster delete another-cluster
#####################################
# Creating clusters through configs #
#####################################
git clone https://github.com/vfarcic/k3d-demo.git
cd k3d-demo
cat k3d.yaml
k3d cluster create --config k3d.yaml
kubectl get nodes
kubectl apply --filename k8s/
# Open http://localhost in a browser
#####################
# Deleting clusters #
#####################
k3d cluster delete my-cluster
###########################
# Speed test against kind #
###########################
docker system prune -a -f --volumes
k3d cluster create my-cluster
k3d cluster delete my-cluster
# Please watch https://youtu.be/C0v5gJSWuSo if you are not already familiar with kind
kind create cluster --name my-cluster
kind delete cluster --name my-cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment