๐ ๊ฐ์
ํ ์ค ์์ฝ: ๋์ ๋ณผ๋ฅจ ํ๋ก๋น์ ๋์ ์ํ ์คํ ๋ฆฌ์ง ํ
ํ๋ฆฟ ๋ฆฌ์์ค
์ธ์ ์ฌ์ฉ:
- PVC ์์ฑ ์ ์๋์ผ๋ก PV๋ฅผ ํ๋ก๋น์ ๋ํ๊ณ ์ถ์ ๋
- ์ฌ๋ฌ ์คํ ๋ฆฌ์ง ํ์
(EFS, EBS, Local Path ๋ฑ)์ ๊ตฌ๋ถํด์ ์ฌ์ฉํ ๋
- Tekton Pipeline์์ Workspace ๋ณผ๋ฅจ์ ๋์ ์ผ๋ก ์์ฑํ ๋
๊ด๋ จ ๊ธฐ์ : PersistentVolume, PersistentVolumeClaim, CSI Driver, Tekton Workspace
๐ฏ ํต์ฌ ๊ฐ๋
Static vs Dynamic Provisioning
| ํญ๋ชฉ | Static Provisioning | Dynamic Provisioning |
|---|
| PV ์์ฑ | ๊ด๋ฆฌ์๊ฐ ์๋ ์์ฑ | StorageClass๊ฐ ์๋ ์์ฑ |
| ์ฌ์ฉ ์๊ธฐ | ๋ ๊ฑฐ์, ํน์ ์คํ ๋ฆฌ์ง | ํด๋ผ์ฐ๋, ์ผ๋ฐ์ ์ฌ์ฉ |
| ์ฅ์ | ์ธ๋ฐํ ์ ์ด | ์๋ํ, ํธ๋ฆฌ |
| ๋จ์ | ์๋ ๊ด๋ฆฌ ๋ถ๋ด | StorageClass ์์กด |
1
2
3
4
5
| [Static]
๊ด๋ฆฌ์๊ฐ PV ๋ฏธ๋ฆฌ ์์ฑ โ PVC๊ฐ ๊ธฐ์กด PV๋ฅผ ์ฐพ์์ ๋ฐ์ธ๋ฉ
[Dynamic]
PVC ์์ฑ โ StorageClass๊ฐ PV ์๋ ์์ฑ ๋ฐ ๋ฐ์ธ๋ฉ
|
Provisioner
์ค์ ์คํ ๋ฆฌ์ง๋ฅผ ์์ฑํ๋ ์ฃผ์ฒด๋ก, ๊ฐ Provisioner๋ง๋ค ๊ณ ์ ํ parameters ์ค์ ์ด ํ์ํฉ๋๋ค.
| Provisioner | ์คํ ๋ฆฌ์ง ์ข
๋ฅ |
|---|
rancher.io/local-path | ๋
ธ๋ ๋ก์ปฌ ๋์คํฌ |
efs.csi.aws.com | AWS EFS (๊ณต์ ํ์ผ ์์คํ
) |
ebs.csi.aws.com | AWS EBS (๋ธ๋ก ์คํ ๋ฆฌ์ง) |
VolumeBindingMode
| ๋ชจ๋ | ๋์ | ์ฌ์ฉ ์๊ธฐ |
|---|
| Immediate | PVC ์์ฑ ์ฆ์ PV ํ๋ก๋น์ ๋ | EFS, NFS (๋
ธ๋ ์์น ๋ฌด๊ด) |
| WaitForFirstConsumer | Pod ์ค์ผ์ค๋ง ์์ ์ PV ์์ฑ | Local Path, EBS (๋
ธ๋ ์์น ์ค์) |
Reclaim Policy
| ์ ์ฑ
| ๋์ | ์ฌ์ฉ ์๊ธฐ |
|---|
| Delete | PVC ์ญ์ ์ PV์ ์ค์ ์คํ ๋ฆฌ์ง ํจ๊ป ์ญ์ | ๊ฐ๋ฐ/ํ
์คํธ |
| Retain | PVC ์ญ์ ํด๋ PV ์ ์ง, ๋ฐ์ดํฐ ๋ณด์กด | ํ๋ก๋์
|
๐ป ๊ธฐ๋ณธ ๋ช
๋ น์ด
1
2
3
4
5
6
7
8
| # StorageClass ๋ชฉ๋ก ์กฐํ
kubectl get sc
# StorageClass ์์ธ ํ์ธ
kubectl describe sc <sc-name>
# ํน์ StorageClass๋ฅผ ์ฌ์ฉํ๋ PVC ์กฐํ
kubectl get pvc -A | grep <sc-name>
|
์ถ๋ ฅ ์์:
1
2
3
| NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION
efs-sc efs.csi.aws.com Delete Immediate false
local-path(default) rancher.io/local-path Delete WaitForFirstConsumer false
|
๐ง ์์ฃผ ์ฐ๋ ํจํด
ํจํด 1: local-path (๊ธฐ๋ณธ StorageClass)
HyperCloud/Rancher ํ๊ฒฝ์ ๊ธฐ๋ณธ StorageClass์
๋๋ค.
1
2
3
4
5
6
7
8
9
| apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-path
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: rancher.io/local-path
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
|
ํน์ง:
WaitForFirstConsumer: Pod๊ฐ ์ค์ผ์ค๋ง๋ ๋
ธ๋์์ ๋ณผ๋ฅจ ์์ฑ- PVC๋ง ์์ฑํ๋ฉด
Pending ์ํ โ Pod ์์ฑ ์ PV ์๋ ์์ฑ - ๋
ธ๋ ๊ฐ ๋ฐ์ดํฐ ๊ณต์ ๋ถ๊ฐ (Local Storage)
1
2
3
4
5
6
7
| PVC ์์ฑ โ Pending
โ
Pod ์ค์ผ์ค๋ง (๋
ธ๋ ๊ฒฐ์ )
โ
ํด๋น ๋
ธ๋์ PV ์๋ ์์ฑ โ Bound
โ
Pod ๊ธฐ๋
|
ํจํด 2: efs-sc (๊ณต์ ์คํ ๋ฆฌ์ง)
์ฌ๋ฌ Pod/๋
ธ๋์์ ๋์์ ์ ๊ทผํด์ผ ํ ๋ ์ฌ์ฉํฉ๋๋ค.
1
2
3
4
5
6
7
| apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: efs-sc
provisioner: efs.csi.aws.com
reclaimPolicy: Delete
volumeBindingMode: Immediate
|
ํน์ง:
Immediate: PVC ์์ฑ ์ฆ์ PV ํ๋ก๋น์ ๋- ์ฌ๋ฌ Pod/๋
ธ๋์์ ๋์
ReadWriteMany ๊ฐ๋ฅ - Tekton Pipeline Workspace ๊ณต์ ์ ์ ํฉ
ํจํด 3: Tekton Pipeline Workspace์์ ์ฌ์ฉ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: build-pipeline-run
spec:
pipelineRef:
name: build-pipeline
workspaces:
- name: shared-workspace
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path # StorageClass ์ง์
resources:
requests:
storage: 1Gi
|
Tekton ์ฌ์ฉ ์ ์ฃผ์์ฌํญ:
volumeClaimTemplate: PipelineRun๋ง๋ค ์๋ก์ด PVC ์๋ ์์ฑlocal-path (WaitForFirstConsumer): Task Pod๊ฐ ์ค์ผ์ค๋ง๋ ํ ๋ณผ๋ฅจ ์์ฑ- Workspace ๊ฒฝ๋ก:
$(workspaces.<name>.path) โ /workspace/<name>
โ ๏ธ ์ฃผ์์ฌํญ
volumeBindingMode ํผ๋
1
2
3
4
5
| โ local-path๋ฅผ Immediate๋ก ์ค์
โ PVC ์์ฑ ์ ํน์ ๋
ธ๋ ์ ํ ๋ถ๊ฐ๋ก ์คํจ
โ
local-path๋ WaitForFirstConsumer ์ ์ง
โ Pod ์ค์ผ์ค๋ง ํ ํด๋น ๋
ธ๋์ ๋ณผ๋ฅจ ์์ฑ
|
default StorageClass ์ค๋ณต ์ค์
1
2
3
4
5
6
7
8
9
| # default StorageClass ํ์ธ
kubectl get sc
# (default) ํ์๊ฐ 2๊ฐ ์ด์์ด๋ฉด PVC ๋ฐ์ธ๋ฉ ํผ๋ ๋ฐ์
# โ ํ๋๋ง default๋ก ์ ์ง
# default ํด์
kubectl patch sc <sc-name> \
-p '{"metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
|
PVC Pending ์ํ ๋๋ฒ๊น
1
2
3
4
5
6
7
8
| # ์์ธ ํ์ธ
kubectl describe pvc <pvc-name> -n <namespace>
# ์ฃผ์ ์์ธ:
# - WaitForFirstConsumer โ Pod ์์ง ์์ฑ ์ ๋จ (์ ์)
# - ์กฐ๊ฑด ๋ง๋ PV ์์
# - StorageClass ์ด๋ฆ ์คํ
# - ๋
ธ๋ ๋์คํฌ ์ฉ๋ ๋ถ์กฑ
|
๐ ์์ฝ
1
2
3
4
5
6
7
8
9
10
11
12
| StorageClass:
- ๋์ ๋ณผ๋ฅจ ํ๋ก๋น์ ๋ ํ
ํ๋ฆฟ
- Provisioner๊ฐ ์ค์ ์คํ ๋ฆฌ์ง ์์ฑ
ํต์ฌ ํ๋:
- provisioner: ์คํ ๋ฆฌ์ง ์์ฑ ์ฃผ์ฒด
- reclaimPolicy: PVC ์ญ์ ์ PV ์ฒ๋ฆฌ ๋ฐฉ์
- volumeBindingMode: PV ์์ฑ ์์ (์ฆ์ or Pod ์ค์ผ์ค๋ง ํ)
ํ๊ฒฝ๋ณ ์ ํ:
- local-path: ๋จ์ผ ๋
ธ๋, ๋น ๋ฅธ I/O (Tekton ์ปดํ์ผ ๋ฑ)
- efs-sc: ๋ค์ค ๋
ธ๋ ๊ณต์ (ReadWriteMany ํ์ ์)
|
๐ ๊ด๋ จ ๋ฌธ์
Comments powered by Disqus.