Installing and using Minio
- Object storage: data, metadata, and a unique identifier, managed via REST API.
- Installing MinIO under Kubernetes.
- Example and tests with the S3 API.
- Versioning, replication, and other advanced uses.
Introduction
Some time ago, I posted an article about persistent storage under Kubernetes.
In my explanations, I mentioned the case of object storage.
This is a data management method that differs from traditional hierarchical structures.
In object storage, information is stored...in the form of distinct objects. Each of these objects is associated with data (content), metadata (descriptive information), and a unique identifier.
It is this identifier that allows you to easily retrieve the object without having to rely on a tree structure and file path.
Object storage offers great scalability thanks to a design adapted to distributed systems.
Unlike traditional access methods, object storage is managed using RESTful APIs, making it easier to integrate with web and cloud applications.
However, it is not optimized for small amounts of data, nor for high performance, nor for massive and permanent modifications of information as you might encounter in databases.
Conversely, it is particularly suitable for unstructured data and allows you to offer low-cost storage for large volumes of data.
For example, it is a possible alternative to traditional tape for externalizing backups. It adapts very well to archiving or media file storage cases.
The most well-known service is undoubtedly Amazon S3 (Simple Storage Service). This is a flagship product of the cloud giant and is at the heart of many of its offerings. It has become so successful that the associated API is now a standard for addressing various object storage solutions.
Other public cloud providers also have their equivalent offering compatible with the S3 API.
However, you do not need a public cloud subscription to benefit from an S3-compatible object storage service.
Thanks to tools like Minio, it is possible to deploy internally a distributed and scalable storage environment that can be managed through the S3 API.

Click the image to enlarge.
It is a widely used open-source software. It offers the advantage of being able to use traditional storage systems (NAS or SAN) in the backend, while providing a frontend that supports object access via the S3 API.
This is the usage we will explore here, with the creation of a bucket, which is the basic storage unit in this type of access. This will be based on a simple NFS (Network File System) export hosted on my Terramaster NAS.
This will allow me, in my lab, to have an S3 "like" service that I can use for various purposes, including backups.
Of course, I will present a deployment of Minio under Kubernetes
However, I will not follow a tutorial based on the use of helm or the installation of custom objects.
Installation
To start, I will create a dedicated namespace, based on the standard that I use, and name it prd-minio-lan.
The command is simply: kubectl create ns prd-minio-lan.

Click the image to enlarge.
The object that follows is a Secret. It will correspond to the admin credentials for accessing the Minio solution.
This combination of authentication elements will allow me to connect to the GUI provided with Minio.
I create my secret using the following command:
kubectl create secret generic secret-minio-default --from-literal="root_user=mon_user" --from-literal="root_password=mon_password" --namespace=prd-minio-lan

