Skip to main content

Your submission was sent successfully! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates from Canonical and upcoming events where you can meet our team.Close

Thank you for contacting us. A member of our team will be in touch shortly. Close

An error occurred while submitting your form. Please try again or file a bug report. Close

Addon: MinIO

1.28
Compatibility: amd64 arm64
Source: See MinIO documentation

MinIO is a well-known and established project in the CNCF ecosystem that provides cloud-agnostic S3-compatible object storage. It is free, open-source and well-trusted by multiple organizations.

The minio addon can be used to deploy MinIO on a MicroK8s cluster using minio-operator. Optionally, this addon deploys a single MinIO tenant so that you can get started using it out of the box. The default tenant can be configured (storage capacity, number of volumes, security) using command-line arguments when enabling the addon (see below).

The MinIO addon can use the simple hostpath storage for single-node clusters, or any storage class you decide for multi-node clusters.

Enable

For single-node development clusters, enable the MinIO addon with a single command:

sudo microk8s enable minio

For a more advanced use-case (see sudo microk8s enable minio:-h for a list of all supported arguments), that deploys a MinIO tenant with 300GB storage capacity using the ceph-xfs storage class:

sudo microk8s enable minio -c 300Gi -s ceph-xfs

Alternatively, you can disable the creation of a default tenant and only deploy the MinIO operator with:

sudo microk8s enable minio -k

Access S3 endpoint and MinIO console

After deployment, you can access the MinIO console through a web browser, or through the MinIO client. You can access the MinIO endpoint through the svc/minio endpoint:

microk8s kubectl -n minio-operator get svc minio

The root user and password created for the MinIO tenant can be seen in the $TENANT_NAME-env-configuration secret:

TENANT_NAME="microk8s"
# The credentials are in the config.env field.
# They are in base64 and they need to be decoded.
microk8s kubectl get -n minio-operator secret $TENANT_NAME-env-configuration -o yaml

# Fetch and decode the credentials:
microk8s kubectl get -n minio-operator secret $TENANT_NAME-env-configuration -o jsonpath='{.data.config\.env}' | base64 -d
# Expected similar output:
# export MINIO_ROOT_USER="GYBCXGDRPSV1R08QX1DF"
# export MINIO_ROOT_PASSWORD="2n3MUksjHavRy2HmyvuE9JtnUsMI2YV2hxV4QF5X"

The Microk8s MinIO addon also creates a secondary user. You can get its credentials through the following:

TENANT_NAME="microk8s"
# The credentials are in the CONSOLE_ACCESS_KEY (user) and CONSOLE_SECRET_KEY (password) fields.
# They are in base64 and they need to be decoded.
microk8s kubectl get -n minio-operator secret $TENANT_NAME-user-1 -o yaml

Using the mc client

You can use the MinIO client to connect to the MinIO tenant. The same credentials described above can be used. Below is a script which creates an alias for the deployed MinIO tenant using the root user credentials:

# Get HOST and PORT.
HOST="$(microk8s kubectl get -n minio-operator service minio -o jsonpath='{.spec.clusterIP}')"
PORT="$(microk8s kubectl get -n minio-operator service minio -o jsonpath='{.spec.ports[0].port}')"

# Fetch, decode, and load the root user credentials into the environment:
TENANT_NAME="microk8s"
source <(microk8s kubectl get -n minio-operator secret $TENANT_NAME-env-configuration -o jsonpath='{.data.config\.env}' | base64 -d)
mc alias set $TENANT_NAME http://$HOST:$PORT $MINIO_ROOT_USER $MINIO_ROOT_PASSWORD

Alternatively, you use the other MinIO registered user credentials:

TENANT_NAME="microk8s"
MINIO_USER="$(microk8s kubectl get -n minio-operator secret $TENANT_NAME-user-1 -o jsonpath='{.data.CONSOLE_ACCESS_KEY}' | base64 -d)"
MINIO_PASSWORD="$(microk8s kubectl get -n minio-operator secret $TENANT_NAME-user-1 -o jsonpath='{.data.CONSOLE_SECRET_KEY}' | base64 -d)"
mc alias set $TENANT_NAME-user-1 http://$HOST:$PORT $MINIO_USER $MINIO_PASSWORD

The MinIO client can be used for second-day operations, like managing replication, or rebalancing. For example, to list all registered MinIO tenants:

mc alias list

which produces output similar to:

microk8s
  URL       : http://10.152.183.201:80
  AccessKey : 9fFwFQq5xMIzW8wlPPeP
  SecretKey : DuZqdnfh1cKJahXwb5z9qy7F5Eo0sObWYvSW0ARh
  API       : s3v4
  Path      : auto
  Src       : /home/ubuntu/.mc/config.json

Details about the MinIO tenant can be retrieved through the following command:

mc admin info microk8s

which produces output similar to:

●  10.152.183.201
   Uptime: 23 minutes
   Version: 2024-08-03T04:33:23Z
   Network: 1/1 OK
   Drives: 1/1 OK
   Pool: 1

┌──────┬───────────────────────┬─────────────────────┬──────────────┐
│ Pool │ Drives Usage          │ Erasure stripe size │ Erasure sets │
│ 1st  │ 25.8% (total: 90 GiB) │ 1                   │ 1            │
└──────┴───────────────────────┴─────────────────────┴──────────────┘

1 drive online, 0 drives offline, EC:0

Last updated 1 year, 2 months ago. Help improve this document in the forum.