zoukankan      html  css  js  c++  java
  • pv绑定pvc

    创建pv
    apiVersion: v1
    kind: PersistentVolume
    metadata:
    name: pv003
    labels:
    app: vnc003
    namespace: vnc-space
    spec:
    capacity:
    storage: 5Gi
    accessModes:
    - ReadWriteMany
    persistentVolumeReclaimPolicy: Retain
    hostPath:
    path: "/home/pv"

    创建pvc
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
    name: pvc003
    labels:
    app: vnc003
    namespace: vnc-space
    spec:
    # storageClassName: manual
    accessModes:
    - ReadWriteMany
    resources:
    requests:
    storage: 100Mi
    selector:
    matchLabels:
    app: vnc003



    查看绑定情况
    [root@lys-192 ~]# kubectl get pvc --show-labels
    NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE LABELS
    pvc003 Bound pv004 5Gi RWX 10m app=vnc
    pvc004 Bound pv003 5Gi RWX 5m42s app=vnc
    [root@lys-192 ~]# kubectl get pv --show-labels
    NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE LABELS
    pv003 5Gi RWX Retain Bound default/pvc004 4m19s app=vnc003
    pv004 5Gi RWX Retain Bound default/pvc003 110s app=vnc003

    创建pod使用pvc

    apiVersion: v1
    kind: Pod
    metadata:
    name: nginx
    labels:
    role: web-frontend
    namespace: vnc-space
    spec:
    containers:
    - name: web
    image: nginx
    ports:
    - name: web
    containerPort: 80
    volumeMounts:
    - name: pv001
    mountPath: "/usr/share/nginx/html"
    volumes:
    - name: pv001
    persistentVolumeClaim: ## <--这字段
    claimName: pvc003
    ————————————————
    版权声明:本文为CSDN博主「liuyunshengsir」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/liuyunshengsir/article/details/88877427

  • 相关阅读:
    TOJ1017: Tour Guide
    tzcacm去年训练的好题的AC代码及题解
    Educational Codeforces Round 40 (Rated for Div. 2)
    AtCoder Regular Contest 092
    浙南联合训练赛20180318
    [Offer收割]编程练习赛50
    牛客练习赛13
    AtCoder Regular Contest 091
    Codeforces Round #470 (rated, Div. 2, based on VK Cup 2018 Round 1)
    csa Round #73 (Div. 2 only)
  • 原文地址:https://www.cnblogs.com/lgj8/p/12449578.html
Copyright © 2011-2022 走看看