Question
Create a pod with specific volume type which only exists as long as Pod is running on that node.
Additional configuration:
Pod name: vol-test-pod
Namespace: web
Mount Point: /var/www/html
Answer
emptyDir volume is first created when a Pod is assigned to the node and lasts long until the Pod exists on that node.
You can grab the configuration from Kubernetes documentation page and adjust it as follows:
apiVersion: v1
kind: Pod
metadata:
name: vol-test-pod
namespace: web
spec:
containers:
- image: nginx
name: nginx
volumeMounts:
- mountPath: /var/www/html
name: test-vol
volumes:
- name: test-vol
emptyDir: {}
Apply and verify:
kubectl apply -f po.yaml
kubectl get po -w
kubectl describe po vol-test-pod