Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#1542 from BenTheElder/fix-registry
Browse files Browse the repository at this point in the history
fix kind-with-registry for v0.8
  • Loading branch information
k8s-ci-robot authored May 1, 2020
2 parents 38f9bf5 + e05fb15 commit 1a93b0d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions site/static/examples/kind-with-registry.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/bin/sh
set -o errexit

# desired cluster name; default is "kind"
KIND_CLUSTER_NAME="${KIND_CLUSTER_NAME:-kind}"

# create registry container unless it already exists
reg_name='kind-registry'
reg_port='5000'
Expand All @@ -13,14 +10,22 @@ if [ "${running}" != 'true' ]; then
-d --restart=always -p "${reg_port}:5000" --name "${reg_name}" \
registry:2
fi
reg_ip="$(docker inspect -f '{{.NetworkSettings.IPAddress}}' "${reg_name}")"

# create a cluster with the local registry enabled in containerd
cat <<EOF | kind create cluster --name "${KIND_CLUSTER_NAME}" --config=-
cat <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"]
endpoint = ["http://${reg_ip}:${reg_port}"]
endpoint = ["http://${reg_name}:${reg_port}"]
EOF

# connect the registry to the cluster network
docker network connect "kind" "${reg_name}"

# tell https://tilt.dev to use the registry
# https://docs.tilt.dev/choosing_clusters.html#discovering-the-registry
for node in $(kind get nodes); do
kubectl annotate node "${node}" "kind.x-k8s.io/registry=localhost:${reg_port}";
done

0 comments on commit 1a93b0d

Please sign in to comment.