OKD 4 : イメージレジストリー設定 : NFS2022/04/22 |
|
当例のようにクラスターを構成した場合は、イメージレジストリーが未構成のため、イメージの Pull/Push ができません。
よって、イメージレジストリーを設定します。
当例では、外部ストレージとして NFS を使用したイメージレジストリーを設定します。
OKD 4 クラスターは以下の通り構成しています。
--------------+----------------+-----------------+--------------
|10.0.0.25 | |10.0.0.24
+-------------+-------------+ | +--------------+-------------+
| [mgr.okd4.srv.world] | | | [bootstrap.okd4.srv.world] |
| Manager Node | | | Bootstrap Node |
| DNS | | | |
| Nginx | | | |
+---------------------------+ | +----------------------------+
|
--------------+----------------+-----------------+--------------
|10.0.0.40 | |10.0.0.41
+-------------+-------------+ | +--------------+-------------+
| [master-0.okd4.srv.world] | | | [master-1.okd4.srv.world] |
| Control Plane#1 | | | Control Plane#2 |
| | | | |
| | | | |
+---------------------------+ | +----------------------------+
|
--------------+----------------+
|10.0.0.42
+-------------+-------------+
| [master-2.okd4.srv.world] |
| Control Plane#3 |
| |
| |
+---------------------------+
|
| [1] |
こちらを参考に、ローカルネットワーク内に NFS サーバーを稼働させておきます。
なお、当例では NFS サーバーとして [nfs.srv.world (10.0.0.35)] を使用します。 |
| [2] | NFS サーバーで共有ディレクトリの設定をします。 |
|
[root@nfs ~]#
vi /etc/exports # 共有の設定を追記 /home/registry 10.0.0.0/24(rw,no_wdelay,no_root_squash,insecure,fsid=0) exportfs -ar |
| [3] | Manager ノードでイメージレジストリーの設定をします。 |
|
[root@mgr ~]# oc get pods -n openshift-image-registry NAME READY STATUS RESTARTS AGE cluster-image-registry-operator-6754c97c5b-fgwjb 1/1 Running 3 23h node-ca-h8lsg 1/1 Running 2 23h node-ca-kj29h 1/1 Running 2 23h node-ca-x7v4p 1/1 Running 2 23h
[root@mgr ~]#
oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"managementState":"Managed"}}' config.imageregistry.operator.openshift.io/cluster patched
[root@mgr ~]#
vi registry-pv.yml
apiVersion: v1
kind: PersistentVolume
metadata:
name: registry-pv
spec:
capacity:
storage: 100Gi
accessModes:
- ReadWriteOnce
- ReadWriteMany
persistentVolumeReclaimPolicy:
Retain
nfs:
path: /home/registry
server: 10.0.0.35
readOnly: false
oc apply -f registry-pv.yml persistentvolume/registry-pv created [root@mgr ~]# oc get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE registry-pv 100Gi RWO,RWX Retain Available 2s
[root@mgr ~]#
oc edit configs.imageregistry.operator.openshift.io
.....
.....
spec:
httpSecret: 995b1118ab61a40dea98e6a3ced685ebfe43ed3870807dc941320aa191fefe6b499
5ec52cb5832c8d2310db5043c4701127384c7f59389091da9c9dfed28a1a7b
logLevel: Normal
managementState: Managed
observedConfig: null
operatorLogLevel: Normal
proxy: {}
replicas: 1
requests:
read:
maxWaitInQueue: 0s
write:
maxWaitInQueue: 0s
rolloutStrategy: RollingUpdate
# 29行目 : 以下のように変更
storage:
pvc:
claim:
.....
.....
# 一定時間経過後 [image-registry] pod が起動 [root@mgr ~]# oc get pods -n openshift-image-registry NAME READY STATUS RESTARTS AGE cluster-image-registry-operator-6754c97c5b-k7gjg 1/1 Running 1 119m image-registry-c8664dbcd-wlzp7 1/1 Running 0 49s node-ca-ccvkb 1/1 Running 0 63m node-ca-nv8ws 1/1 Running 0 83m node-ca-rf8l7 1/1 Running 0 83m[root@mgr ~]# oc get pvc -n openshift-image-registry NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE image-registry-storage Bound registry-pv 100Gi RWO,RWX 8m32s |
| [4] | ユーザーが作成したプロジェクト等は以下のような階層で保管されます。 |
|
[root@nfs ~]# ll /home/registry/docker/registry/v2/repositories/ total 0 drwxr-xr-x. 3 1000340000 root 18 Aug 8 16:17 openshift drwxr-xr-x. 3 1000340000 root 38 Aug 8 16:21 test-project[root@nfs ~]# ll /home/registry/docker/registry/v2/repositories/test-project total 0 drwxr-xr-x. 5 1000340000 root 55 Aug 8 16:22 rails-postgresql-example |
| Sponsored Link |
|
|