Skip to content

Instantly share code, notes, and snippets.

@stealthybox
Created October 1, 2019 16:54
Show Gist options
  • Save stealthybox/4be627c760c27918a2d2017a0a7e3c8e to your computer and use it in GitHub Desktop.
Save stealthybox/4be627c760c27918a2d2017a0a7e3c8e to your computer and use it in GitHub Desktop.
kinder dev cluster that mounts kubernetes binaries -- use with https://github.com/kubernetes/kubeadm/tree/master/kinder
#!/bin/sh
# setup a kinder cluster with the bazel and output directories mounted
set -eu
binary="kubeadm"
kube_root="${kube_root:-${GOPATH:-${HOME}/go}/src/k8s.io/kubernetes}"
bazel_binpath="bazel-bin/cmd/${binary}/linux_amd64_pure_stripped/"
output_binpath="_output/local/bin/linux/amd64/"
kinder_root="${kinder_root:-${GOPATH:-${HOME}/go}/src/k8s.io/kubeadm/kinder}"
cat << EOF | kinder create cluster --config=/dev/stdin
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
- role: control-plane
extraMounts:
- containerPath: /output-bin
hostPath: ${kube_root}/${output_binpath}
- containerPath: /bazel-${binary}
hostPath: ${kube_root}/${bazel_binpath}
- containerPath: /kinder
hostPath: ${kinder_root}
EOF
docker exec -it kind-control-plane \
sh -c 'apt-get update && apt-get install -y git'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment