Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📦 NEW: Add Containerd config template support #248

Closed
wants to merge 5 commits into from
Closed

📦 NEW: Add Containerd config template support #248

wants to merge 5 commits into from

Conversation

xrain0610
Copy link

this can use --containerd-config-template to offer a containerd template.

the template file like:

[plugins.opt]
    path = "%OPT%"
[plugins.cri]
  stream_server_address = "%NODE%"
  stream_server_port = "10010"
[plugins.cri.registry.mirrors]
  [plugins.cri.registry.mirrors."docker.io"]
    endpoint = ["https://hd.com"]

and if use cni, the cni config will append to the end.

@xrain0610 xrain0610 closed this Mar 20, 2019
@xrain0610 xrain0610 reopened this Mar 20, 2019
@ibuildthecloud
Copy link
Contributor

I commented here #264 (comment) but it applies to this PR too.

@uablrek
Copy link

uablrek commented Mar 28, 2019

With this PR applied I can run k3s on my laptop without internet connection. The config is below. Note that the private docker registry is unsecure ("http" instead of "https") which simplifies a lot in the setup.

[plugins.opt]
    path = "%OPT%"
[plugins.cri]
  stream_server_address = "%NODE%"
  stream_server_port = "10010"
[plugins.cri.registry.mirrors]
  [plugins.cri.registry.mirrors."docker.io"]
    endpoint = ["http://172.17.0.2:5000"]
  [plugins.cri.registry.mirrors."registry-1.docker.io"]
    endpoint = ["http://172.17.0.2:5000"]
  [plugins.cri.registry.mirrors."k8s.gcr.io"]
    endpoint = ["http://172.17.0.2:5000"]

The local registry must be pre-loaded with all images that k3s will need. I use skopeo but any way is good;

skopeo copy --dest-tls-verify=false docker://k8s.gcr.io/pause:3.1 docker://172.17.0.2:5000/pause:3.1
...

List the contents of the local registry with;

regip=172.17.0.2
for i in $(curl -s -X GET http://$regip:5000/v2/_catalog | jq -r .repositories[]); do
    echo "$i:"
    echo -n "  "
    curl -s -X GET http://$regip:5000/v2/$i/tags/list | jq -c .tags
done

@alexellis
Copy link

/subscribe 👍 (I'd like to see this and it would help k3d)

@@ -49,6 +49,12 @@ func Run(ctx context.Context, cfg *config.Node) error {
}

template := configToml

if cfg.ConfigTemplate != "" {
fileBytes, _ := ioutil.ReadFile(cfg.ConfigTemplate)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you catch the error here please and return err if it can't read the template

Name: "containerd-config-template",
Usage: "Use Custom Containerd config file",
Destination: &AgentConfig.ContainerdConfig,
Value: "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for Value item if its nil

@galal-hussein
Copy link
Contributor

Also can you rebase

@galal-hussein
Copy link
Contributor

closed in favor of #381

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants