Skip to content

Instantly share code, notes, and snippets.

@cbron
Forked from daxmc99/k3dStart.sh
Last active November 13, 2019 15:10
Show Gist options
  • Save cbron/8513057ecb25c24c20cb28b3dadba854 to your computer and use it in GitHub Desktop.
Save cbron/8513057ecb25c24c20cb28b3dadba854 to your computer and use it in GitHub Desktop.
k3d local development script
#!/bin/bash
#set -x
#set -e
# Run with: k3dStart test
# This will remove and recreate a k3s cluster named test
[[ -z "$1" ]] && { echo "You must specify a cluster name" ; exit 1; }
name=$1
k3d delete --name=$name
k3d create --workers 0 --image rancher/k3s:v0.9.1 -n $name --publish 80:80 --publish 443:443
declare -i i; i=0
until k3d get-kubeconfig --name=$name 2>/dev/null
do
if (( i > 20 )); then
break
fi
sleep 2
i+=1
done
if [ "$name" == "rio" ]; then
sleep 2
echo kubectl delete service -n kube-system traefik
fi
@daxmc99
Copy link

daxmc99 commented Sep 24, 2019

Looks like you might need to publish ports?

@cbron
Copy link
Author

cbron commented Sep 24, 2019

Updated to publish all 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment