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

[Release-1.30] - Auto-import images into the embedded registry while k3s is running #11557

Closed
vitorsavian opened this issue Jan 10, 2025 · 1 comment
Assignees
Milestone

Comments

@vitorsavian
Copy link
Member

Backport fix for Auto-import images into the embedded registry while k3s is running

@VestigeJ
Copy link

##Environment Details
New feature validated using COMMIT=6d4a3092eda1af55977d742973d5c4fccdf9f4c6

Infrastructure

  • Cloud

Node(s) CPU architecture, OS, and version:

Linux 6.4.0-150600.23.17-default x86_64 GNU/Linux
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP6"

Cluster Configuration:

NAME              STATUS   ROLES                       AGE     VERSION
ip                Ready    control-plane,etcd,master   8m51s   v1.30.9-rc1+k3s1

Config.yaml:

write-kubeconfig-mode: 644
debug: true
token: YOUR_TOKEN_HERE
node-external-ip: IPV4,IPV6
cluster-init: true

YOUR_REPRODUCED_RESULTS_HERE

$ curl https://get.k3s.io --output install-"k3s".sh
$ sudo chmod +x install-"k3s".sh
$ sudo groupadd --system etcd && sudo useradd -s /sbin/nologin --system -g etcd etcd
$ sudo modprobe ip_vs_rr
$ sudo modprobe ip_vs_wrr
$ sudo modprobe ip_vs_sh
$ sudo printf "on_oovm.panic_on_oom=0 \nvm.overcommit_memory=1 \nkernel.panic=10 \nkernel.panic_ps=1 \nkernel.panic_on_oops=1 \n" > ~/90-kubelet.conf
$ sudo cp 90-kubelet.conf /etc/sysctl.d/
$ sudo systemctl restart systemd-sysctl
$ COMMIT=6d4a3092eda1af55977d742973d5c4fccdf9f4c6
$ sudo mkdir -p /var/lib/rancher/k3s/agent/images/
$ wget https://github.com/rancher/rke2/releases/download/v1.32.1-rc1%2Brke2r1/rke2-images-canal.linux-arm64.tar.zst
$ mv rke2-images-canal.linux-arm64.tar.zst /var/lib/rancher/k3s/agent/images/
$ sudo mv rke2-images-canal.linux-arm64.tar.zst /var/lib/rancher/k3s/agent/images/
$ sudo INSTALL_K3S_COMMIT=$COMMIT INSTALL_K3S_EXEC=server ./install-k3s.sh
$ set_kubefig
$ sudo /usr/local/bin/k3s crictl img ls
$ wget https://github.com/rancher/rke2/releases/download/v1.32.1-rc1%2Brke2r1/rke2-images-canal.linux-amd64.tar.zst
$ sudo cp rke2-images-canal.linux-amd64.tar.zst /var/lib/rancher/k3s/agent/images/
$ sudo ls /var/lib/rancher/k3s/agent/images/
$ sudo /usr/local/bin/k3s crictl img ls
$ wget https://github.com/rancher/rke2/releases/download/v1.32.1-rc1%2Brke2r1/rke2-images-harvester.linux-amd64.tar.gz
$ sudo mv rke2-images-harvester.linux-amd64.tar.gz /var/lib/rancher/k3s/agent/images/
$ sudo /usr/local/bin/k3s crictl img ls

Results:

$ sudo /usr/local/bin/k3s crictl img ls

