• aws EKS EFS storageclass PV PVC Pod


    storageclass

    [root@localhost specs]# cat storageclass.yaml 
    kind: StorageClass
    apiVersion: storage.k8s.io/v1
    metadata:
      name: efs-sc
    provisioner: efs.csi.aws.com
    

    PV

    [root@localhost specs]# cat pv.yaml 
    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: efs-pv
    spec:
      capacity:
        storage: 5Gi
      volumeMode: Filesystem
      accessModes:
        - ReadWriteMany
      persistentVolumeReclaimPolicy: Retain
      storageClassName: efs-sc
      csi:
        driver: efs.csi.aws.com
        volumeHandle: fs-b92aae74
    

    PVC

    [root@localhost specs]# cat claim.yaml 
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: efs-claim
    spec:
      accessModes:
        - ReadWriteMany
      storageClassName: efs-sc
      resources:
        requests:
          storage: 5Gi
    

    Pod

    [root@localhost specs]# cat pod1.yaml 
    apiVersion: v1
    kind: Pod
    metadata:
      name: app1
    spec:
      containers:
      - name: app1
        image: busybox
        command: ["/bin/sh"]
        args: ["-c", "while true; do echo $(date -u) >> /data/out1.txt; sleep 5; done"]
        volumeMounts:
        - name: persistent-storage
          mountPath: /data
      volumes:
      - name: persistent-storage
        persistentVolumeClaim:
          claimName: efs-claim
    

    在有多个PV的情况下,在PV中添加labels,之后在PVC中通过matchLabels来强力绑定

    PV 中

    metadata:
      name: efs-nginx-pv
      labels:
        app: nginx
    

    PVC中

      selector:
        matchLabels:
          app: nginx
    
    本人水平有限,还在不断学习中 难免有很多错误或者遗漏,望见谅
  • 相关阅读:
    5.Longest Palindrome substring
    3. Longest Substring Without Repeating Characters
    1.Two Sum
    2.Add two Numbers
    oplog
    airflow笔记
    airflow
    grpc protobuf
    modbus
    Linux 工具,一本好书 大牛的博客
  • 原文地址:https://www.cnblogs.com/faberbeta/p/14266284.html
Copyright © 2020-2023  润新知