Kubernetes integrated ceph rbd block failed to mount a fault

1 Overview

1) ceph version: nautilus version
2) kuberntes cluster environment: v1.14.2
3) integration method: directly enter the information related to the ceph rbd block in the Volumes field in the pod. The relevant yaml resource is an example from kubernetes github.

2) Phenomenon

The kubectl describe pod pod-rbd command found that the rbd block has been attached to the target node, but when the kubelet executes the mount action, it fails and outputs an error: failed to mount unformatted volume as read only .

3) Pod's yaml resource

Insert picture description here
Modify the yaml file in the kubernetes github example: modify the monitors field to the monitor instance of my ceph cluster.

4) Doubts

The rbd block in the remote ceph cluster has been attached to the target node, and the kubelet fails when performing the read-only mount action (the target rbd block does not have a file system). Why does not the rbd block file system format before the mount? This step Why was it missed? The process I imagine is: kubelet calls the rbd command to map the rbd block to the target node, executes the mkfs command to specify a file system to format the rbd block, and the last step is to mount the rbd block in read-only mode.

5) The source code for kubelet to execute the mount operation

Insert picture description here

6) Solution

Set the readOnly field in the volume to false. At this time, kubelet will fail to mount the target volume for the first time, so it tries to format the volume without a file system, and then executes the mount operation again.

Guess you like

Origin blog.csdn.net/nangonghen/article/details/107057164