28.4. 在 Pod 中作为卷声明
pod 将 PersistentVolumeClaim
用作卷。OpenShift Container Platform 在与 pod 相同的命名空间中找到给定名称的声明,然后使用该声明查找要挂载的对应卷。
具有声明的 Pod 定义
apiVersion: "v1" kind: "Pod" metadata: name: "mypod" labels: name: "frontendhttp" spec: containers: - name: "myfrontend" image: openshift/hello-openshift ports: - containerPort: 80 name: "http-server" volumeMounts: - mountPath: "/var/www/html" name: "pvol" volumes: - name: "pvol" persistentVolumeClaim: claimName: "claim1"