-
-
Save ezodude/cc51b32275c6925ae90e1cace57491ef to your computer and use it in GitHub Desktop.
KinD cluster creation
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
#!/bin/sh | |
set -o errexit | |
# create registry container unless it already exists | |
reg_name='kind-registry' | |
reg_port='5000' | |
running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" | |
if [ "${running}" != 'true' ]; then | |
docker run \ | |
-d --restart=always -p "${reg_port}:5000" --name "${reg_name}" \ | |
registry:2 | |
fi | |
# create a cluster with the local registry enabled in containerd | |
cat <<EOF | kind create cluster --config=- | |
kind: Cluster | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
nodes: | |
- role: control-plane | |
extraMounts: | |
- hostPath: /Users/victorp/projects/kind | |
containerPath: /data | |
- role: worker | |
extraMounts: | |
- hostPath: /Users/victorp/projects/kind | |
containerPath: /data | |
- role: worker | |
extraMounts: | |
- hostPath: /Users/victorp/projects/kind | |
containerPath: /data | |
containerdConfigPatches: | |
- |- | |
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."${reg_name}:${reg_port}"] | |
endpoint = ["http://${reg_name}:${reg_port}"] | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment