在k8s中以deployment方式部署minio

时间:2024-04-29 07:32:25
--- # Deploys a new MinIO Pod into the metadata.namespace Kubernetes namespace # # The `spec.containers[0].args` contains the command run on the pod # The `/data` directory corresponds to the `spec.containers[0].volumeMounts[0].mountPath` # 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 # apiVersion: apps/v1 kind: Deployment metadata: name: minio namespace: devops spec: replicas: 1 selector: matchLabels: app: minio template: metadata: labels: app: minio spec: containers: - name: minio image: 192.168.10.30:9000/minio:latest command: - /bin/bash - -c args: - minio server /data --console-address :9001 env: - name: MINIO_SERVER_URL value: 'http://minio.rockstics.com' - name: MINIO_BROWSER_REDIRECT_URL value: 'http://minio.rockstics.com/minio/ui' volumeMounts: - mountPath: /data name: localvolume # Corresponds to the `spec.volumes` Persistent Volume hostAliases: - ip: "192.168.10.188" hostnames: - "minio.rockstics.com" volumes: - name: localvolume hostPath: # MinIO generally recommends using locally-attached volumes path: /data/minio # Specify a path to a local drive or volume on the Kubernetes worker node type: DirectoryOrCreate # The path to the last directory must exist nodeSelector: kubernetes.io/hostname: kubernetesw02 --- kind: Service apiVersion: v1 metadata: name: minio-server namespace: devops labels: app: minio-server spec: ports: - name: http-console protocol: TCP port: 9001 targetPort: 9001 - name: http-api protocol: TCP port: 9000 targetPort: 9000 selector: app: minio --- apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: annotations: labels: app: minio name: minio namespace: devops spec: routes: - kind: Rule match: Host(`minio.isiact.com`) services: - kind: Service name: minio-server namespace: devops port: http-api - kind: Rule match: Host(`minio.isiact.com`) && PathPrefix(`/minio/ui`) middlewares: - name: minio-console services: - kind: Service name: minio-server namespace: devops port: http-console --- apiVersion: traefik.containo.us/v1alpha1 kind: Middleware metadata: annotations: name: minio-console namespace: devops spec: stripPrefix: prefixes: - /minio/ui