Click the image to enlarge.
Next, we need to create the PersistentVolume (pv). I will use Minio as an "S3 proxy", but the final storage will be on my NAS, which offers an NFS volume.
I am using the CSI NFS driver. For more information on this topic, please refer to my dedicated article.
---
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
pv.kubernetes.io/provisioned-by: nfs.csi.k8s.io
name: pv-minio-default
labels:
environment: prd
network: lan
application: minio
tier: default
type: nfs
spec:
capacity:
storage: 50Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
csi:
driver: nfs.csi.k8s.io
volumeHandle: /Volume1/BACKUPS/prd-minio-lan
volumeAttributes:
server: 192.168.10.152
share: /Volume1/BACKUPS/prd-minio-lan
I will not go into detail about the content; feel free to read this article if needed.
What is important is the final mount point NFS that I am using, which is /Volume1/BACKUPS/prd-minio-lan, hosted on my NAS (Network-attached storage) with the IP address 192.168.10.152.
(This implies that the IPs of my K8S worker nodes are allowed to access the NFS export).
I continue with the traditional PersistentVolumeClaim (pvc). The content of the file 02-pvc-minio-default.yml is as follows:
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-minio-default
namespace: prd-minio-lan
labels:
environment: prd
network: lan
application: minio
tier: default
type: nfs
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 50Gi
volumeName: pv-minio-default
storageClassName: ""
Since I am not using a StorageClass, I specify the name of the pv directly.
Now it's time for the Deployment file 03-deploy-minio-default.yaml:
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-minio-default
namespace: prd-minio-lan
labels:
environment: prd
network: lan
application: minio
tier: default
spec:
replicas: 1
selector:
matchLabels:
environment: prd
network: lan
application: minio
tier: default
template:
metadata:
labels:
environment: prd
network: lan
application: minio
tier: default
spec:
containers:
- name: minio
image: minio/minio:RELEASE.2024-09-09T16-59-28Z
command:
- /bin/bash
- -c
args:
- minio server /data --console-address :9090
env:
- name: MINIO_ROOT_USER
valueFrom:
secretKeyRef:
name: secret-minio-default
key: root_user
- name: MINIO_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: secret-minio-default
key: root_password
ports:
- containerPort: 9000
- containerPort: 9090
volumeMounts:
- name: pv-minio-default
mountPath: "/data"
volumes:
- name: pv-minio-default
persistentVolumeClaim:
claimName: pvc-minio-default
I will also not go into the details of the content; useful information on this topic can be found in my example of a Kubernetes application deployment and in the definition of the object.
However, we can spend a few minutes looking at the command and args sections.
When the pod starts, it is this combination of these two paragraphs that will be passed to Minio. This ensures that it starts with the correct parameters.
In other words, in server mode, with the data mapped to /data and the web site listening port set to 9090.
It is also within the Deployment, in the env section, that I pass my identification information associated with the secret that I created at the beginning of the installation.
Regarding the volume, I use my PVC to mount the PV into /data within the Pod that will host the Minio container using the RELEASE.2024-09-09T16-59-28Z image.
We can now move on to the Service with the file 04-svc-minio-default.yml:
---
apiVersion: v1
kind: Service
metadata:
name: svc-minio-default
namespace: prd-minio-lan
labels:
environment: prd
network: lan
application: minio
tier: default
spec:
type: ClusterIP
ports:
- name: api
port: 9000
targetPort: 9000
- name: webui
port: 9090
targetPort: 9090
selector:
environment: prd
network: lan
application: minio
tier: default
At this level, we can simply specify that the service exposes two ports:
- Port 9000: which corresponds to the S3 API
- Port 9090: which corresponds to the web GUI
We will soon reach the last object, the Ingress, which will allow me to expose Minio and its GUI outside of the cluster.
Here is the content of the file 05-ing-minio-default.yml:
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ing-minio-default
namespace: prd-minio-lan
labels:
environment: prd
network: lan
application: minio
tier: default
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
ingressClassName: traefik-lan
traefik.ingress.kubernetes.io/router.tls: "true"
#traefik.ingress.kubernetes.io/router.middlewares: "inf-traefik-lan-middelware-minio-default@kubernetescrd"
spec:
ingressClassName: traefik-lan
tls:
- hosts:
- minio.coolcorp.priv
- minioapi.coolcorp.priv
secretName: secret-certificate-minio
rules:
- host: minio.coolcorp.priv
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: svc-minio-default
port:
number: 9090
- host: minioapi.coolcorp.priv
http:
paths:
# Redirection des requêtes vers le port 9000 pour l'API
- path: /
pathType: Prefix
backend:
service:
name: svc-minio-default
port:
number: 9000
Similar to the service, I use two distinct URLs to redirect to each respective port.
The URL minio.coolcorp.priv is dedicated to accessing the web GUI and therefore redirects to port 9090.
The URL minioapi.coolcorp.priv is dedicated to the API and therefore to port 9000.
In both cases, I use the same certificate, whose content is in the Secret secret-certificate-minio.
To populate this secret, I created a private key/certificate combination using the following openssl command:
openssl req -new -nodes -sha256 -keyout minio.coolcorp.priv.key -out minio.coolcorp.priv.csr -newkey rsa:4096 -subj "/C=FR/ST=Ile-de-France/L=Paris/O=COOLCORP/OU=Infrastructure/CN=minio.coolcorp.priv" -reqexts SAN -config <(printf "[req]\ndistinguished_name = req_distinguished_name\n[req_distinguished_name]\n[SAN]\nsubjectAltName=DNS:minio.coolcorp.priv,DNS:minioapi.coolcorp.priv")

Click the image to enlarge.
This allowed me to obtain a CSR (Certificate Signing Request) that I provided to my internal Microsoft PKI (Public Key Infrastructure) to obtain a certificate. I will not go into specific details about this point. Everyone potentially has different solutions for obtaining a certificate. In the end, I obtained a certificate authorizing both DNS names defined in my Ingress.

