[k82] storage of hostPath

 

[4.3]

## hostPath

ssh cce01-node1-IP
mkdir /testdir
exit

vim hostPath-pod.yaml

apiVersion: v1
kind: Pod
metadata:
  name: hppod
spec:
  containers:
  - image: ubuntu
    name: hp-container
    volumeMounts:
    - mountPath: /hp-dir
      name: hp-volume
    args:
    - /bin/sh
    - -c
    - sleep 30000
  volumes:
  - name: hp-volume
    hostPath:
      path: /testdir
      type: Directory


kubectl apply -f hostPath-pod.yaml
kubectl get pod
kubectl exec -it hppod /bin/sh
cd /hp-dir
cat >hello2 <<EOF
hello
again
EOF

exit


ssh cce01-node1-IP
cd /testdir && ls
cat hello2
exit

kubectl delete pod hppod

ssh cce01-node1- IP
cat /testdir/hello2
exit

 

posted on 2025-04-12 10:21  天涯人  阅读(3)  评论(0)    收藏  举报

导航