Create a NetworkFenceClass CR to fence and taint nodes during
non-graceful node shutdowns to prevent volume corruption.
About this task
Note: Create one or more NetworkFenceClass CRs, depending on the number of storage
clusters connected to the OpenShift® Container Platform
cluster.
Procedure
- Define a YAML file for the
NetworkFenceClass CR and save it.
For example:
apiVersion: csiaddons.openshift.io/v1alpha1
kind: NetworkFenceClass
metadata:
name: odf-networkfenceclass
spec:
provisioner: openshift-storage.rbd.csi.ceph.com
parameters:
clusterID: openshift-storage
csiaddons.openshift.io/networkfence-secret-name: rook-csi-rbd-node
csiaddons.openshift.io/networkfence-secret-namespace: openshift-storage
Where,
provisioner: Specifies the name of the storage provisioner.
parameters: specifies storage provider-specific parameters.
csiaddons.openshift.io/networkfence-secret-name: specifies the name of the
secret that is required for network fencing. Fetch it from
parameters.csi.storage.k8s.io/node-stage-secret-name field in the
ocs-storagecluster-ceph-rbd StorageClass.
csiaddons.openshift.io/networkfence-secret-namespace: specifies the namespace
in which the secret is located. Fetch it from
parameters.csi.storage.k8s.io/node-stage-secret-namespace field in the
ocs-storagecluster-ceph-rbd StorageClass.
- Verify the
csiaddonsnode object details. The
csiaddonsnode object belongs to the daemonset pod (RBD) that has the IP
address that needs to be fenced.
Command
example:
oc get csiaddonsnode -n openshift-storage