当前位置:  首页>> 技术小册>> Kubernets合辑7-存储

  1. [root@hdss7-200 volume]# showmount -e # 待挂载nfs磁盘
  2. Export list for hdss7-200.host.com:
  3. /tmp/data/volume 10.4.7.0/24
  4. [root@hdss7-200 volume]# hostname > /tmp/data/volume/index.html
  1. [root@hdss7-200 volume]# vim /data/k8s-yaml/base_resource/volume/nfs.yaml
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: nfs-deploy
  6. namespace: app
  7. labels:
  8. tier: volume
  9. role: nfs
  10. spec:
  11. replicas: 2
  12. selector:
  13. matchLabels:
  14. tier: volume
  15. role: nfs
  16. template:
  17. metadata:
  18. labels:
  19. tier: volume
  20. role: nfs
  21. spec:
  22. containers:
  23. - name: main-container
  24. image: harbor.od.com/public/busybox:v1.31.1
  25. volumeMounts:
  26. - name: web-root
  27. mountPath: /data/web/html
  28. command:
  29. - httpd
  30. args:
  31. - -f
  32. - -h
  33. - "/data/web/html"
  34. volumes:
  35. - name: web-root
  36. nfs:
  37. server: hdss7-200
  38. path: /tmp/data/volume
  1. [root@hdss7-21 ~]# kubectl apply -f http://k8s-yaml.od.com/base_resource/volume/nfs.yaml
  2. deployment.apps/nfs-deploy created
  3. [root@hdss7-21 ~]# kubectl get pods -n app -l role=nfs -o wide
  4. NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
  5. nfs-deploy-8585f6765f-qbkzg 1/1 Running 0 25s 172.7.21.12 hdss7-21.host.com <none> <none>
  6. nfs-deploy-8585f6765f-vhmhs 1/1 Running 0 25s 172.7.22.8 hdss7-22.host.com <none> <none>
  7. [root@hdss7-21 ~]# curl -s 172.7.21.12; curl -s 172.7.22.8
  8. hdss7-200.host.com
  9. hdss7-200.host.com

该分类下的相关小册推荐: