MinIO est une solution de stockage objet haute performance avec un support natif pour les déploiements Kubernetes. minIO fournit une API compatible avec Amazon Web Services S3 et supporte toutes les fonctionnalités de base de S3. MinIO est publié sous la licence GNU General Public License v3.0.
MinIO est différent en ce sens qu’il a été conçu dès le départ comme un stockage objet en nuage privé/hybride. Parce que MinIO est construit spécifiquement pour servir des objets, l’architecture à un seul niveau permet toutes les fonctionnalités nécessaires. Il s’agit d’un serveur d’objets natif en nuage qui est à la fois très performant, évolutif et léger.
The persistent volume used in this test is bare host directory, Since this is just a test, no additional StorageClass is prepared.
...
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
hostPath:
path: /storage/minio
Headless Service controls the domain within which StatefulSets are created. The domain managed by this Service takes the form: (namespace).svc.cluster.local (where cluster.local is the cluster domain), and the pods in this domain take the form: (service name).$(namespace).svc.cluster.local. This is required to get a DNS resolvable URL for each of the pods created within the Statefulset.
This is the Headless service description:
---
apiVersion: v1
kind: Service
metadata:
name: minio
labels:
app: minio
spec:
clusterIP: None
ports:
- name: minio
port: 9000
- name: console
port: 9001
selector:
app: minio
Create the headless service
kubectl apply -f headless-svc.yaml
A StatefulSet provides a deterministic name and a unique identity to each pod, making it easy to deploy stateful distributed applications. To launch distributed Minio user need to pass drive locations as parameters to the minio server command. Then the user need to run the same command on all the participating pods. StatefulSets offer a perfect way to handle this requirement.
This is the StatefulSet description.
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: minio
spec:
serviceName: minio
podManagementPolicy: Parallel
updateStrategy:
type: RollingUpdate
replicas: 4
selector:
matchLabels:
app: minio
template:
metadata:
labels:
app: minio
spec:
nodeSelector:
minio_role: distributed
containers:
- name: minio
env:
- name: MINIO_SERVER_URL
value: http://minio.idocker.io
- name: MINIO_BROWSER_REDIRECT_URL
value: http://console.minio.idocker.io
- name: MINIO_ROOT_USER
value: "admin"
- name: MINIO_ROOT_PASSWORD
value: "passwd_for_admin"
image: minio/minio:RELEASE.2022-01-08T03-11-54Z
imagePullPolicy: IfNotPresent
args:
- server
- http://minio-{0...3}.minio.minio.svc.cluster.local/data
- "--console-address=:9001"
ports:
- name: api
containerPort: 9000
hostPort: 9000
protocol: TCP
- name: console
containerPort: 9001
hostPort: 9001
protocol: TCP
resources:
limits:
cpu: 2000m
memory: 2Gi
requests:
cpu: 1000m
memory: 1Gi
livenessProbe:
exec:
command: ["curl", "-f", "http://localhost:9000/minio/health/live"]
initialDelaySeconds: 3
periodSeconds: 3
timeoutSeconds: 3
readinessProbe:
exec:
command: ["curl", "-f", "http://localhost:9000/minio/health/live"]
initialDelaySeconds: 3
periodSeconds: 2
timeoutSeconds: 1
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
hostPath:
path: /storage/minio
Create the StatefulSet.
kubectl apply -f minio-dist-statefulset.yaml
Now that a MinIO StatefulSet running, user may either want to access it internally (within the cluster) or expose it as a Service onto an external (outside of the cluster, maybe public internet) IP address, depending on the use case. This can be achieved using Services.
There are many service types - default type is ClusterIP, which exposes a service to connection from inside the cluster. NodePort and LoadBalancer are two types that expose services to external traffic. At here, We will use Traefik Ingress to expose the service.
This is the service description.
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: minio-router
spec:
entryPoints:
- web
routes:
- match: Host(minio.idocker.io)
kind: Rule
services:
- name: minio
port: 9000
- match: Host(console.minio.idocker.io)
kind: Rule
services:
- name: minio
port: 9001
Create the IngressRoute
kubectl apply -f ingress-router.yaml
Access Minio
Use the following URL to access MinIO: http://console.minio.idocker.io