Skip to content

Commit 010f778

Browse files
committed
Configures local registry through k3s-io/k3s#867
1 parent 2e9731f commit 010f778

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

bin/y-cluster-provision-k3s-multipass

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,35 +31,21 @@ export INSTALL_K3S_SKIP_START=true
3131
# For kubectl top to work with metrics-server, https://github.com/rancher/k3s/issues/252#issuecomment-482662774
3232
export INSTALL_K3S_EXEC="--kubelet-arg=address=0.0.0.0"
3333
34+
mkdir -p /etc/rancher/k3s
35+
cat <<EOF >> /etc/rancher/k3s/registries.yaml
36+
mirrors:
37+
"builds-registry.ystack.svc.cluster.local":
38+
endpoint:
39+
- http://builds-registry.ystack.svc.cluster.local
40+
"prod-registry.ystack.svc.cluster.local":
41+
endpoint:
42+
- http://prod-registry.ystack.svc.cluster.local
43+
EOF
44+
3445
INSTALLER_REVISION=e810ee1678dc59ed35970734e69a5b31b5773550
3546
export INSTALL_K3S_VERSION=v0.10.1-rc1
3647
curl -sfL https://github.com/rancher/k3s/raw/$INSTALLER_REVISION/install.sh | sh -
3748
38-
K3S_DATA_DIR=/var/lib/rancher/k3s
39-
40-
# https://github.com/rancher/k3s/issues/145
41-
# https://github.com/rancher/k3s/blob/master/pkg/agent/templates/templates.go
42-
mkdir -p $K3S_DATA_DIR/agent/etc/containerd
43-
cat <<EOF >> $K3S_DATA_DIR/agent/etc/containerd/config.toml.tmpl
44-
[plugins.opt]
45-
path = "{{ .NodeConfig.Containerd.Opt }}"
46-
47-
[plugins.cri]
48-
stream_server_address = "{{ .NodeConfig.AgentConfig.NodeName }}"
49-
stream_server_port = "10010"
50-
51-
[plugins.cri.cni]
52-
bin_dir = "{{ .NodeConfig.AgentConfig.CNIBinDir }}"
53-
conf_dir = "{{ .NodeConfig.AgentConfig.CNIConfDir }}"
54-
55-
[plugins.cri.registry]
56-
[plugins.cri.registry.mirrors]
57-
[plugins.cri.registry.mirrors."builds-registry.ystack.svc.cluster.local"]
58-
endpoint = ["http://builds-registry.ystack.svc.cluster.local"]
59-
[plugins.cri.registry.mirrors."prod-registry.ystack.svc.cluster.local"]
60-
endpoint = ["http://prod-registry.ystack.svc.cluster.local"]
61-
EOF
62-
6349
service k3s start
6450
k3s crictl info
6551

0 commit comments

Comments
 (0)