CentOS 8
Sponsored Link

MicroK8s : Enable Registry2020/08/12

 
To enable MicroK8s built-in Registry, Configure like follows.
[1] Enable built-in Registry on primary Node.
After enabling, [kube-proxy] listens on [0.0.0.0:32000].
# enable registry with backend storage size 30G

# default size is 20G if it's not specified

# possible to specify the size on MicroK8s 1.18.3 or later

[root@dlp ~]#
microk8s enable registry:size=30Gi

Enabling default storage class
deployment.apps/hostpath-provisioner created
storageclass.storage.k8s.io/microk8s-hostpath created
serviceaccount/microk8s-hostpath created
clusterrole.rbac.authorization.k8s.io/microk8s-hostpath created
clusterrolebinding.rbac.authorization.k8s.io/microk8s-hostpath created
Storage will be available soon
Enabling the private registry
Applying registry manifest
namespace/container-registry created
persistentvolumeclaim/registry-claim created
deployment.apps/registry created
service/registry created
The registry is enabled
The size of the persistent volume is 30Gi

# [registry] pod starts

[root@dlp ~]#
microk8s kubectl get pods -A

NAMESPACE            NAME                                        READY   STATUS    RESTARTS   AGE
container-registry   registry-7cf58dcdcc-btrb9                   1/1     Running   0          2m16s
kube-system          coredns-588fd544bf-4d4kc                    1/1     Running   0          31m
kube-system          dashboard-metrics-scraper-59f5574d4-lmgmt   1/1     Running   0          31m
kube-system          hostpath-provisioner-75fdc8fccd-fnsrv       1/1     Running   0          11m
kube-system          kubernetes-dashboard-6d97855997-bwg2g       1/1     Running   0          31m
kube-system          metrics-server-c65c9d66-kdxh8               1/1     Running   2          16h
[2] After enabling Registry, it's possible to use it with common operation.
[root@dlp ~]#
vi /etc/containers/registries.conf
# line 48: add your [insecure registry]

[registries.insecure]
registries = [
'localhost', '127.0.0.1', 'dlp.srv.world'
]
[root@dlp ~]#
podman images

REPOSITORY                 TAG      IMAGE ID       CREATED        SIZE
docker.io/library/centos   latest   0d120b6ccaa8   38 hours ago   222 MB

# tag and push

[root@dlp ~]#
podman tag 0d120b6ccaa8 localhost:32000/my-centos:registry

[root@dlp ~]#
podman push localhost:32000/my-centos:registry

Getting image source signatures
Copying blob 291f6e44771a done
Copying config 0d120b6cca done
Writing manifest to image destination
Storing signatures

[root@dlp ~]#
podman images

REPOSITORY                  TAG        IMAGE ID       CREATED        SIZE
docker.io/library/centos    latest     0d120b6ccaa8   39 hours ago   222 MB
localhost:32000/my-centos   registry   0d120b6ccaa8   39 hours ago   222 MB
[3] To use Registry from other Nodes, it's the same usage.
[root@node01 ~]#
vi /etc/containers/registries.conf
# line 48: add your [insecure registry]

[registries.insecure]
registries = [
'dlp.srv.world'
]
[root@node01 ~]#
podman pull dlp.srv.world:32000/my-centos:registry

Trying to pull dlp.srv.world:32000/my-centos:registry...
Getting image source signatures
Copying blob 590ac07fde4c done
Copying config 0d120b6cca done
Writing manifest to image destination
Storing signatures
0d120b6ccaa8c5e149176798b3501d4dd1885f961922497cd0abef155c869566

[root@node01 ~]#
podman images

REPOSITORY                      TAG        IMAGE ID       CREATED        SIZE
dlp.srv.world:32000/my-centos   registry   0d120b6ccaa8   39 hours ago   222 MB
Matched Content