@@ -56,7 +56,7 @@ reg_name='kind-registry'
56
56
reg_port=' 5000'
57
57
running=" $( docker inspect -f ' {{.State.Running}}' " ${reg_name} " 2> /dev/null || true) "
58
58
if [ " ${running} " != ' true' ]; then
59
- docker run -d --restart=always -p " 127.0.0.1:${reg_port} :5000" --network kind -- name " ${reg_name} " registry:2
59
+ docker run -d --restart=always -p " 127.0.0.1:${reg_port} :5000" --name " ${reg_name} " registry:2
60
60
fi
61
61
62
62
if [ " ${recreate} " != 0 ]; then
@@ -72,26 +72,10 @@ networking:
72
72
serviceSubnet: "${service_network} "
73
73
containerdConfigPatches:
74
74
- |-
75
- [plugins."io.containerd.grpc.v1.cri".registry]
76
- config_path = "/etc/containerd/certs.d"
75
+ [plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost: ${reg_port} " ]
76
+ endpoint = ["http:// ${reg_name} : ${reg_port} "]
77
77
EOF
78
78
79
- # Add the registry config to the nodes
80
- #
81
- # This is necessary because localhost resolves to loopback addresses that are
82
- # network-namespace local.
83
- # In other words: localhost in the container is not localhost on the host.
84
- #
85
- # We want a consistent name that works from both ends, so we tell containerd to
86
- # alias localhost:${reg_port} to the registry container when pulling images
87
- REGISTRY_DIR=" /etc/containerd/certs.d/localhost:${reg_port} "
88
- for node in $( kind get nodes --name " ${cluster_name} " ) ; do
89
- docker exec " ${node} " mkdir -p " ${REGISTRY_DIR} "
90
- cat << EOF | docker exec -i "${node} " cp /dev/stdin "${REGISTRY_DIR} /hosts.toml"
91
- [host."http://${reg_name} :5000"]
92
- EOF
93
- done
94
-
95
79
# connect the registry to the cluster network if not already connected
96
80
if [ " $( docker inspect -f=' {{json .NetworkSettings.Networks.kind}}' " ${reg_name} " ) " = ' null' ]; then
97
81
docker network connect " kind" " ${reg_name} "
0 commit comments