DEBU[0000] Asset dir /var/lib/rancher/k3s/data/76cef0332628f7ef127f6491ea11d9e9415073b1b410b87cf0c18486f8fc04e8
DEBU[0000] Running /var/lib/rancher/k3s/data/76cef0332628f7ef127f6491ea11d9e9415073b1b410b87cf0c18486f8fc04e8/bin/crictl [crictl img ls]
IMAGE                                        TAG                     IMAGE ID            SIZE
docker.io/rancher/hardened-calico            v3.29.1-build20250110   30c5fd6f985f1       580MB
docker.io/rancher/hardened-flannel           v0.26.3-build20250108   89c4afd26fc49       250MB
docker.io/rancher/klipper-helm               v0.9.3-build20241008    4e0aed78b287d       70.5MB
docker.io/rancher/klipper-lb                 v0.4.9                  11a5d8a9f31aa       4.99MB
docker.io/rancher/local-path-provisioner     v0.0.30                 b580d47bc23dd       18.6MB
docker.io/rancher/mirrored-coredns-coredns   1.12.0                  1cf5f116067c6       20.9MB
docker.io/rancher/mirrored-library-traefik   2.11.18                 4ac525c9cc83c       49.4MB
docker.io/rancher/mirrored-metrics-server    v0.7.2                  48d9cfaaf3904       19.5MB
docker.io/rancher/mirrored-pause             3.6                     6270bb605e12e       301kB

$ sudo /usr/local/bin/k3s crictl img ls

DEBU[0000] Asset dir /var/lib/rancher/k3s/data/76cef0332628f7ef127f6491ea11d9e9415073b1b410b87cf0c18486f8fc04e8
DEBU[0000] Running /var/lib/rancher/k3s/data/76cef0332628f7ef127f6491ea11d9e9415073b1b410b87cf0c18486f8fc04e8/bin/crictl [crictl img ls]
IMAGE                                        TAG                     IMAGE ID            SIZE
docker.io/rancher/hardened-calico            v3.29.1-build20250110   30c5fd6f985f1       580MB
docker.io/rancher/hardened-flannel           v0.26.3-build20250108   89c4afd26fc49       250MB
docker.io/rancher/klipper-helm               v0.9.3-build20241008    4e0aed78b287d       70.5MB
docker.io/rancher/klipper-lb                 v0.4.9                  11a5d8a9f31aa       4.99MB
docker.io/rancher/local-path-provisioner     v0.0.30                 b580d47bc23dd       18.6MB
docker.io/rancher/mirrored-coredns-coredns   1.12.0                  1cf5f116067c6       20.9MB
docker.io/rancher/mirrored-library-traefik   2.11.18                 4ac525c9cc83c       49.4MB
docker.io/rancher/mirrored-metrics-server    v0.7.2                  48d9cfaaf3904       19.5MB
docker.io/rancher/mirrored-pause             3.6                     6270bb605e12e       301kB

$ wget https://github.com/rancher/rke2/releases/download/v1.32.1-rc1%2Brke2r1/rke2-images-canal.linux-amd64.tar.zst

--2025-01-17 00:47:43--  https://github.com/rancher/rke2/releases/download/v1.32.1-rc1%2Brke2r1/rke2-images-canal.linux-amd64.tar.zst
Resolving github.com (github.com)... 140.82.116.4
Connecting to github.com (github.com)|140.82.116.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/253887459/4b7100af-a2b9-49bb-bc62-d77149a30f06?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20250117%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250117T004743Z&X-Amz-Expires=300&X-Amz-Signature=41c9199aa71efc8b993357d220db9ce6087e3aa9134c9470e2ce39af89dddd49&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Drke2-images-canal.linux-amd64.tar.zst&response-content-type=application%2Foctet-stream [following]
--2025-01-17 00:47:43--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/253887459/4b7100af-a2b9-49bb-bc62-d77149a30f06?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20250117%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250117T004743Z&X-Amz-Expires=300&X-Amz-Signature=41c9199aa71efc8b993357d220db9ce6087e3aa9134c9470e2ce39af89dddd49&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Drke2-images-canal.linux-amd64.tar.zst&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.111.133, 185.199.108.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 198227227 (189M) [application/octet-stream]
Saving to: ‘rke2-images-canal.linux-amd64.tar.zst’

rke2-images-canal.linux- 100%[=================================>] 189.04M  25.7MB/s    in 7.2s

