MicroK8s : Enable Registry2021/05/13 |
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 Addon storage is already enabled. Enabling the private registry Applying registry manifest namespace/container-registry created persistentvolumeclaim/registry-claim created deployment.apps/registry created service/registry created configmap/local-registry-hosting configured 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 kube-system metrics-server-8bbfb4bdb-sczq9 1/1 Running 0 16m kube-system calico-kube-controllers-847c8c99d-92dm5 1/1 Running 1 52m kube-system kubernetes-dashboard-7ffd448895-6cgrz 1/1 Running 0 16m kube-system calico-node-9wpkd 1/1 Running 0 33m kube-system dashboard-metrics-scraper-6c4568dc68-5g2x2 1/1 Running 0 16m kube-system coredns-86f78bb79c-xcbkm 1/1 Running 0 16m kube-system hostpath-provisioner-5c65fbdb4f-bvzbp 1/1 Running 0 7m10s container-registry registry-9b57d9df8-7v98m 1/1 Running 0 34s |
[2] | After enabling Registry, it's possible to use it with common operation. |
root@dlp:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu latest 7e0aa2d69a15 2 weeks ago 72.7MB # tag and push root@dlp:~# docker tag 7e0aa2d69a15 localhost:32000/ubuntu:my-registry root@dlp:~# docker push localhost:32000/ubuntu:my-registry The push refers to repository [localhost:32000/ubuntu] 2f140462f3bc: Pushed 63c99163f472: Pushed ccdbb80308cc: Pushed my-registry: digest: sha256:86ac87f73641c920fb42cc9612d4fb57b5626b56ea2a19b894d0673fd5b4f2e9 size: 943root@dlp:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu latest 7e0aa2d69a15 2 weeks ago 72.7MB localhost:32000/ubuntu my-registry 7e0aa2d69a15 2 weeks ago 72.7MB |
[3] | To use Registry from other Nodes, add [insecure registry]. |
root@node02:~#
vi /etc/docker/daemon.json { "insecure-registries" : ["10.0.0.30:32000"] }
root@node02:~#
root@node02:~# systemctl restart docker
docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest f0b8a9a54136 17 hours ago 133MBroot@node02:~# docker tag f0b8a9a54136 10.0.0.30:32000/nginx:my-registry root@node02:~# docker push 10.0.0.30:32000/nginx:my-registry The push refers to repository [10.0.0.30:32000/nginx] f0f30197ccf9: Pushed eeb14ff930d4: Pushed c9732df61184: Pushed 4b8db2d7f35a: Pushed 431f409d4c5a: Pushed 02c055ef67f5: Pushed my-registry: digest: sha256:eba373a0620f68ffdc3f217041ad25ef084475b8feb35b992574cd83698e9e3c size: 1570root@node02:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE 10.0.0.30:32000/nginx my-registry f0b8a9a54136 17 hours ago 133MB nginx latest f0b8a9a54136 17 hours ago 133MB |
Sponsored Link |