본문 바로가기

CKA

CKA-Storage 출제비중 10%

반응형

1.  Understand storage classes, persistent volumes

- A StorageClass provides a way for administrators to describe the "classes" of storage they offer.

- The PersistentVolume subsystem provides an API for users and administrators that abstracts details of how storage is provided from how it is consumed. To do this, we introduce two new API resources: PersistentVolume and PersistentVolumeClaim.

 

PersistentVolume (PV) : Provider 에게 공급 받은 스토리지 

PersistentVolumeClaim (PVC) : 공급받은 스토리지를 제공해주는 서비스(?) 같은 개념. Pod 가 Node 의 리소스를 사용해서 Container 들에게 할당해주는것과 유사하다. PV- node, PVC-pod

 

2.  Understand volume mode, access modes and reclaim policies for volumes

 

- volume mode : Kubernetes supports two volumeModes of PersistentVolumes: Filesystem and Block

volumeMode is an optional API parameter. Filesystem is the default mode used when volumeMode parameter is omitted.

A volume with volumeMode: Filesystem is mounted into Pods into a directory.

You can set the value of volumeMode to Block to use a volume as a raw block device

This mode is useful to provide a Pod the fastest possible way to access a volume, without any filesystem layer between the Pod and the volume.

 

- access modes : A PersistentVolume can be mounted on a host in any way supported by the resource provider.

ReadWriteOnce

the volume can be mounted as read-write by a single node. ReadWriteOnce access mode still can allow multiple pods to access the volume when the pods are running on the same node.

ReadOnlyMany

the volume can be mounted as read-only by many nodes.

ReadWriteMany

the volume can be mounted as read-write by many nodes.

ReadWriteOncePod

the volume can be mounted as read-write by a single Pod. Use ReadWriteOncePod access mode if you want to ensure that only one pod across the whole cluster can read that PVC or write to it. This is only supported for CSI volumes and Kubernetes version 1.22+.

 

- reclaim policies : The reclaim policy for a PersistentVolume tells the cluster what to do with the volume after it has been released of its claim.

Retain : When the PersistentVolumeClaim is deleted, the PersistentVolume still exists and the volume is considered "released".

Delete

Recycle

 

3.  Understand persistent volume claims primitive


4.  Know how to configure applications with persistent storage

 

pv

apiVersion: v1
kind: PersistentVolume
metadata:
  name: foo-pv
spec:
  storageClassName: ""
  claimRef:
    name: foo-pvc
    namespace: foo
  ...

pvc

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: myclaim
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 8Gi

Pod 에 붙이기

apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
    - name: myfrontend
      image: nginx
      volumeMounts:
      - mountPath: "/var/www/html"
        name: mypd
  volumes:
    - name: mypd
      persistentVolumeClaim:
        claimName: myclaim

claimName 이 PVC 명과 같아야한다.

반응형

'CKA' 카테고리의 다른 글

CKA-Troubleshooting 출제비중 30%  (0) 2023.08.27
CKA-시험범위  (0) 2023.08.26