apiVersion: v1
kind: Secret
metadata:
name: s3-secret
type: Opaque
data:
accessKeyId: BASE64_ENCODED_ACCESS_KEY_ID
secretAccessKey: BASE64_ENCODED_SECRET_ACCESS_KEY
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
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}"
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"
上一篇:AWSS3文件所有权显示