微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

pv

apiVersion: v1
kind: PersistentVolume
Metadata:
  name: pv-volume-10m
  labels:
    type: local
spec:
  storageClassName: my-nfs-storage
  capacity:
    storage: 10m
  accessModes:
    - ReadWriteOnce 
  nfs:  ## 使用nfs存储系统
    server: 10.170.11.8  ## 没type
    path: /nfs/data/haha  ### abc文件夹提前创建
apiVersion: v1
kind: Pod
Metadata:
  name: "Nginx-pvc-000"
  namespace: default
  labels:
    app: "Nginx-pvc-000"
spec:
  containers:
  - name: Nginx-pvc-000
    image: "Nginx"
    ports:
    - containerPort:  80
      name:  http
    volumeMounts:
    - name: localtime
      mountPath: /etc/localtime
    - name: html
      mountPath: /usr/share/Nginx/html
  volumes:
    - name: localtime
      hostPath:
        path: /usr/share/zoneinfo/Asia/Shanghai
    - name: html
      persistentVolumeClaim:
         claimName:  Nginx-pvc  ### 你的申请书的名字
  restartPolicy: Always
---
apiVersion: v1
kind: PersistentVolumeClaim
Metadata:
  name: Nginx-pvc
  namespace: default
  labels:
    app: Nginx-pvc
spec:
  storageClassName: my-nfs-storage  ## 存储类的名字
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 70m
# ---
# apiVersion: v1
# kind: Service
# Metadata:
#   name: MYAPP
#   namespace: default
# spec:
#   selector:
#     app: MYAPP
#   type: ClusterIP
#   ports:
#   - name: MYAPP
#     port: 
#     targetPort: 
#     protocol: TCP
#     nodePort: 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