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

Implement nerdctl import to load raw tarball (Was: loading image from tarball) #908

Closed
kameshsampath opened this issue Mar 18, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@kameshsampath
Copy link

/question

I installed the latest k3s using lima and trying to load images into it using nerdctl --namespace=k8s.io load , but when I use a tarball from stdin I get the following error

time="2022-03-18T05:10:56Z" level=fatal msg="unrecognized image format"

The command I used to for this

crane export docker.io/busybox - | lima nerdctl --namespace=k8s.io load

https://github.com/google/go-containerregistry/blob/main/cmd/crane/doc/crane_export.md

Additional Info

nerdctl version 0.17.1
limactl version 0.9.1

k3s is created using the following lima yaml

# Deploy kubernetes via k3s (which installs a bundled containerd).
# $ limactl start ./k3s.yaml
# $ limactl shell k3s sudo kubectl
#
# It can be accessed from the host by exporting the kubeconfig file;
# the ports are already forwarded automatically by lima:
#
# $ export KUBECONFIG=$PWD/kubeconfig.yaml
# $ limactl shell k3s sudo cat /etc/rancher/k3s/k3s.yaml >$KUBECONFIG
# $ kubectl get no
# NAME       STATUS   ROLES                  AGE   VERSION
# lima-k3s   Ready    control-plane,master   69s   v1.21.1+k3s1
#
# This example requires Lima v0.7.0 or later.

env:
  CONTAINERD_ADDRESS: /run/k3s/containerd/containerd.sock
  K3S_KUBECONFIG_MODE:  "644"
  INSTALL_K3S_EXEC: "--disable traefik"

images:
- location: https://github.com/lima-vm/alpine-lima/releases/download/v0.2.9/alpine-lima-rd-3.14.3-x86_64.iso
  arch: "x86_64"
  digest: "sha512:b3892ab70ff3140c7ffaa7ace0eef77b047acf633c00bc375abb867caa618c5bd2d94a71638fae7ef10c462c5d28560bdf7c68d603fa6944767700f08fa54a64"
- location: https://github.com/lima-vm/alpine-lima/releases/download/v0.2.9/alpine-lima-rd-3.14.3-aarch64.iso
  arch: "aarch64"
  digest: "sha512:416216a86742b5e653375019fc1e4ff57314f75d26a7d170e7680ff896616f1a45e82a0dca81c989492b7c43c624be80a0719a65563ea0359eab57623b01cfbc"

mounts:
- location: "~"
- location: "/tmp/lima"
  writable: true

# containerd is managed by k3s, not by Lima, so the values are set to false here.
containerd:
  system: false
  user: false

# CPUs: if you see performance issues, try limiting cpus to 1.
# 🟢 Builtin default: 4
cpus: 4

# Memory size
# 🟢 Builtin default: "4GiB"
memory: "8GiB"

# Disk size
# 🟢 Builtin default: "100GiB"
disk: "100GiB"

provision:
- mode: system
  script: |
    #!/bin/sh
    sudo apk add --update --no-cache curl wget
    curl -sfL https://get.k3s.io | sh -

probes:
- script: |
    #!/bin/bash
    set -eux -o pipefail
    if ! timeout 30s bash -c "until test -f /etc/rancher/k3s/k3s.yaml; do sleep 3; done"; then
            echo >&2 "k3s is not running yet"
            exit 1
    fi
  hint: |
    The k3s kubeconfig file has not yet been created.
    Run "limactl shell k3s sudo journalctl -u k3s" to check the log.
    If that is still empty, check the bottom of the log at "/var/log/cloud-init-output.log".

portForwards:
- guestSocket: "/run/user/{{.UID}}/buildkit/buildkitd.sock"
  hostSocket: "{{.Dir}}/sock/buildkitd.sock"

message: |
  To run `kubectl` on the host (assumes kubectl is installed):
  ----
  $ mkdir -p "{{.Dir}}/conf"
  $ export KUBECONFIG="{{.Dir}}/conf/kubeconfig.yaml"
  $ limactl shell {{.Name}} sudo cat /etc/rancher/k3s/k3s.yaml >$KUBECONFIG
  $ kubectl ...
  ----
  To run `buildkit` on the host (assumes buildctl is installed), run the following commands:
  -------
  export BUILDKIT_HOST="unix://{{.Dir}}/sock/buildkitd.sock"
  buildctl debug workers
  -------

Any thoughts how to work with these scenarios is highly helpful.

@AkihiroSuda
Copy link
Member

What's the content of the tar ball?
It needs to contain either index.json (OCI Image Spec) or manifest.json (Docker Image Spec).

@AkihiroSuda AkihiroSuda changed the title loading image from tarball loading image from tarball (crane export docker.io/busybox - | lima nerdctl --namespace=k8s.io load) Mar 18, 2022
@kameshsampath
Copy link
Author

I see the tarball as an filesystem tar but without manifest in it.

@AkihiroSuda
Copy link
Member

I see the tarball as an filesystem tar but without manifest in it.

This will be supported in nerdctl import (equivalent of docker import), but not implemented yet.

@AkihiroSuda AkihiroSuda changed the title loading image from tarball (crane export docker.io/busybox - | lima nerdctl --namespace=k8s.io load) Implement nerdctl import to load raw tarball (Was: loading image from tarball) Mar 18, 2022
@AkihiroSuda AkihiroSuda added enhancement New feature or request and removed kind/external status/needs-more-information Needs more information from OP labels Mar 18, 2022
@kameshsampath
Copy link
Author

kameshsampath commented Mar 18, 2022

I see the tarball as an filesystem tar but without manifest in it.

This will be supported in nerdctl import (equivalent of docker import), but not implemented yet.

Thank you. Which version it's expected ? I am trying to implement ko-build/ko#588 and using crane to build the tarball and import the image into k3s cluster using nerdctl.

@AkihiroSuda
Copy link
Member

Which version it's expected ?

As soon as somebody opens a PR 😄

@kameshsampath
Copy link
Author

Actually the google container registry does have manifest.json, i was able to progress with the load.

ko-build/ko#665

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

No branches or pull requests

2 participants