question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Configure custom registry

See original GitHub issue

hi what’s the correct way to add a custom registry.yaml file to RD k3s? in k3d i do something like this: --volume "$cfgDir/registries.yaml:/etc/rancher/k3s/registries.yaml" thanks in advance

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
himslm01commented, Dec 18, 2021

Copying here from Slack…

With Rancher Desktop v0.7.0, for using local insecure registries:

  • When the Container Runtime is containerd you need to make /etc/rancher/k3s/registries.yaml with mirrors, as shown below. Here the mirrors act like aliases, so I can have a deployments spec.template.spec.containers[].image refer to nexus.lan/image:tag and containerd will pull the image from http://nexus.lan:8082

  • When the Container Runtime is dockerd (moby) you need to make /etc/docker/daemon.json with insecure-registries and registry-mirrors as shown below. But there are two problems as far as I can see.

    • there is no possibility of having an alias - so in my example deployment the spec.template.spec.containers[].image MUST refer to nexus.lan:8082/image:tag - making the deployment yaml potentially incompatible between containerd and dockerd (moby).
    • kubernetes MUST have imagePullSecrets pointing to a secret of type kubernetes.io/dockerconfigjson defined in the deployment’s spec.imagePullSecrets or in the imagePullSecrets of the serviceaccount called default in the namespace of your deployment.

You can define both /etc/rancher/k3s/registries.yaml and /etc/docker/daemon.json in one go by creating override.yaml in the following location:

  • Linux: $HOME/.local/share/rancher-desktop/lima/_config/override.yaml
  • Mac: $HOME/Library/Application Support/rancher-desktop/lima/_config/override.yaml
  • Windows: ???

Here’s my override.yaml

provision:
  - mode: system
    script: |
      #!/bin/sh
      set -eux
      mkdir -p /etc/rancher/k3s
      cat <<EOF >/etc/rancher/k3s/registries.yaml
      mirrors:
        docker.io:
          endpoint:
            - "http://nexus.lan:8082"
        nexus.lan:
          endpoint:
            - "http://nexus.lan:8082"
      EOF
      mkdir -p /etc/docker
      cat <<EOF >/etc/docker/daemon.json
      {
        "insecure-registries" : ["nexus.lan:8082"],
        "registry-mirrors": ["http://nexus.lan:8082"],
        "experimental": true
      }
      EOF
3reactions
janduboiscommented, Oct 15, 2021

Reference (for implementing this in the UI): private registry configuration.

A minimal implementation could just maintain a registry.yaml internally and make it editable in a text field.

Longer term a full UI (maybe driven by a schema definition) would be nice, but it should not delay exposing the functionality through the UI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploy a registry server - Docker Documentation
This topic provides basic information about deploying and configuring a registry. For an exhaustive list of configuration options, see the configuration ...
Read more >
How To Set Up a Private Docker Registry on Ubuntu 20.04
Step 1 — Installing and Configuring the Docker Registry · Step 2 — Setting Up Nginx Port Forwarding · Step 3 — Setting...
Read more >
Configuring a custom registry - IBM
In User account repository > Available realm definitions, select Standalone custom registry from the drop-down list. Click Configure. Specify the Primary ...
Read more >
A Guide to Docker Private Registry - Baeldung
In this tutorial, we'll learn to understand the use of public and private Docker registries. We'll also set up a private Docker registry....
Read more >
How to create your own private Docker registry and secure it
Why use a private registry? · Control where your images are stored - A private registry gives you full control over the storage...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found