Creating a bucket
If you have a project, you can create a bucket in it.
-
If the project does not exist yet, create it:
kubectl create namespace <project_name> -
Create the
Bucketresource file:touch bucket.yaml -
Open the file and paste the configuration:
Bucket without public accessBucket with public accessapiVersion: storage.stackland.yandex.cloud/v1alpha1
kind: Bucket
metadata:
name: app-data
spec: {}apiVersion: storage.stackland.yandex.cloud/v1alpha1
kind: Bucket
metadata:
name: app-data
spec:
anonymousAccessFlags:
read: true
list: falseIn this case, all objects will be available for reading without authentication via the
https://storage.sys.<cluster domain>/<bucket_name>/<object_name>link.Where:
metadata.name: Bucket name. Use only lowercase Latin letters, numbers, and hyphens.metadata.namespace: Project you are creating the bucket in.spec.anonymousAccessFlags.read: Allows anonymous users to read objects.spec.anonymousAccessFlags.list: Allows anonymous users to get a list of objects.
-
Apply the manifest:
kubectl apply -f bucket.yaml -n <project_name> -
Check the bucket status:
kubectl get bucket -n <project_name>Wait until the
PHASEcolumn showsReady.
-
If you have not opened a project yet, select one.
-
In the left-hand menu, select Object Storage.
-
Click Create bucket.
-
Specify the following settings:
- Bucket name: Only use lowercase letters, numbers, and hyphens.
- Public access: Enable or disable anonymous access to objects.
-
Click Create.
What's next
- Create an access key to use your bucket via the S3 API.
- Learn more about the Object Storage resource model here.