Created
April 6, 2021 12:46
-
-
Save pmietlicki/df4cd1b31848ec48c40774665076ee8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Default env vars | |
$env:CLUSTER_NAME="k3d-rancher" | |
$env:RANCHER_SERVER_HOSTNAME="rancher.localhost" | |
$env:KUBECONFIG_FILE="${env:CLUSTER_NAME}.yaml" | |
#Get Docker Desktop and WSL2 | |
choco install wsl2 -y | |
choco install docker-desktop -y | |
# Get kubectl and helm | |
choco install kubernetes-cli -y | |
choco install kubernetes-helm -y | |
# Get k3d | |
choco install k3d -y | |
k3d cluster stop $env:CLUSTER_NAME | |
k3d cluster delete $env:CLUSTER_NAME | |
# Create the cluster | |
k3d cluster create $env:CLUSTER_NAME --api-port 6550 --servers 1 --port 443:443@loadbalancer --wait | |
k3d cluster list | |
k3d kubeconfig get ${env:CLUSTER_NAME} > $env:KUBECONFIG_FILE | |
$env:KUBECONFIG=($env:KUBECONFIG_FILE) | |
kubectl get nodes | |
# https://rancher.com/docs/rancher/v2.x/en/installation/k8s-install/helm-rancher/ | |
# Install cert-manager with helm | |
helm repo add jetstack https://charts.jetstack.io | |
helm repo update | |
kubectl create namespace cert-manager | |
helm install cert-manager jetstack/cert-manager --namespace cert-manager --version v1.0.4 --set installCRDs=true --wait | |
kubectl -n cert-manager rollout status deploy/cert-manager | |
# Install Rancher | |
helm repo add rancher-latest https://releases.rancher.com/server-charts/latest | |
helm repo update | |
kubectl create namespace cattle-system | |
helm install rancher rancher-latest/rancher --namespace cattle-system --set hostname=${env:RANCHER_SERVER_HOSTNAME} --wait | |
kubectl -n cattle-system rollout status deploy/rancher | |
# Optionally purge your Docker env | |
# docker rm -f $(docker ps -qa) | |
# docker network prune -f | |
# docker volume prune - | |
# docker system prune -a -f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment