Minio(3/3) - 쿠버네티스 위에서 Minio 동작하기(k8s+minio, ClusterIP방식, ingress 사용)

이현우·2022년 4월 29일
0

쿠버네티스

목록 보기
9/11

쿠버네티스를 이용해 ClusterIP로 설치하고 ingress를 이용한 Minio 접근
pv, pvc에 관해선 다루지 않았음

1. 스크립트 작성

1.1 deployment.yaml

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"

1.2 service.yaml

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

1.3 ingress-controller 설치

이전 글 참조
https://velog.io/@wkfwktka/%EC%BF%A0%EB%B2%84%EB%84%A4%ED%8B%B0%EC%8A%A4-Ingress-Controller-%EC%84%A4%EC%B9%98rancher-desktop

1.4 ingress SSL 적용

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

1.4 ingress.yaml

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

host 등록

127.0.0.1 minio.localhost.com
  • 해당 내용을 host에 등록해야함
  • host 파일은 C:\Windows\System32\drivers\etc 경로에 있음
    • 해당 경로에 수정을 하기 위해선 관리자 권한이 필요
    • 해당 파일을 복사한 뒤 다른 폴더에서 편집기(vi, vs code 등)를 통해 수정하여 붙여넣기 or 덮어쓰기 식으로 사용하면 편함.

2. MiniO console 접속

https://minio.localhost.com 로 접속

2.1 사설 인증서이기 때문에 Not Secure 메세지를 확인할 수 있음

  • 위험을 감수하고 계속 이용하겠습니다. 클릭

2.2 로그인 페이지

  • deployment.yaml에서 id: minio, pw: minio123으로 지정했음

  • 접속 완료

profile
GitHub - https://github.com/jenu8628

0개의 댓글