AP
Size: a a a
AP
AP
VR
VR
W
k
apiVersion: v1
kind: Pod
metadata:
name: test-pd
spec:
securityContext:
runAsUser: 1000
runAsGroup: 3000
fsGroup: 3000
containers:
- image: busybox
command: [ "sh", "-c", "sleep 1h" ]
name: test-container
volumeMounts:
- mountPath: /tmp/test-pd
name: test-volume
volumes:
- name: test-volume
hostPath:
path: /tmp/test-pd
type: DirectoryOrCreate
/ $ ls -lah /tmp/test-pd/
total 4K
drwxr-xr-x 2 root root 40 Nov 6 12:14 .
drwxrwxrwt 1 root root 4.0K Nov 6 12:18 ..
/ $ touch /tmp/test-pd/test
touch: /tmp/test-pd/test: Permission denied
/ $
apiVersion: v1
kind: Pod
metadata:
name: test-pd
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
containers:
- image: busybox
command: [ "sh", "-c", "sleep 1h" ]
name: test-container
volumeMounts:
- mountPath: /tmp/test-pd
name: test-volume
volumes:
- name: test-volume
persistentVolumeClaim:
claimName: test-pvc
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: test-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Mi
volumeName: test-pv
---
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
name: test-pv
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 1Mi
local:
fsType: ext4
path: /tmp/test-pd
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- m1c6
persistentVolumeReclaimPolicy: Delete
/ $ ls -lah /tmp/test-pd/
total 4K
drwxrwsr-x 2 root 1000 40 Nov 6 12:14 .
drwxrwxrwt 1 root root 4.0K Nov 6 12:29 ..
/ $ touch /tmp/test-pd/test
/ $
DG
k
DG
DG
K
EI
OS
MS
MS
MS
K
MS
RT
EI