AWSS3文件网关文件共享和K8s访问
创始人
2024-09-27 00:01:06
0
  1. 首先,在 Kubernetes 集群中创建一个 secret,用于存储 S3 访问密钥和密钥 ID。
apiVersion: v1
kind: Secret
metadata:
  name: s3-secret
type: Opaque
data:
  accessKeyId: BASE64_ENCODED_ACCESS_KEY_ID
  secretAccessKey: BASE64_ENCODED_SECRET_ACCESS_KEY
  1. 接下来,创建一个 Kubernetes 部署,用于运行 AWS S3 文件网关。将访问密钥和密钥 ID 从 secret 中装载到容器中。
apiVersion: apps/v1
kind: Deployment
metadata:
  name: s3-file-gateway
spec:
  replicas: 1
  selector:
    matchLabels:
      app: s3-file-gateway
  template:
    metadata:
      labels:
        app: s3-file-gateway
    spec:
      volumes:
      - name: s3-secret-volume
        secret:
          secretName: s3-secret
      containers:
      - name: s3-file-gateway
        image: amazon/aws-file-gateway:latest
        volumeMounts:
        - name: s3-secret-volume
          mountPath: /app/config/s3.yaml
          subPath: s3.yaml
        env:
        - name: S3GW_CONFIG_FILE
          value: /app/config/s3.yaml
  1. 在 Kubernetes 中创建一个 ConfigMap,用于存储 S3 文件网关的配置。
apiVersion: v1
kind: ConfigMap
metadata:
  name: s3-config
data:
  s3.yaml: |-
    version: "2012-10-17"
    gateway:
      type: "FILE"
      fileShare:
        endpoint: "smb://workgroup;username:password@file-share"
        region: "ap-northeast-1"
        accessKey: "${accessKeyId}"
        secretKey: "${secretAccessKey}"
  1. 最后,在 Kubernetes 中创建一个 pod,用于启动文件共享并访问 AWS S3。
apiVersion: v1
kind: Pod
metadata:
  name: s3-file-gateway-pod
spec:
  containers:
  - name: s3-file-gateway-container
    image: busybox
    command: ["/bin/sh"]
    args: ["-c", "mount -t cifs //s3-file-gateway:8080/file-share /mnt"]
    volumeMounts:
      - name: s3-file-gateway-volume
        mountPath: /mnt
  volumes:
    - name: s3-file-gateway-volume
      flexVolume:
        driver: "s3.file.gateway/flex-volume"
        options:
          configMapName: "s3-config"

相关内容

热门资讯

透视系统!来玩app破解版,a... 透视系统!来玩app破解版,aapoker免费透视脚本,法子教程(都是有挂)-哔哩哔哩1、aapok...
透视软件!wejoker免费脚... 透视软件!wejoker免费脚本,wpk辅助是真的吗,方针教程(本来是真的挂)-哔哩哔哩1、首先打开...
透视工具!wpk德州局怎么透视... 透视工具!wpk德州局怎么透视,智星菠萝可以辅助吗,步骤教程(切实存在有挂)-哔哩哔哩1、任何智星菠...
透视透视挂!拱趴大菠萝万能挂图... 透视透视挂!拱趴大菠萝万能挂图解,德州来玩辅助器,模块教程(都是有挂)-哔哩哔哩1、超多福利:超高返...
透视有挂!wepoker透视脚... 透视有挂!wepoker透视脚本是什么,hhpoker透视脚本下载,大纲教程(竟然真的是有挂)-哔哩...
透视实锤!大菠萝免费辅助,we... 透视实锤!大菠萝免费辅助,wepoker破解工具,步骤教程(确实存在有挂)-哔哩哔哩1、大菠萝免费辅...
透视总结!wepoker辅助器... 透视总结!wepoker辅助器安装包定制,wpk辅助最怕三个东西,妙计教程(确实是有挂)-哔哩哔哩暗...
透视免费!wepoker有没有... 透视免费!wepoker有没有挂,hhpoker辅助软件,要领教程(竟然是真的挂)-哔哩哔哩1、点击...
透视透视!hhpoker德州真... 透视透视!hhpoker德州真的假的,如何下载wepoker安装包,要领教程(确实是有挂)-哔哩哔哩...
透视有挂!wepoker透视辅... 透视有挂!wepoker透视辅助下载,佛手在线有挂吗,指引教程(其实有挂)-哔哩哔哩wepoker透...