Creating pods
To configure a pod, do the following steps:
- Create a manifest file (pod.yaml) with pod definition referencing the persistent volume claim
(PVC). Following is an example of a pod definition for creating a nginx container using a previously
created PVC:
# cat pod.yaml apiVersion: v1 kind: Pod metadata: name: csi-scale-staticdemo-pod labels: app: nginx spec: containers: - name: web-server image: nginx volumeMounts: - name: mypvc mountPath: /usr/share/nginx/html/scale ports: - containerPort: 80 volumes: - name: mypvc persistentVolumeClaim: claimName: [pvc name] readOnly: falseNote:claimNameis the PVC name to be used by pod for persistent storage. The readOnly flag can be set to true in which case the pod will mount the PVC in the read-only mode. - Issue the following command to create the
pod:
kubectl apply -f pod.yaml