3.2.6.4. 永続ボリューム
以下は、Persistent Volume Claim (PVC, 永続ボリューム要求) リソースとこれを使用するデプロイメント設定を作成する例です。
プロビジョニング
# Persistent volume resource
- name: create volume claim
k8s_v1_persistent_volume_claim:
name: hello-world-db
namespace: '{{ namespace }}'
state: present
access_modes:
- ReadWriteOnce
resources_requests:
storage: 1Gi
リソースに加えて、ボリュームをデプロイメント設定の宣言に追加します。
- name: create hello-world-db deployment config
openshift_v1_deployment_config:
name: hello-world-db
---
volumes:
- name: hello-world-db
persistent_volume_claim:
claim_name: hello-world-db
test: false
triggers:
- type: ConfigChange
プロビジョニング解除
- openshift_v1_deployment_config:
name: hello-world-db
namespace: '{{ namespace }}'
state: absent
- k8s_v1_persistent_volume_claim:
name: hello-world-db
namespace: '{{ namespace }}'
state: absent