Skip to content

Commit

Permalink
How to use a local registry for minikube clusters
Browse files Browse the repository at this point in the history
Using local registry is useful for demos when network is unreliable, for
example in a conference. It can also be used to avoid random failures
when the network is flaky, by caching remove images locally.

Signed-off-by: Nir Soffer <[email protected]>
  • Loading branch information
nirs committed Jan 28, 2024
1 parent 74c7dce commit bda6fcb
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
73 changes: 73 additions & 0 deletions test/registry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Using local registry for minikube clusters

## Initial setup

1. Install podman

```
sudo dnf install podman
```

1. Run the registry container

```
podman run --name registry \
--publish 5000:5000 \
--volume registry:/var/lib/registry:Z \
--detach \
--replace \
docker.io/library/registry:latest
```

Use `--replace` to replace an existing container, typically left
after reboot the host.

1. Allow access to port 5000 in the libvirt zone

```
sudo firewall-cmd --zone=libvirt --add-port=5000/tcp --permanent
sudo firewall-cmd --reload
```

1. Configure podman to allow insecure access

```
sudo cp host.minikube.internal.conf /etc/containers/registries.conf.d/
```

1. Testing the registry

```
$ curl host.minikube.internal:5000/v2/_catalog
{}
```

## Pushing to the local registry

1. Pull the image from a remote registry

```
podman pull quay.io/nirsof/cirros:0.6.2-1
```

1. Push to the local registry

```
podman push quay.io/nirsof/cirros:0.6.2-1 host.minikube.internal:5000/nirsof/cirros:0.6.2-1
```

## Using images from the local registry

Example source.yaml:

```
---
apiVersion: cdi.kubevirt.io/v1beta1
kind: VolumeImportSource
metadata:
name: cirros-source
spec:
source:
registry:
url: "docker://host.minikube.internal:5000/nirsof/cirros:0.6.2-1"
```
4 changes: 4 additions & 0 deletions test/registry/host.minikube.internal.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Local registry for serving minikube clusters
[[registry]]
location = 'host.minikube.internal:5000'
insecure = true

0 comments on commit bda6fcb

Please sign in to comment.