K8S 搭建 minio 1.3.1

mkdir -p /data/yaml/default/minio
cd /data/yaml/default/minio

创建 pvc

cat pvc.yaml 

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-nas-minio
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 1Gi
  storageClassName: csi-rbd-sc

kubectl apply -f pvc.yaml 

创建 Deployment

cat deployment.yaml 
apiVersion: apps/v1
kind: Deployment
metadata:
  name: minio
spec:
  selector:
    matchLabels:
      app: minio
  replicas: 1
  template:
    metadata:
      labels:
        app: minio
    spec:
      terminationGracePeriodSeconds: 60
      containers:
      - name: minio
        imagePullPolicy: IfNotPresent
        image: harbor.junengcloud.com/minio/minio:1.3.1
        args:
        - server
        - /data
        env:
        - name: MINIO_ACCESS_KEY
          value: "minio"
        - name: MINIO_SECRET_KEY
          value: "minio123"
        - name : TZ
          value: "Asia/Shanghai"
        resources:
          requests:
            cpu: 500m
            memory: 1024Mi
          limits:
            cpu: 2000m
            memory: 2048Mi
        ports:
        - containerPort: 9000
          name: tcp
        livenessProbe:
          httpGet:
            path: /minio/health/live
            port: 9000
          initialDelaySeconds: 120
          periodSeconds: 20
        readinessProbe:
          httpGet:
            path: /minio/health/ready
            port: 9000
          initialDelaySeconds: 120
          periodSeconds: 20
        volumeMounts:
        - mountPath: /data
          name: minio-data
        - mountPath: /etc/localtime
          name: time-data
        - mountPath: /etc/timezone
          name: timezone
      volumes:
      - name: minio-data
        persistentVolumeClaim:
          claimName: pvc-nas-minio
      - name: time-data 
        hostPath: 
          path: /usr/share/zoneinfo/Asia/Shanghai
      - name: timezone
        hostPath:
          path: /etc/timezone

kubectl apply -f deployment.yaml 

创建 Service

cat svc.yaml 

apiVersion: v1
kind: Service
metadata:
  labels:
    app: minio
  name: minio
spec:
  ports:
  - port: 9000
    targetPort: 9000
    name: tcp
  selector:
    app: minio

kubectl apply -f svc.yaml 

创建 Ingress

cat ingress.yaml 
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: minio
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/proxy-body-size: "50m"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "300"
spec:
  rules:
  - host: minio.klvchen.com
    http:
      paths:
      - path: /
        backend:
          serviceName: minio 
          servicePort: 9000

kubectl apply -f ingress.yaml

把域名 minio.klvchen.com 配置到 C:\Windows\System32\drivers\etc\hosts 上访问

posted @ 2021-10-19 14:53  klvchen  阅读(13)  评论(0)    收藏  举报