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.28] - Add ability to enable "latest" image tag support for Spegel registry. #9662

Closed
brandond opened this issue Mar 6, 2024 · 1 comment
Assignees
Milestone

Comments

@brandond
Copy link
Member

brandond commented Mar 6, 2024

Backport fix for Add ability to enable "latest" image tag support for Spegel registry.

@VestigeJ
Copy link

##Environment Details
Reproduced using VERSION=v1.28.7+k3s1
Validated using COMMIT=aa3a18ba9b7a02de75b69412769e14e057661631

Infrastructure

  • Cloud

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

Linux 5.14.21-150500.53-default x86_64 GNU/Linux
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP5"

Cluster Configuration:

NAME               STATUS   ROLES                       AGE    VERSION
ip-136             Ready    control-plane,etcd,master   9m2s   v1.28.7+k3s1

Config.yaml:

node-external-ip: 136
token: YOUR_TOKEN_HERE
write-kubeconfig-mode: 644
debug: true
protect-kernel-defaults: true
cluster-init: true
embedded-registry: true

Reproduction

$ 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
$ sudo vim /etc/rancher/k3s/registries.yaml
$ VERSION=v1.28.7+k3s1
$ sudo INSTALL_K3S_VERSION=$VERSION INSTALL_K3S_EXEC=server INSTALL_K3S_SKIP_ENABLE=true ./install-k3s.sh
$ sudo vim /etc/systemd/system/k3s.service.env
$ sudo systemctl start k3s
$ set_kubefig //export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
$ kgn //kubectl get nodes
$ kgp -A //kubectl get pods -A
$ k run janx --image=alpine:latest
$ k run jonx --image=nginx:latest
$ sudo journalctl -u k3s | grep -i latest
$ sudo journalctl -u k3s | grep -i spegel
$ COMMIT=aa3a18ba9b7a02de75b69412769e14e057661631
$ sudo INSTALL_K3S_COMMIT=$COMMIT INSTALL_K3S_EXEC=server INSTALL_K3S_SKIP_ENABLE=true ./install-k3s.sh
$ sudo vim /etc/rancher/k3s/registries.yaml
$ sudo vim /etc/systemd/system/k3s.service.env
$ k run jorb --image=alpine:latest
$ k run jorbz --image=nginx:latest
$ sudo journalctl -u k3s | grep -i latest
$ sudo journalctl -u k3s | grep -i spegel

Results:

$ sudo journalctl -u k3s | grep -i latest

Mar 13 22:28:36 ip-136 k3s[6588]: I0313 22:28:36.169943    6588 kube.go:621] List of node(ip-136) annotations: map[string]string{"alpha.kubernetes.io/provided-node-ip":"136", "etcd.k3s.cattle.io/local-snapshots-timestamp":"2024-03-13T22:28:23Z", "etcd.k3s.cattle.io/node-address":"136", "etcd.k3s.cattle.io/node-name":"ip-136-03fe9856", "k3s.io/external-ip":"ip-136", "k3s.io/hostname":"ip-136", "k3s.io/internal-ip":"136", "k3s.io/node-args":"[\"server\",\"--node-external-ip\",\"ip-136\",\"--token\",\"********\",\"--write-kubeconfig-mode\",\"644\",\"--debug\",\"true\",\"--protect-kernel-defaults\",\"true\",\"--cluster-init\",\"true\",\"--embedded-registry\",\"true\"]", "k3s.io/node-config-hash":"7JYLF6KYWMCQPABVZ33WBXJQ7B4FHDWU3VBFJJXHBBWNEJJICG6A====", "k3s.io/node-env":"{\"K3S_DATA_DIR\":\"/var/lib/rancher/k3s/data/a3b46c0299091b71bfcc617b1e1fec1845c13bdd848584ceb39d2e700e702a4b\",\"K3S_P2P_ENABLE_LATEST\":\"true\"}", "node.alpha.kubernetes.io/ttl":"0", "p2p.k3s.cattle.io/node-address":"/ip4/136/tcp/5001/p2p/QmT4fmaXAqwcgeCYxBnW57HTJjrc5QRAmW3PcqcCFMwFEd", "volumes.kubernetes.io/controller-managed-attach-detach":"true"}