2025-01-17 00:47:51 (26.4 MB/s) - ‘rke2-images-canal.linux-amd64.tar.zst’ saved [198227227/198227227]

$ sudo cp rke2-images-canal.linux-amd64.tar.zst /var/lib/rancher/k3s/agent/images/
$ sudo ls /var/lib/rancher/k3s/agent/images/
rke2-images-canal.linux-amd64.tar.zst rke2-images-canal.linux-arm64.tar.zst

$ sudo /usr/local/bin/k3s crictl img ls

DEBU[0000] Asset dir /var/lib/rancher/k3s/data/76cef0332628f7ef127f6491ea11d9e9415073b1b410b87cf0c18486f8fc04e8
DEBU[0000] Running /var/lib/rancher/k3s/data/76cef0332628f7ef127f6491ea11d9e9415073b1b410b87cf0c18486f8fc04e8/bin/crictl [crictl img ls]
IMAGE                                        TAG                     IMAGE ID            SIZE
docker.io/rancher/hardened-calico            v3.29.1-build20250110   30c5fd6f985f1       580MB
docker.io/rancher/hardened-flannel           v0.26.3-build20250108   89c4afd26fc49       250MB
docker.io/rancher/klipper-helm               v0.9.3-build20241008    4e0aed78b287d       70.5MB
docker.io/rancher/klipper-lb                 v0.4.9                  11a5d8a9f31aa       4.99MB
docker.io/rancher/local-path-provisioner     v0.0.30                 b580d47bc23dd       18.6MB
docker.io/rancher/mirrored-coredns-coredns   1.12.0                  1cf5f116067c6       20.9MB
docker.io/rancher/mirrored-library-traefik   2.11.18                 4ac525c9cc83c       49.4MB
docker.io/rancher/mirrored-metrics-server    v0.7.2                  48d9cfaaf3904       19.5MB
docker.io/rancher/mirrored-pause             3.6                     6270bb605e12e       301kB

$ wget https://github.com/rancher/rke2/releases/download/v1.32.1-rc1%2Brke2r1/rke2-images-harvester.linux-amd64.tar.gz

--2025-01-17 00:49:41--  https://github.com/rancher/rke2/releases/download/v1.32.1-rc1%2Brke2r1/rke2-images-harvester.linux-amd64.tar.gz
Resolving github.com (github.com)... 140.82.116.3
Connecting to github.com (github.com)|140.82.116.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/253887459/12ff2b57-62d6-422c-bf9a-b88ce8db7582?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20250117%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250117T004941Z&X-Amz-Expires=300&X-Amz-Signature=a8f730b3dea3ec1f001c5b7c06abe20bf61b55d27fc98f561be1a9314eca167f&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Drke2-images-harvester.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2025-01-17 00:49:41--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/253887459/12ff2b57-62d6-422c-bf9a-b88ce8db7582?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20250117%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250117T004941Z&X-Amz-Expires=300&X-Amz-Signature=a8f730b3dea3ec1f001c5b7c06abe20bf61b55d27fc98f561be1a9314eca167f&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Drke2-images-harvester.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.109.133, 185.199.110.133, 185.199.111.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 227665449 (217M) [application/octet-stream]
Saving to: ‘rke2-images-harvester.linux-amd64.tar.gz’

rke2-images-harvester.li 100%[=================================>] 217.12M  36.5MB/s    in 6.6s

2025-01-17 00:49:48 (32.8 MB/s) - ‘rke2-images-harvester.linux-amd64.tar.gz’ saved [227665449/227665449]

$ sudo mv rke2-images-harvester.linux-amd64.tar.gz /var/lib/rancher/k3s/agent/images/
$ sudo /usr/local/bin/k3s crictl img ls

