Rate This Document
Findability
Accuracy
Completeness
Readability

Creating a Pod

Create a pod by configuring and applying the YAML file on the Kubernetes management node.

  1. Create a raw-block-pod.yaml file on the master node.
    vi raw-block-pod.yaml
  2. Press i to enter the insert mode and add the following content to the raw-block-pod.yaml file:
    --- 
    apiVersion: v1 
    kind: Pod 
    metadata: 
      name: pod-with-raw-block-volume 
    spec: 
      containers: 
      - name: fc-container 
        image: fedora:26 
        command: ["/bin/sh", "-c"] 
        args: ["tail -f /dev/null"] 
        volumeDevices: 
        - name: data 
          devicePath: /dev/xvda 
      volumes: 
      - name: data 
        persistentVolumeClaim: 
          claimName: raw-block-pvc
  3. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
  4. Use the YAML file to create a pod.
    kubectl apply -f raw-block-pod.yaml
  5. Check whether the pod is successfully created.
    kubectl get pod

    Expected result: