Document Goofys Usage with Kubernetes
what
- Document how to use
goofysas a sidecar container in kubernetes
why
- Useful for certain kinds of services that simple object storage but only work with POSIX-style filesystems
example
apiVersion: v1
kind: Pod
metadata:
name: example
spec:
restartPolicy: Never
imagePullSecrets:
- name: dockercfg
volumes:
- name: s3-mount
emptyDir: {}
containers:
- name: nginx-container
image: nginx
volumeMounts:
- mountPath: /data:slave
name: s3-mount
mountPropagation: Bidirectional
- name: goofys
env:
- name: MOUNT_DIR
value: /vortex-artifacts
- name: BUCKET
value: eg-example-data
- name: REGION
value: us-west-2
- name: DIR_MODE
value: "0777"
- name: FILE_MODE
value: "0777"
image: cloudposse/goofys
imagePullPolicy: Always
resources: {}
securityContext:
privileged: true
runAsUser: 0
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /data:shared
name: s3-mount
mountPropagation: Bidirectional
Thank you for this :)
Is there maybe a specific API version I should be referencing? v1 does not seem to work for a deployment. And with apps/v1 I keep getting an error of Error: Error response from daemon: invalid volume specification: '/var/lib/kubelet/pods/19d006ba-832f-11e9-9901-be858c5f860b/volumes/kubernetes.io~empty-dir/s3-mount:/data:shared:rshared'.
Not sure - it's been a while since we looked into this. I think we might have been on kubernetes 1.8-1.10 at the time.
I know it's been years, but in case somebody sees it: @chrissound's problem can be gotten around with:
---
spec:
containers:
- name: app
resources: {}
volumeMounts:
- mountPath: /mnt/s3
mountPropagation: HostToContainer
name: s3-mount
- command:
- env
- "--unset=REGION"
- goofys
- "-f"
- $BUCKET_NAME
- /mnt/s3
image: cloudposse/goofys
imagePullPolicy: Always
name: goofys
resources: {}
securityContext:
privileged: true
runAsUser: 0
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /mnt/s3
mountPropagation: Bidirectional
name: s3-mount
volumes:
- emptyDir: {}
name: s3-mount