$ sudo journalctl -u k3s | grep -i spegel

Mar 13 22:28:20 ip-136 k3s[6588]: time="2024-03-13T22:28:20Z" level=info msg="spegel 2024/03/13 22:28:20 p2p: \"level\"=0 \"msg\"=\"starting p2p router\" \"id\"=\"/ip4/136/tcp/5001/p2p/QmT4fmaXAAAAAA57HTJjrc5QRAmW3PcqcCFMwFEd\""
Mar 13 22:28:20 ip-136 k3s[6588]: time="2024-03-13T22:28:20Z" level=info msg="spegel 2024/03/13 22:28:20 p2p: \"level\"=0 \"msg\"=\"leader is self skipping connection to bootstrap node\""
Mar 13 22:28:20 ip-136 k3s[6588]: time="2024-03-13T22:28:20Z" level=info msg="spegel 2024/03/13 22:28:20 p2p: \"level\"=0 \"msg\"=\"leader is self skipping connection to bootstrap node\""
Mar 13 22:28:20 ip-136 k3s[6588]: time="2024-03-13T22:28:20Z" level=info msg="spegel 2024/03/13 22:28:20 \"level\"=0 \"msg\"=\"running scheduled image state update\""
Mar 13 22:30:20 ip-136 k3s[6588]: time="2024-03-13T22:30:20Z" level=info msg="spegel 2024/03/13 22:30:20 p2p: \"level\"=0 \"msg\"=\"leader is self skipping connection to bootstrap node\""
Mar 13 22:32:20 ip-136 k3s[6588]: time="2024-03-13T22:32:20Z" level=info msg="spegel 2024/03/13 22:32:20 p2p: \"level\"=0 \"msg\"=\"leader is self skipping connection to bootstrap node\""
Mar 13 22:34:20 ip-136 k3s[6588]: time="2024-03-13T22:34:20Z" level=info msg="spegel 2024/03/13 22:34:20 p2p: \"level\"=0 \"msg\"=\"leader is self skipping connection to bootstrap node\""
Mar 13 22:36:20 ip-136 k3s[6588]: time="2024-03-13T22:36:20Z" level=info msg="spegel 2024/03/13 22:36:20 p2p: \"level\"=0 \"msg\"=\"leader is self skipping connection to bootstrap node\""
Mar 13 22:37:20 ip-136 k3s[6588]: time="2024-03-13T22:37:20Z" level=info msg="spegel 2024/03/13 22:37:20 \"level\"=0 \"msg\"=\"running scheduled image state update\""
Mar 13 22:38:20 ip-136 k3s[6588]: time="2024-03-13T22:38:20Z" level=info msg="spegel 2024/03/13 22:38:20 p2p: \"level\"=0 \"msg\"=\"leader is self skipping connection to bootstrap node\""

// results from COMMIT_ID INSTALL
latest flag passed in same as before - although now it has functionality to receive the flag

