쿠버네티스를 이용해 ClusterIP로 설치하고 ingress를 이용한 Minio 접근
pv, pvc에 관해선 다루지 않았음
apiVersion: apps/v1
kind: Deployment
metadata:
name: minio
namespace: minio-test
spec:
replicas: 1
selector:
matchLabels:
app: minio
strategy:
type: Recreate
template:
metadata:
labels:
app: minio
spec:
volumes:
- name: storage
hostPath:
path: /data/minio
containers:
- name: minio
image: minio/minio:latest
args:
- server
- --console-address
- ":9001"
- "/storage"
env:
- name: MINIO_ACCESS_KEY
value: "minio"
- name: MINIO_SECRET_KEY
value: "minio123"
- name: TZ
value: Asia/Seoul
- name: LANG
value: ko_KR.utf8
ports:
- containerPort: 9000
hostPort: 9000
- containerPort: 9001
hostPort: 9001
volumeMounts:
- name: storage
mountPath: "/storage"
apiVersion: v1
kind: Service
metadata:
name: minio
namespace: minio-test
labels:
run: minio
spec:
ports:
- port: 9000
name: api
- port: 9001
name: ui
selector:
app: minio
Test용이므로 OpenSSL 프로그램을 이용하여 직접 인증서를 만들어 테스트
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt -subj "/CN=minio.localhost.com"
$ kubectl create secret tls hyunwoo-secret --key tls.key --cert tls.crt --namespace minio-test
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: minio-ingress
namespace: minio-test
spec:
tls:
- hosts:
- minio.localhost.com
secretName: hyunwoo-secret
ingressClassName: nginx
rules:
- host: "minio.localhost.com"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: minio
port:
number: 9001
127.0.0.1 minio.localhost.com
deployment.yaml에서 id: minio, pw: minio123으로 지정했음
접속 완료