[Deprecated] Use a persistent volume claim

更新时间:
复制 MD 格式

In Container Service for Kubernetes (ACK), you can attach a persistent volume claim (PVC) to a deployment when creating it from an image. This topic shows how to attach a PVC backed by cloud storage to an image-based deployment and verify that the pod mounts the PVC correctly.

To create an application from a template and specify a PVC in the template, see Disk volume overview.

Prerequisites

Before you begin, ensure that you have:

Attach a PVC to a deployment

This procedure covers three stages:

  1. Create a deployment from an image and configure its basic settings.

  2. Select the pvc-disk PVC as a data volume in the container configuration.

  3. Verify that the pod is bound to the PVC.

Steps:

  1. Log on to the ACK console.

  2. In the left-side navigation pane of the ACK console, click Clusters.

  3. On the Clusters page, find the cluster that you want to manage and click the cluster name or click Details in the Actions column.

  4. In the left-side navigation pane of the cluster details page, choose Workloads > Deployments.

  5. On the Deployments page, click Create from Image.

  6. On the Basic Information wizard page, configure the basic settings. For more information, see Configure basic settings.

    Basic settings

  7. On the Container wizard page, select an image and configure a data volume:

    1. Under the data volume section, select the pvc-disk PVC.

    2. Click Next.

    ACK supports cloud disks, NAS file systems, and Object Storage Service (OSS) buckets as cloud storage backends. This example uses a cloud disk-backed PVC.

    For more information, see Configure the containers.

  8. On the Advanced wizard page, create a service for the test-nginx application and click Create.

  9. On the Creation Task Submitted page, click View Details to open the application details. The Basic Information page of the test-nginx application appears by default.

  10. On the Pods tab, find the pod that belongs to the application and click View Details.

  11. On the Overview page of the pod, click the Volumes tab and verify that pvc-disk appears in the volume list.

What's next

To learn more about persistent storage options in ACK, see Disk volume overview.