K8s pod with a writable /tmp volume
Table of Contents
Setup
Basically you need
Example YAML Here’s an example of a pod with a writable /tmp volume using emptyDir:
apiVersion: v1
kind: Pod
metadata:
name: writable-tmp-pod
spec:
containers:
- name: my-container
image: busybox
command: ["sleep", "3600"]
volumeMounts:
- name: temp-volume
mountPath: /tmp
readOnly: false # Ensure this is false or omitted
volumes:
- name: temp-volume
emptyDir: {}
Debugging Steps
Describe the Pod: Use kubectl describe pod
Check Logs: Look at the container logs for any errors related to filesystem access.
Exec into the Pod: Use kubectl exec -it <pod-name> -- /bin/sh to inspect the /tmp directory and its permissions.
References
- Volumes - official K8s docs
- configure-volume-storage
- 5-types-of-kubernetes-volumes