28.3.6. 创建 Pod
pod 定义文件或模板文件可用于定义 pod。以下是创建单个容器并挂载 Ceph RBD 卷的 pod 规格,以便进行读写访问:
例 28.8. Pod 对象定义
apiVersion: v1 kind: Pod metadata: name: ceph-pod1 1 spec: containers: - name: ceph-busybox image: busybox 2 command: ["sleep", "60000"] volumeMounts: - name: ceph-vol1 3 mountPath: /usr/share/busybox 4 readOnly: false volumes: - name: ceph-vol1 5 persistentVolumeClaim: claimName: ceph-claim 6
将 pod 定义保存到文件中,如 ceph-pod1.yaml 并创建 pod:
# oc create -f ceph-pod1.yaml
pod "ceph-pod1" created
#verify pod was created
# oc get pod
NAME READY STATUS RESTARTS AGE
ceph-pod1 1/1 Running 0 2m
1
- 1
- 一两分钟,pod 将处于 Running 状态。