[Kubernetes] Deploy MinIO
Create MinIO Object #
1curl https://raw.githubusercontent.com/minio/docs/master/source/extra/examples/minio-dev.yaml -O 1# Deploys a new Namespace for the MinIO Pod
2apiVersion: v1
3kind: Namespace
4metadata:
5 name: minio-dev # Change this value if you want a different namespace name
6 labels:
7 name: minio-dev # Change this value to match metadata.name
8---
9# Deploys a new MinIO Pod into the metadata.namespace Kubernetes namespace
10#
11# The `spec.containers[0].args` contains the command run on the pod
12# The `/data` directory corresponds to the `spec.containers[0].volumeMounts[0].mountPath`
13# That mount path corresponds to a Kubernetes HostPath which binds `/data` to a local drive or volume on the worker node where the pod runs
14#
15apiVersion: v1
16kind: Pod
17metadata:
18 labels:
19 app: minio
20 name: minio
21 namespace: minio-dev # Change this value to match the namespace metadata.name
22spec:
23 containers:
24 - name: minio
25 image: quay.io/minio/minio:latest
26 command:
27 - /bin/bash
28 - -c
29 args:
30 - minio server /data --console-address :9001
31 volumeMounts:
32 - mountPath: /data
33 name: localvolume # Corresponds to the `spec.volumes` Persistent Volume
34 nodeSelector:
35 kubernetes.io/hostname: kubealpha.local # Specify a node label associated to the Worker Node on which you want to deploy the pod.
36 volumes:
37 - name: localvolume
38 hostPath: # MinIO generally recommends using locally-attached volumes
39 path: /mnt/disk1/data # Specify a path to a local drive or volume on the Kubernetes worker node
40 type: DirectoryOrCreate # The path to the last directory must existminio 설치 참고
- https://min.io/docs/minio/kubernetes/upstream/index.html {: .prompt-info }
Apply the MinIO Object Definition #
The following command applies the minio-dev.yaml configuration and deploys the objects to Kubernetes:
1kubectl apply -f minio-dev.yamlThe command output should resemble the following:
namespace/minio-dev created
pod/minio createdYou can verify the state of the pod by running kubectl get pods:
kubectl get pods -n minio-devThe output should resemble the following:
NAME READY STATUS RESTARTS AGE
minio 1/1 Running 0 77sYou can also use the following commands to retrieve detailed information on the pod status:
kubectl describe pod/minio -n minio-dev
kubectl logs pod/minio -n minio-devTemporarily Access the MinIO S3 API and Console #
Use the kubectl port-forward command to temporarily forward traffic from the MinIO pod to the local machine:
kubectl port-forward pod/minio 9000 9090 -n minio-devThe command forwards the pod ports 9000 and 9090 to the matching port on the local machine while active in the shell. The kubectl port-forward command only functions while active in the shell session. Terminating the session closes the ports on the local machine.
Note The following steps of this procedure assume an active kubectl port-forward command. To configure long term access to the pod, configure Ingress or similar network control components within Kubernetes to route traffic to and from the pod. Configuring Ingress is out of the scope for this documentation.
Connect your Browser to the MinIO Server #
Access the MinIO Console by opening a browser on the local machine and navigating to http://127.0.0.1:9001.
Log in to the Console with the credentials minioadmin | minioadmin. These are the default root user credentials.