Skip to content

Instantly share code, notes, and snippets.

@ruzickap
Created January 24, 2022 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruzickap/31d16c3e9ad6a6d9f3f80da1ed8e99a0 to your computer and use it in GitHub Desktop.
Save ruzickap/31d16c3e9ad6a6d9f3f80da1ed8e99a0 to your computer and use it in GitHub Desktop.
Start k33 kubernetes cluster using k3d with Rancher
#!/usr/bin/env bash
set -euxo pipefail
CLUSTER_NAME="rancher-dev"
k3d cluster delete --all
k3d cluster create "${CLUSTER_NAME}" \
--port "8080:80@loadbalancer" --port "8443:443@loadbalancer" \
--k3s-arg "--disable=traefik@all" \
--k3s-arg "--disable=local-storage@all" \
--k3s-arg "--disable=metrics-server@all" \
--kubeconfig-update-default=false --wait
k3d kubeconfig write ${CLUSTER_NAME} --overwrite --output /tmp/k3d-${CLUSTER_NAME}
KUBECONFIG="/tmp/k3d-${CLUSTER_NAME}"
export KUBECONFIG
## Rancher
# https://github.com/rancher/rancher/tree/master/chart)
# https://github.com/rancher/rancher/blob/master/chart/values.yaml
helm repo add --force-update rancher-latest https://releases.rancher.com/server-charts/latest
helm upgrade --install --version 2.6.2 --wait --namespace cattle-system --create-namespace --values - rancher rancher-latest/rancher << EOF
ingress:
enabled: false
tls:
source: secret
replicas: 1
bootstrapPassword: "test123"
EOF
kubectl patch svc rancher -n cattle-system -p '{"spec": {"type": "LoadBalancer"}}'
echo "*** export KUBECONFIG=\"${KUBECONFIG}\""
echo "*** https://localhost:8080"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment