MinIO is a high-performance, S3-compatible object storage solution that runs seamlessly in Kubernetes. Itโs a great alternative to AWS S3 for self-hosted environments and is ideal for cloud-native applications. In this guide, weโll set up MinIO in a Kubernetes cluster, ensuring high availability and persistence.
๐ Prerequisites
Before proceeding, ensure you have the following:
- A running Kubernetes cluster (K3s, MicroK8s, or any standard K8s distribution).
- kubectl configured to interact with the cluster.
- Helm installed (for easy deployment).
- A Persistent Storage solution (like NFS, Longhorn, or local PersistentVolumes).
๐ ๏ธ Step 1: Create a Namespace for MinIO
First, weโll create a dedicated namespace for MinIO to keep things organized:
1 | kubectl create namespace minio |
โ๏ธ Step 2: Deploy MinIO Using Helm
Weโll use Helm to deploy MinIO in a simple, scalable, and manageable way.
๐น Add the MinIO Helm Repository
1 | helm repo add minio https://charts.min.io/ |
๐น Install MinIO
1 | helm install minio minio/minio \ |
๐น This command does the following:
- Installs MinIO in the minio namespace.
- Sets access credentials (you can change these).
- Enables persistent storage with a 10Gi volume.
๐ Step 3: Verify MinIO Deployment
Check if MinIO is running:
1 | kubectl get pods -n minio |
You should see something like this:
1 | NAME READY STATUS RESTARTS AGE |
To check logs:
1 | kubectl logs -n minio -l app=minio |
๐ Step 4: Expose MinIO
๐น Using a LoadBalancer (if available)
1 | kubectl expose deployment minio --type=LoadBalancer --port=9000 -n minio |
๐น Using Ingress (Recommended for Production)
If youโre using an Ingress Controller like Traefik or Nginx, create an Ingress resource to access MinIO via a domain:
1 | apiVersion: networking.k8s.io/v1 |
Then apply it:
1 | kubectl apply -f minio-ingress.yaml |
Make sure your DNS (GoDaddy, Cloudflare, etc.) points minio.yourdomain.com
to your clusterโs external IP.
๐ Step 5: Access MinIO Web UI
Once MinIO is exposed, access it via:
๐ http://minio.yourdomain.com
Use the credentials you set (admin
/ supersecret
).
๐ฏ Step 6: Configure a MinIO Bucket
To create a bucket via kubectl:
1 | kubectl exec -n minio -it $(kubectl get pods -n minio -l app=minio -o jsonpath="{.items[0].metadata.name}") -- mc alias set local http://minio:9000 admin supersecret |
Now you have a bucket named mybucket ready to use.
๐ Conclusion
Youโve successfully deployed MinIO in Kubernetes! ๐
โ
MinIO is running on your cluster
โ
Itโs accessible via Ingress (or LoadBalancer)
โ
You can store and retrieve objects using the MinIO API
Now you can integrate MinIO with your apps, use it for backups, or replace AWS S3 in your workflows.
๐ฅ Next Steps:
- Secure MinIO using TLS with cert-manager.
- Set up MinIO in Distributed Mode for High Availability.
- Integrate MinIO with external services like PostgreSQL, Redis, and more.
Happy coding! ๐๐ก