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

  • 相关阅读:
    串口通信理论知识
    串口通信基础
    串口中断程序步骤及代码
    Django之CRM项目Day6-公私户转换问题解决 班主任功能
    Django之CRM项目Day5-跳转页面 跟进记录 报名记录
    Django之CRM项目Day4-编辑客户 公私户 模糊查询
    Django之CRM项目Day3-客户展示及分页
    Django的ModelForm
    Django相关面试题
    Django基础自测
  • 原文地址:https://www.cnblogs.com/lgj8/p/12449578.html
Copyright © 2011-2022 走看看