Configure and use custom docker registry inside Rancher

Hi,

Can anybody advice me simple way to configure and use docker registry inside test single node installation of Rancher 2.x?

I tried to do so with:

$ cat registry.yaml 
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myregistry-deployment
spec:
  selector:
    matchLabels:
      app: myregistry
  replicas: 1
  template:
    metadata:
      labels:
        app: myregistry
    spec:
      containers:
      - name: myregistry
        image: registry:latest
        ports:
        - containerPort: 5000
          protocol: TCP

$ kubectl apply -f registry.yaml 
deployment.apps/myregistry-deployment created

$ cat loadbalancer.yaml 
apiVersion: v1
kind: Service
metadata:
  name: myregistry-load-balancer
spec:
  type: LoadBalancer
  selector:
    app: myregistry
  ports:
    - protocol: TCP
      port: 5000
      targetPort: 5000
      name: http

$ kubectl apply -f loadbalancer.yaml 
service/myregistry-load-balancer created

$ kubectl get svc
NAME                       TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
kubernetes                 ClusterIP      10.43.0.1       <none>        443/TCP          8d
myregistry-load-balancer   LoadBalancer   10.43.135.155   <pending>     5000:30112/TCP   4s

$ curl -v https://127.0.0.1:30112
* About to connect() to 127.0.0.1 port 30112 (#0)
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 30112 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* NSS error -12263 (SSL_ERROR_RX_RECORD_TOO_LONG)
* SSL received a record that exceeded the maximum permissible length.
* Closing connection 0
curl: (35) SSL received a record that exceeded the maximum permissible length.

Help me to resolve this issue please

LoadBalancer types can’t be used out of the box in most clusters, it requires either a cloud provider which can provide a load balancer for the type or something like MetalLB. (see https://rancher.com/docs/rancher/v2.x/en/faq/technical/#why-is-my-layer-4-load-balancer-in-pending-state)

I think https://github.com/alexellis/k8s-tls-registry is probably a good starting point to get a feel for the requirements.