{"id":2972,"date":"2025-08-11T14:36:50","date_gmt":"2025-08-11T14:36:50","guid":{"rendered":"https:\/\/webbservern.se\/~jonas\/wordpress\/?p=2972"},"modified":"2025-11-25T00:07:41","modified_gmt":"2025-11-25T00:07:41","slug":"microk8s-registry-with-custom-images","status":"publish","type":"post","link":"https:\/\/webbservern.se\/~jonas\/wordpress\/?p=2972","title":{"rendered":"Microk8s registry with custom images"},"content":{"rendered":"\n<p>This is a post in the saga about running Kubernetes on a cluster of Ubuntu powered Raspberry Pi 4.<\/p>\n\n\n\n<p>I see that I built that RPI4 cluster five years ago but it still works well and works both as a playground and fullfilling some actual needs. I have updated to Ubuntu 24.04 since then but otherwise it is pretty much the same.<\/p>\n\n\n\n<p>Sooner or later one needs a custom image and I did write about <a href=\"https:\/\/webbservern.se\/~jonas\/wordpress\/?p=2948\">that earlier<\/a>. Yesterday I noticed that solution was not 100% correct. So for my own records and other microk8s users I sum up the steps here.<\/p>\n\n\n\n<p><strong>On the backplane host<\/strong><\/p>\n\n\n\n<p>Install the microk8s registry plugin: <code>microk8s enable registry<\/code><\/p>\n\n\n\n<p>Install the buildx plugin: <code>docker-buildx-plugin<\/code><\/p>\n\n\n\n<p>Create a file <code>buildkitd.toml<\/code> with this content (replace compute with your backplane host):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[registry.\"compute:32000\"]<br>&nbsp; http = true<\/pre>\n\n\n\n<p>Create a builder for multi-arch builds:<br><code>docker buildx create --use --name mybuilder --driver-opt network=host --buildkitd-flags '--allow-insecure-entitlement network.host' --buildkitd-flags '--allow-insecure-entitlement network.host' --config buildkitd.toml<\/code><\/p>\n\n\n\n<p>Create your image description, for example:<br><code>FROM debian:stable<br>RUN &lt;&lt;EOF<br>apt-get update &amp;&amp; apt-get install -y ffmpeg mediainfo wget ca-certificates python3 python3-pip procps elinks curl python3-bs4<\/code><br>EOF <\/p>\n\n\n\n<p>Build and push:<br><code>docker buildx build -f podcast-stable-image -t compute:32000\/mydebianstable:registry-20250811 --platform linux\/amd64,linux\/arm64 . --builder mybuilder --push<\/code><\/p>\n\n\n\n<p>Now you can refer to this image from your deployment.yaml (where compute is replaced with your backplane host): <code>image: compute:32000\/mydebianstable:registry<code>-20250811<\/code><\/code><\/p>\n\n\n\n<p><strong>On all nodes that will pull from the registry<\/strong><\/p>\n\n\n\n<p>Microk8s will assume https when trying to pull the image from the registry but the registry plugin only supports http. We tell containerd to use http by editing \/var\/snap\/microk8s\/current\/args\/containerd-template.toml and replacing the last section with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;plugins.\"io.containerd.grpc.v1.cri\".registry]\n  &#91;plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"compute:32000\"]\n    endpoint = &#91;\"http:\/\/compute:32000\"]\n    &#91;plugins.\"io.containerd.grpc.v1.cri\".registry.configs.\"compute:32000\".tls]\n      insecure_skip_verify = true\n<\/code><\/pre>\n\n\n\n<p>Then restart with: <code>sudo snap stop microk8s &amp;&amp; sudo snap start microk8s<\/code><\/p>\n\n\n\n<p>That should be it, you can schedule a job on a specific node (&#8220;rpi4-6&#8221; in the example below) where you have done the changes to see that it works. For example by modifying the deployment with yq (sudo snap install yq) before applying:<br><code>kubectl create job --from=cronjob\/cronjobnamehere makeupapodnamehere -o yaml | yq e '.spec.template.spec.nodeName = \"rpi4-6\"' - | kubectl apply -f -<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a post in the saga about running Kubernetes on a cluster of Ubuntu powered Raspberry Pi 4. I see that I built that RPI4 cluster five years ago but it still works well and works both as a &hellip; <a href=\"https:\/\/webbservern.se\/~jonas\/wordpress\/?p=2972\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,16],"tags":[804,826,840,839],"class_list":["post-2972","post","type-post","status-publish","format-standard","hentry","category-datorer","category-linux","tag-kubernetes","tag-microk8s","tag-registry","tag-rpi4"],"_links":{"self":[{"href":"https:\/\/webbservern.se\/~jonas\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2972","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webbservern.se\/~jonas\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webbservern.se\/~jonas\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webbservern.se\/~jonas\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webbservern.se\/~jonas\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2972"}],"version-history":[{"count":18,"href":"https:\/\/webbservern.se\/~jonas\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2972\/revisions"}],"predecessor-version":[{"id":3004,"href":"https:\/\/webbservern.se\/~jonas\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2972\/revisions\/3004"}],"wp:attachment":[{"href":"https:\/\/webbservern.se\/~jonas\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webbservern.se\/~jonas\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webbservern.se\/~jonas\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}