DEBU[0000] Asset dir /var/lib/rancher/k3s/data/76cef0332628f7ef127f6491ea11d9e9415073b1b410b87cf0c18486f8fc04e8
DEBU[0000] Running /var/lib/rancher/k3s/data/76cef0332628f7ef127f6491ea11d9e9415073b1b410b87cf0c18486f8fc04e8/bin/crictl [crictl img ls]
IMAGE                                        TAG                     IMAGE ID            SIZE
docker.io/rancher/hardened-calico            v3.29.1-build20250110   10f4f2e33ce9a       587MB
docker.io/rancher/klipper-lb                 v0.4.9                  11a5d8a9f31aa       4.99MB
docker.io/rancher/mirrored-coredns-coredns   1.12.0                  1cf5f116067c6       20.9MB
<none>                                       <none>                  30c5fd6f985f1       580MB
docker.io/rancher/klipper-helm               v0.9.3-build20241008    4e0aed78b287d       70.5MB
docker.io/rancher/mirrored-library-traefik   2.11.18                 4ac525c9cc83c       49.4MB
docker.io/rancher/mirrored-metrics-server    v0.7.2                  48d9cfaaf3904       19.5MB
docker.io/rancher/mirrored-pause             3.6                     6270bb605e12e       301kB
<none>                                       <none>                  89c4afd26fc49       250MB
docker.io/rancher/hardened-flannel           v0.26.3-build20250108   e9483b31a6c46       226MB
docker.io/rancher/local-path-provisioner     v0.0.30                 b580d47bc23dd       18.6MB

$ sudo /usr/local/bin/k3s crictl img ls

DEBU[0000] Asset dir /var/lib/rancher/k3s/data/76cef0332628f7ef127f6491ea11d9e9415073b1b410b87cf0c18486f8fc04e8
DEBU[0000] Running /var/lib/rancher/k3s/data/76cef0332628f7ef127f6491ea11d9e9415073b1b410b87cf0c18486f8fc04e8/bin/crictl [crictl img ls]
IMAGE                                                             TAG                     IMAGE ID            SIZE
docker.io/rancher/hardened-calico                                 v3.29.1-build20250110   10f4f2e33ce9a       587MB
docker.io/rancher/hardened-flannel                                v0.26.3-build20250108   e9483b31a6c46       226MB
docker.io/rancher/harvester-csi-driver                            v0.2.2                  74d3560e67e0d       286MB
docker.io/rancher/klipper-helm                                    v0.9.3-build20241008    4e0aed78b287d       70.5MB
docker.io/rancher/klipper-lb                                      v0.4.9                  11a5d8a9f31aa       4.99MB
<none>                                                            <none>                  30c5fd6f985f1       580MB
docker.io/rancher/harvester-cloud-provider                        v0.2.4                  d63d457261e96       118MB
docker.io/rancher/local-path-provisioner                          v0.0.30                 b580d47bc23dd       18.6MB
docker.io/rancher/mirrored-coredns-coredns                        1.12.0                  1cf5f116067c6       20.9MB
docker.io/rancher/mirrored-kube-vip-kube-vip-iptables             v0.8.7                  89b8842380165       68.7MB
docker.io/rancher/mirrored-library-traefik                        2.11.18                 4ac525c9cc83c       49.4MB
docker.io/rancher/mirrored-longhornio-csi-attacher                v3.2.1                  6de272f181374       54.7MB
docker.io/rancher/mirrored-longhornio-csi-node-driver-registrar   v2.3.0                  368ee7d6e60fb       20MB
docker.io/rancher/mirrored-longhornio-csi-provisioner             v2.1.2                  0f0a0f7990768       52.9MB
docker.io/rancher/mirrored-longhornio-csi-resizer                 v1.2.0                  0aa9629e1508b       55.2MB
docker.io/rancher/mirrored-metrics-server                         v0.7.2                  48d9cfaaf3904       19.5MB
docker.io/rancher/mirrored-pause                                  3.6                     6270bb605e12e       301kB
<none>                                                            <none>                  89c4afd26fc49       250MB

@github-project-automation github-project-automation bot moved this from To Test to Done Issue in K3s Development Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done Issue
Development

No branches or pull requests

2 participants