$ sudo journalctl -u k3s | grep -i latest

 14132 kube.go:621] List of node(ip-136) annotations: map[string]string{"alpha.kubernetes.io/provided-node-ip":"136", "etcd.k3s.cattle.io/local-snapshots-timestamp":"2024-03-13T22:59:48Z", "etcd.k3s.cattle.io/node-address":"136", "etcd.k3s.cattle.io/node-name":"ip-136-ae7ab96b", "k3s.io/external-ip":"136", "k3s.io/hostname":"ip-136", "k3s.io/internal-ip":"136", "k3s.io/node-args":"[\"server\",\"--node-external-ip\",\"3.142.84.239\",\"--token\",\"********\",\"--write-kubeconfig-mode\",\"644\",\"--debug\",\"true\",\"--protect-kernel-defaults\",\"true\",\"--cluster-init\",\"true\",\"--embedded-registry\",\"true\"]", "k3s.io/node-config-hash":"EZ56DZ2RTFG3EUJGHKWKY5YMDSLVIBL3LBJ6WU7ZDAUAF6EAIKZA====", "k3s.io/node-env":"{\"K3S_DATA_DIR\":\"/var/lib/rancher/k3s/data/bb70d087036983a3c5ddf4b2162e25abf030d30ac789ae2919533f5575bf1b91\",\"K3S_P2P_ENABLE_LATEST\":\"true\"}", "node.alpha.kubernetes.io/ttl":"0", "p2p.k3s.cattle.io/node-address":"/ip4/136/tcp/5001/p2p/QmW2nrzXpeopsRviXVxcxQ8evo4TE2WGHzCS9maZMcHkix", "volumes.kubernetes.io/controller-managed-attach-detach":"true"}

$ sudo cat /var/lib/rancher/k3s/agent/etc/containerd/certs.d/_default/hosts.toml //server entry for fallback now written without intervention.

# File generated by k3s. DO NOT EDIT.

server = ""
capabilities = ["pull", "resolve", "push"]



[host."https://127.0.0.1:6443/v2"]
  capabilities = ["pull", "resolve"]
  ca = ["/var/lib/rancher/k3s/agent/server-ca.crt"]
  client = [["/var/lib/rancher/k3s/agent/client-k3s-controller.crt", "/var/lib/rancher/k3s/agent/client-k3s-controller.key"]]

latest images for alpine and nginx pulled and mirrored by spegel