Click the image to enlarge.
I store my private key and certificate in the secret using the following command.
kubectl create secret generic secret-certificate-minio --from-file=tls.crt=minio.coolcorp.priv.cer --from-file=tls.key=minio.coolcorp.priv.key --namespace prd-minio-lan

Click the image to enlarge.
Rather than having to apply each object individually, since all my YAML files are in the same folder, I simply run the kubectl apply -f mon_fodler command to declare all my objects at once.

Click the image to enlarge.
At this stage, we can verify that the Pod is running correctly with the following command: kubectl get pod -n prd-minio-lan

Click the image to enlarge.
After creating the necessary DNS records to redirect URLs to my Traefik instances, which act as an Ingress Controller, I can access the web GUI.
(If you would like to learn more about Traefik and Ingress Controllers, I invite you to read the following article. Also, feel free to review the description of the K8S platform that I use to better understand the role of each component).

Click the image to enlarge.
Example and tests
It is possible to authenticate to the GUI using my root account (my credentials are included in the secret generated at the beginning of the installation).
Once on the interface, I will be able to verify that the solution is working correctly. To do this, I will create a test bucket.

Click the image to enlarge.
Just as a reminder, a bucket is the basic container. It is where my first files will be stored.
Then, I go to the Policies tab to define an access policy for this bucket.

Click the image to enlarge.
A Minio policy works similarly to an S3 policy and is described in a JSON file.
I am not an expert on this topic, and a quick visit to a tool like ChatGPT is enough to create your first policy.
In my case, my pol-est policy allows read/write access to my test bucket.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::test"
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::test/*"
]
}
]
}
Next, I create a user named test that will inherit this policy.

Click the image to enlarge.
To be able to use this user, I will associate it with an access key and a secret (not a Kubernetes secret). To do this, simply go to the Service Account menu for the test user and generate this combination.
It is common in object storage to use this type of authentication.
If the key can be shared, the secret must, of course, be protected. It is even possible to set an expiration time for the entire configuration, which can be useful when you want to grant temporary access to a bucket.

Click the image to enlarge.
I now have everything I need to evaluate Minio.
I will use the mc tool, which is the official Minio client. It is available at this URL for Linux, macOS, and Windows. It is a simple binary that you should place in your system path so that you can call it from a console.
On my Windows 11 machine, I can then run the following command:
mc alias set k8sminio https://minioapi.coolcorp.priv ma_key mon_secret
This command allows me to initialize the target by specifying the URL of the Minio server (in this case, the API URL) and then the key/secret combination created previously.
The target is associated with an alias that I arbitrarily choose to call k8sminio.
I can then attempt to upload a file, using this alias and providing a test file located on my machine.
mc cp C:\temp\test-upload.txt k8sminio/test

Click the image to enlarge.
All that remains is to verify that the file is now present in the bucket via the GUI.

Click the image to enlarge.
What's interesting to observe is the format of the data on the NAS side. If we browse the NFS volume at the location of the PV, we find a "test" folder corresponding to the name of the bucket, and then a folder with the name of my file, which contains a xl.meta file.
This is a binary specific to Minio that contains my file, but in its object form with its metadata. It is impossible for me to retrieve its content.

Click the image to enlarge.
To do this, I must go through Minio again, either via the API or the GUI.
Conclusion
I now have an S3-compatible object storage service that I can use both inside and outside the K8S cluster.
Minio is a simple solution that is quick to deploy and widely used. If some people have doubts about the usefulness of such a product for associating an NFS share with an object-like access, know that this opens up many possibilities. We will see a specific use case with the Velero backup solution... but that's planned for later.
Note that if I used the mc client, it is of course possible to use specific libraries for your preferred scripting language, such as Python or PowerShell, or even to avoid using libraries to build your own API access requests. This is one of the great strengths of object storage; its REST API approach allows it to integrate much more easily into applications than other more traditional methods.
I also learned that it is not always advisable to attach Minio to an NFS share. It is more optimized to use native disk resources. For example, I could have used a VMFS volume with the vSphere CSI, but my use of Minio is primarily focused on backup, and I mainly wanted to illustrate its operation. In a production environment, my example may not be optimal, but the principle is sound.
I have only briefly touched upon Minio's capabilities. It offers much more, including, like any object storage solution, versioning, replication, and other advanced features.
Feel free to form your own opinion about the application and get the most out of it for your needs.