This guide walks you through deploying a MinIO cluster with KubeBlocks and connecting to it via the S3 API and Web Console.
kubectl v1.21+ installed and configured with cluster accesshelm install minio kubeblocks/minio --version 1.1.0-alpha.0 -n kb-system
demo):
kubectl create ns demo
Deploy a 2-replica MinIO cluster (minimum for distributed mode):
kubectl apply -f - <<EOF
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
name: minio-cluster
namespace: demo
spec:
terminationPolicy: Delete
componentSpecs:
- name: minio
componentDef: minio
replicas: 2
resources:
limits:
cpu: "1"
memory: "1Gi"
requests:
cpu: "1"
memory: "1Gi"
volumeClaimTemplates:
- name: data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
EOF
To pre-create buckets on startup, add an environment variable:
env:
- name: MINIO_BUCKETS
value: "my-bucket,another-bucket"
kubectl get cluster minio-cluster -n demo
NAME CLUSTER-DEFINITION TERMINATION-POLICY STATUS AGE
minio-cluster Delete Running 2m
kubectl get pods -n demo -l app.kubernetes.io/instance=minio-cluster
NAME READY STATUS RESTARTS AGE
minio-cluster-minio-0 2/2 Running 0 2m
minio-cluster-minio-1 2/2 Running 0 2m
Root credentials are auto-generated and stored in a Kubernetes Secret:
MINIO_USER=$(kubectl get secret minio-cluster-minio-account-root -n demo \
-o jsonpath='{.data.username}' | base64 -d)
MINIO_PASS=$(kubectl get secret minio-cluster-minio-account-root -n demo \
-o jsonpath='{.data.password}' | base64 -d)
echo "Username: $MINIO_USER"
echo "Password: $MINIO_PASS"
Port-forward the S3 API port and use the AWS CLI or MinIO client:
kubectl port-forward svc/minio-cluster-minio 9000:9000 -n demo &
# Using AWS CLI (compatible with S3)
aws s3 ls --endpoint-url http://localhost:9000 \
--no-sign-request 2>/dev/null || \
aws configure set aws_access_key_id "$MINIO_USER" && \
aws configure set aws_secret_access_key "$MINIO_PASS"
# Or using the MinIO client (mc)
mc alias set local http://localhost:9000 "$MINIO_USER" "$MINIO_PASS"
mc ls local/
Port-forward the Console port and access in a browser:
kubectl port-forward svc/minio-cluster-minio 9001:9001 -n demo
Then open http://localhost:9001 and log in with the root credentials.
kubectl delete cluster minio-cluster -n demo