Use this information to create an Object Bucket Claim using the command line
interface.
Before you begin
Download the Multicloud Object Gateway (MCG) command-line interface.
subscription-manager repos --enable=rh-odf-4-for-rhel-8-x86_64-rpms
yum install mcg
Note: Specify the appropriate architecture for enabling the repositories using the subscription
manager.
About this task
When creating an Object Bucket Claim (OBC) using the command-line interface, you get a
configuration map and a Secret that together contain all the information your application needs to
use the object storage service.
Procedure
- Use the command-line interface to generate the details of a new bucket and credentials.
noobaa obc create <obc-name> -n openshift-storage
Replace <obc-name> with a unique OBC name, for example,
myappobc
.
Additionally, you can use the --app-namespace
option to specify the namespace
where the OBC configuration map and secret will be created, for example,
myapp-namespace
.
For
example:
INFO[0001] ✅ Created: ObjectBucketClaim "test21obc"
- Run the following command to view the OBC.
oc get obc -n openshift-storage
Example output:
NAME STORAGE-CLASS PHASE AGE
test21obc openshift-storage.noobaa.io Bound 38s
- Run the following command to view the YAML file for the new OBC.
oc get obc test21obc -o yaml -n openshift-storage
Example YAML
output:
apiVersion: objectbucket.io/v1alpha1
kind: ObjectBucketClaim
metadata:
creationTimestamp: "2019-10-24T13:30:07Z"
finalizers:
- objectbucket.io/finalizer
generation: 2
labels:
app: noobaa
bucket-provisioner: openshift-storage.noobaa.io-obc
noobaa-domain: openshift-storage.noobaa.io
name: test21obc
namespace: openshift-storage
resourceVersion: "40756"
selfLink: /apis/objectbucket.io/v1alpha1/namespaces/openshift-storage/objectbucketclaims/test21obc
uid: 64f04cba-f662-11e9-bc3c-0295250841af
spec:
ObjectBucketName: obc-openshift-storage-test21obc
bucketName: test21obc-933348a6-e267-4f82-82f1-e59bf4fe3bb4
generateBucketName: test21obc
storageClassName: openshift-storage.noobaa.io
status:
phase: Bound
- Inside of your
openshift-storage
namespace, you can find the
configuration map and the secret to use this OBC. The CM and the secret have the same name as the
OBC.
oc get -n openshift-storage secret test21obc -o yaml
For
example:
apiVersion: v1
data:
AWS_ACCESS_KEY_ID: c0M0R2xVanF3ODR3bHBkVW94cmY=
AWS_SECRET_ACCESS_KEY: Wi9kcFluSWxHRzlWaFlzNk1hc0xma2JXcjM1MVhqa051SlBleXpmOQ==
kind: Secret
metadata:
creationTimestamp: "2019-10-24T13:30:07Z"
finalizers:
- objectbucket.io/finalizer
labels:
app: noobaa
bucket-provisioner: openshift-storage.noobaa.io-obc
noobaa-domain: openshift-storage.noobaa.io
name: test21obc
namespace: openshift-storage
ownerReferences:
- apiVersion: objectbucket.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: ObjectBucketClaim
name: test21obc
uid: 64f04cba-f662-11e9-bc3c-0295250841af
resourceVersion: "40751"
selfLink: /api/v1/namespaces/openshift-storage/secrets/test21obc
uid: 65117c1c-f662-11e9-9094-0a5305de57bb
type: Opaque
The secret gives you S3 access credentials.
- Run the following command to see the configuration map:
oc get -n openshift-storage cm test21obc -o yaml
For example:
apiVersion: v1
data:
BUCKET_HOST: 10.0.171.35
BUCKET_NAME: test21obc-933348a6-e267-4f82-82f1-e59bf4fe3bb4
BUCKET_PORT: "31242"
BUCKET_REGION: ""
BUCKET_SUBREGION: ""
kind: ConfigMap
metadata:
creationTimestamp: "2019-10-24T13:30:07Z"
finalizers:
- objectbucket.io/finalizer
labels:
app: noobaa
bucket-provisioner: openshift-storage.noobaa.io-obc
noobaa-domain: openshift-storage.noobaa.io
name: test21obc
namespace: openshift-storage
ownerReferences:
- apiVersion: objectbucket.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: ObjectBucketClaim
name: test21obc
uid: 64f04cba-f662-11e9-bc3c-0295250841af
resourceVersion: "40752"
selfLink: /api/v1/namespaces/openshift-storage/configmaps/test21obc
uid: 651c6501-f662-11e9-9094-0a5305de57bb
The configuration map contains
the S3 endpoint information for your application.