3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Red Hat OpenShift on IBM Cloud(VPC): OCRはどこに消えた?ICOSになった!

3
Last updated at Posted at 2020-07-08

はじめに

Red Hat OpenShift on IBM Cloud(VPC)でPV/PVC情報を見ると、初期状態では空っぽです。たしかClassic Infrastruture環境ではFile Storage(NFS)に配置されていたはずなのに・・・OpenShiftには内部レジストリ(Internal OpenShift Container Registry=OCR) があるはずですが、どこに行ったのでしょうか?

$ oc get pv --all-namespaces
No resources found
$ oc get pvc --all-namespaces
No resources found

結論から言うと、IBM Cloud docsに書いてありました。VPC版ではICOS(IBM Cloud Object Storage)にOCRを配置しているようです。ちょっと確認してみます。

Image repository名から辿ってみる

# oc get is
NAME          IMAGE REPOSITORY                                                       TAGS           UPDATED
hello-world   image-registry.openshift-image-registry.svc:5000/syasuda/hello-world   latest         6 days ago
node          image-registry.openshift-image-registry.svc:5000/syasuda/node          9.4.0-alpine   6 days ago

Pod内部からは<Service>.<Namespace>.svcでアクセスできることを鑑みると、openshift-image-registryというProject(NameSpace)にimage-registryというServiceが存在しているはず。

# oc get services -n openshift-image-registry
NAME                      TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)     AGE
image-registry            ClusterIP   172.21.62.214   <none>        5000/TCP    6d15h
image-registry-operator   ClusterIP   None            <none>        60000/TCP   6d15h

# oc describe service -n openshift-image-registry image-registry
Name:              image-registry
Namespace:         openshift-image-registry
Labels:            docker-registry=default
Annotations:       imageregistry.operator.openshift.io/checksum: sha256:1c19715a76014ae1d56140d6390a08f14f453c1a59dc36c15718f40c638ef63d
                   service.alpha.openshift.io/serving-cert-secret-name: image-registry-tls
                   service.alpha.openshift.io/serving-cert-signed-by: openshift-service-serving-signer@1593582513
                   service.beta.openshift.io/serving-cert-signed-by: openshift-service-serving-signer@1593582513
Selector:          docker-registry=default
Type:              ClusterIP
IP:                172.21.62.214
Port:              5000-tcp  5000/TCP
TargetPort:        5000/TCP
Endpoints:         172.17.74.11:5000
Session Affinity:  None
Events:            <none>

確かに存在しているので、このServiceが利用しているPodを探してみる。

$ oc get pod -n openshift-image-registry -l docker-registry=default
NAME                             READY   STATUS    RESTARTS   AGE
image-registry-9767d9b87-84f52   1/1     Running   0          6d18h

よって、image-registry-9767d9b87-84f52が該当のPodのようだ。

$ oc describe pod -n openshift-image-registry image-registry-9767d9b87-84f52
(途中略)
    Environment:
      REGISTRY_STORAGE_S3_REGIONENDPOINT:     https://xx.xxxxxx.xx.cloud-object-storage.appdomain.cloud
      REGISTRY_STORAGE:                       s3
      REGISTRY_STORAGE_S3_BUCKET:             roks-xxxxxxxxxxxxxxxxxxxx-xxxx
      REGISTRY_STORAGE_S3_REGION:             us-standard
      REGISTRY_STORAGE_S3_ENCRYPT:            false
      REGISTRY_STORAGE_S3_ACCESSKEY:          <set to the key 'REGISTRY_STORAGE_S3_ACCESSKEY' in secret 'image-registry-private-configuration'>  Optional: false
      REGISTRY_STORAGE_S3_SECRETKEY:          <set to the key 'REGISTRY_STORAGE_S3_SECRETKEY' in secret 'image-registry-private-configuration'>  Optional: false
      REGISTRY_HTTP_ADDR:                     :5000
      REGISTRY_HTTP_NET:                      tcp
      REGISTRY_HTTP_SECRET:                   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      REGISTRY_LOG_LEVEL:                     info
      REGISTRY_OPENSHIFT_QUOTA_ENABLED:       true
      REGISTRY_STORAGE_CACHE_BLOBDESCRIPTOR:  inmemory
      REGISTRY_STORAGE_DELETE_ENABLED:        true
      REGISTRY_OPENSHIFT_METRICS_ENABLED:     true
      REGISTRY_OPENSHIFT_SERVER_ADDR:         image-registry.openshift-image-registry.svc:5000
      REGISTRY_HTTP_TLS_CERTIFICATE:          /etc/secrets/tls.crt
      REGISTRY_HTTP_TLS_KEY:                  /etc/secrets/tls.key
(途中略)

確かにICOSにアクセスしているように見える。

Operator情報から辿ってみる

一方で、上記の結果からimage-registryはOperatorで動いていることが分かるので、Operatorの方から辿ってみる。

# oc get crd|grep image
configs.imageregistry.operator.openshift.io              2020-07-01T05:33:08Z
imagecontentsourcepolicies.operator.openshift.io         2020-07-01T05:32:57Z
images.config.openshift.io                               2020-07-01T05:32:57Z
$ oc describe configs.imageregistry.operator.openshift.io
(途中略)
Status:
  Conditions:
    Last Transition Time:  2020-07-01T05:50:41Z
    Reason:                S3 Bucket Exists
    Status:                True
    Type:                  StorageExists
    Last Transition Time:  2020-07-01T05:50:52Z
    Message:               The registry is ready
    Reason:                Ready
    Status:                True
    Type:                  Available
    Last Transition Time:  2020-07-01T05:50:56Z
    Message:               The registry is ready
    Reason:                Ready
    Status:                False
    Type:                  Progressing
    Last Transition Time:  2020-07-01T05:50:42Z
    Status:                False
    Type:                  Degraded
    Last Transition Time:  2020-07-01T05:50:42Z
    Status:                False
    Type:                  Removed
  Observed Generation:     1
  Ready Replicas:          0
  Storage:
    s3:
      Bucket:           roks-xxxxxxxxxxxxxxxxx-xxxxx
      Encrypt:          false
      Key ID:
      Region:           us-standard
      Region Endpoint:  https://xx.xxxxx.xx.xxxx.cloud-object-storage.appdomain.cloud
  Storage Managed:      false
(途中略)
$ oc describe images.config.openshift.io'
(途中略)
Status:
  Internal Registry Hostname:  image-registry.openshift-image-registry.svc:5000
(途中略)
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?