$ sudo journalctl -u k3s | grep -i spegel

Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"level\"=0 \"msg\"=\"received image event\" \"image\"=\"docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\" \"type\"=\"CREATE\""
Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"level\"=10 \"msg\"=\"advertising keys\" \"host\"=\"QmW2nrzXpeopsRviXVxcxQ8evo4TE2WGHzCS9maZMcHkix\" \"keys\"=[\"docker.io/library/alpine:latest\" \"sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\" \"sha256:6457d53fb065d6f250e1504b9bc42d5b6c65941d57532c072d929dd0628977d0\" \"sha256:05455a08881ea9cf0e752bc48e61bbd71a34c029bb13df01e40e3e70e0d007bd\" \"sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8\"]"
Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"level\"=0 \"msg\"=\"received image event\" \"image\"=\"docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\" \"type\"=\"UPDATE\""
Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"level\"=10 \"msg\"=\"advertising keys\" \"host\"=\"QmW2nrzXpeopsRviXVxcxQ8evo4TE2WGHzCS9maZMcHkix\" \"keys\"=[\"docker.io/library/alpine:latest\" \"sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\" \"sha256:6457d53fb065d6f250e1504b9bc42d5b6c65941d57532c072d929dd0628977d0\" \"sha256:05455a08881ea9cf0e752bc48e61bbd71a34c029bb13df01e40e3e70e0d007bd\" \"sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8\"]"
Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"level\"=0 \"msg\"=\"received image event\" \"image\"=\"docker.io/library/alpine@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\" \"type\"=\"CREATE\""
Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"level\"=10 \"msg\"=\"advertising keys\" \"host\"=\"QmW2nrzXpeopsRviXVxcxQ8evo4TE2WGHzCS9maZMcHkix\" \"keys\"=[\"sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\" \"sha256:6457d53fb065d6f250e1504b9bc42d5b6c65941d57532c072d929dd0628977d0\" \"sha256:05455a08881ea9cf0e752bc48e61bbd71a34c029bb13df01e40e3e70e0d007bd\" \"sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8\"]"
Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"msg\"=\"\" \"error\"=\"mirror resolve retries exhausted for key: docker.io/library/alpine:latest\" \"path\"=\"/v2/library/alpine/manifests/latest\" \"status\"=500 \"method\"=\"HEAD\" \"latency\"=\"418.305µs\" \"ip\"=\"127.0.0.1\" \"handler\"=\"mirror\""
Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"level\"=0 \"msg\"=\"received image event\" \"image\"=\"docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\" \"type\"=\"UPDATE\""
Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"level\"=10 \"msg\"=\"advertising keys\" \"host\"=\"QmW2nrzXpeopsRviXVxcxQ8evo4TE2WGHzCS9maZMcHkix\" \"keys\"=[\"docker.io/library/alpine:latest\" \"sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\" \"sha256:6457d53fb065d6f250e1504b9bc42d5b6c65941d57532c072d929dd0628977d0\" \"sha256:05455a08881ea9cf0e752bc48e61bbd71a34c029bb13df01e40e3e70e0d007bd\" \"sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8\"]"
Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"level\"=0 \"msg\"=\"received image event\" \"image\"=\"docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\" \"type\"=\"UPDATE\""
Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"level\"=10 \"msg\"=\"advertising keys\" \"host\"=\"QmW2nrzXpeopsRviXVxcxQ8evo4TE2WGHzCS9maZMcHkix\" \"keys\"=[\"docker.io/library/alpine:latest\" \"sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\" \"sha256:6457d53fb065d6f250e1504b9bc42d5b6c65941d57532c072d929dd0628977d0\" \"sha256:05455a08881ea9cf0e752bc48e61bbd71a34c029bb13df01e40e3e70e0d007bd\" \"sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8\"]"
Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"level\"=0 \"msg\"=\"received image event\" \"image\"=\"docker.io/library/alpine@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\" \"type\"=\"UPDATE\""
Mar 13 23:07:21 ip-136 k3s[14132]: time="2024-03-13T23:07:21Z" level=info msg="spegel 2024/03/13 23:07:21 \"level\"=10 \"msg\"=\"advertising keys\" \"host\"=\"QmW2nrzXpeopsRviXVxcxQ8evo4TE2WGHzCS9maZMcHkix\" \"keys\"=[\"sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\" \"sha256:6457d53fb065d6f250e1504b9bc42d5b6c65941d57532c072d929dd0628977d0\" \"sha256:05455a08881ea9cf0e752bc48e61bbd71a34c029bb13df01e40e3e70e0d007bd\" \"sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8\"]"
Mar 13 23:07:26 ip-136 k3s[14132]: time="2024-03-13T23:07:26Z" level=info msg="spegel 2024/03/13 23:07:26 \"level\"=0 \"msg\"=\"received image event\" \"image\"=\"docker.io/library/nginx:latest@sha256:6db391d1c0cfb30588ba0bf72ea999404f2764febf0f1f196acd5867ac7efa7e\" \"type\"=\"CREATE\""
Mar 13 23:07:26 ip-136 k3s[14132]: time="2024-03-13T23:07:26Z" level=info msg="spegel 2024/03/13 23:07:26 \"level\"=10 \"msg\"=\"advertising keys\" \"host\"=\"QmW2nrzXpeopsRviXVxcxQ8evo4TE2WGHzCS9maZMcHkix\" \"keys\"=[\"docker.io/library/nginx:latest\" \"sha256:6db391d1c0cfb30588ba0bf72ea999404f2764febf0f1f196acd5867ac7efa7e\" \"sha256:52478f8cd6a142fd462f0a7614a7bb064e969a4c083648235d6943c786df8cc7\" \"sha256:92b11f67642b62bbb98e7e49169c346b30e20cd3c1c034d31087e46924b9312e\" \"sha256:8a1e25ce7c4f75e372e9884f8f7b1bedcfe4a7a7d452eb4b0a1c7477c9a90345\" \"sha256:e78b137be3552e1f36d84cb01c533a23febe4c48f6fcdff5d5b26a45a636053b\" \"sha256:39fc875bd2b2e4f867e8e5cc5ad43bd5d6650ddeaf8c28b04f374f7fbca085f3\" \"sha256:035788421403127b57e688a82706198331f06545a955b526f89f2bf53f52b078\" \"sha256:87c3fb37cbf2f763f67f3b270aa0785ca05a2caedac399b4bfeedfd0ccd77d87\" \"sha256:c5cdd1ce752da415a6563d9432e1ee718b2f4ba353ee2bb7c8ce2aa78d5b4ee1\" \"sha256:33952c5995320e59a81112f411bfb02e097562a72c12e85828da51132ace47cd\"]"
Mar 13 23:07:26 ip-136 k3s[14132]: time="2024-03-13T23:07:26Z" level=info msg="spegel 2024/03/13 23:07:26 \"level\"=0 \"msg\"=\"received image event\" \"image\"=\"docker.io/library/nginx:latest@sha256:6db391d1c0cfb30588ba0bf72ea999404f2764febf0f1f196acd5867ac7efa7e\" \"type\"=\"UPDATE\""
Mar 13 23:07:26 ip-136 k3s[14132]: time="2024-03-13T23:07:26Z" level=info msg="spegel 2024/03/13 23:07:26 \"level\"=10 \"msg\"=\"advertising keys\" \"host\"=\"QmW2nrzXpeopsRviXVxcxQ8evo4TE2WGHzCS9maZMcHkix\" \"keys\"=[\"docker.io/library/nginx:latest\" \"sha256:6db391d1c0cfb30588ba0bf72ea999404f2764febf0f1f196acd5867ac7efa7e\" \"sha256:52478f8cd6a142fd462f0a7614a7bb064e969a4c083648235d6943c786df8cc7\" \"sha256:92b11f67642b62bbb98e7e49169c346b30e20cd3c1c034d31087e46924b9312e\" \"sha256:8a1e25ce7c4f75e372e9884f8f7b1bedcfe4a7a7d452eb4b0a1c7477c9a90345\" \"sha256:e78b137be3552e1f36d84cb01c533a23febe4c48f6fcdff5d5b26a45a636053b\" \"sha256:39fc875bd2b2e4f867e8e5cc5ad43bd5d6650ddeaf8c28b04f374f7fbca085f3\" \"sha256:035788421403127b57e688a82706198331f06545a955b526f89f2bf53f52b078\" \"sha256:87c3fb37cbf2f763f67f3b270aa0785ca05a2caedac399b4bfeedfd0ccd77d87\" \"sha256:c5cdd1ce752da415a6563d9432e1ee718b2f4ba353ee2bb7c8ce2aa78d5b4ee1\" \"sha256:33952c5995320e59a81112f411bfb02e097562a72c12e85828da51132ace47cd\"]"
Mar 13 23:07:26 ip-136 k3s[14132]: time="2024-03-13T23:07:26Z" level=info msg="spegel 2024/03/13 23:07:26 \"level\"=0 \"msg\"=\"received image event\" \"image\"=\"docker.io/library/nginx@sha256:6db391d1c0cfb30588ba0bf72ea999404f2764febf0f1f196acd5867ac7efa7e\" \"type\"=\"CREATE\""

pods healthy / ran to completion
$ kgp -A

NAMESPACE     NAME                                      READY   STATUS      RESTARTS        AGE
default       janx                                      0/1     Completed   6 (2m49s ago)   5m44s
default       jonx                                      1/1     Running     0               5m43s
kube-system   coredns-6799fbcd5-5d48m                   1/1     Running     0               13m
kube-system   helm-install-traefik-crd-5rxqt            0/1     Completed   0               13m
kube-system   helm-install-traefik-wglww                0/1     Completed   1               13m
kube-system   local-path-provisioner-6c86858495-67z2h   1/1     Running     0               13m
kube-system   metrics-server-54fd9b65b-hvqzw            1/1     Running     0               13m
kube-system   svclb-traefik-013d8fc0-nb5qv              2/2     Running     0               12m
kube-system   traefik-f4564c4f4-zhrv2                   1/1     Running     0               12m

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

No branches or pull requests

2 participants