Mirantis Container Cloud (MCC) becomes part of Mirantis OpenStack for Kubernetes (MOSK)!
Starting with MOSK 25.2, the MOSK documentation set covers all product layers, including MOSK management (formerly Container Cloud). This means everything you need is in one place. Some legacy names may remain in the code and documentation and will be updated in future releases. The separate Container Cloud documentation site will be retired, so please update your bookmarks for continued easy access to the latest content.
Ceph disaster recovery¶
Warning
This procedure is valid for MOSK clusters that use the MiraCeph custom
resource (CR), which is available since MOSK 25.2 to replace the deprecated
KaaSCephCluster. For the equivalent procedure with the KaaSCephCluster
CR, refer to the following section:
This section describes how to recover a failed or accidentally removed Ceph cluster in the following cases:
If Ceph Controller underlying a running Rook Ceph cluster has failed and you want to install a new Ceph Controller Helm release and recover the failed Ceph cluster onto the new Ceph Controller.
To migrate the data of an existing Ceph cluster to a new deployment in case downtime can be tolerated.
Consider the common state of a failed or removed Ceph cluster:
The
rook-cephnamespace does not contain pods or they are in theTerminatingstate.The
rook-cephor/andceph-lcm-mirantisnamespaces are in theTerminatingstate.The
ceph-operatoris in theFAILEDstate:Management cluster: the state of the
ceph-operatorHelm release in the management HelmBundle, such asdefault/kaas-mgmt, has switched fromDEPLOYEDtoFAILED.MOSK cluster: the state of the
osh-system/ceph-operatorHelmBundle, or a related namespace, has switched fromDEPLOYEDtoFAILED.
The Rook
CephCluster,CephBlockPool,CephObjectStoreCRs in therook-cephnamespace cannot be found or have thedeletionTimestampparameter in themetadatasection.
Note
Prior to recovering the Ceph cluster, verify that your deployment meets the following prerequisites:
The Ceph cluster
fsidexists.The Ceph cluster Monitor keyrings exist.
The Ceph cluster devices exist and include the data previously handled by Ceph OSDs.
Ceph cluster recovery workflow¶
Create a backup of the remaining data and resources.
Clean up the failed or removed
ceph-operatorHelm release.Deploy a new
ceph-operatorHelm release with the previously usedMiraCephand one Ceph Monitor.Replace the
ceph-mondata with the old cluster data.Replace
fsidinsecrets/rook-ceph-monwith the old one.Fix the Monitor map in the
ceph-mondatabase.Fix the Ceph Monitor authentication key and disable authentication.
Start the restored cluster and inspect the recovery.
Fix the admin authentication key and enable authentication.
Restart the cluster.
Recover a failed or removed Ceph cluster¶
Back up the remaining resources. Skip the commands for the resources that have already been removed:
kubectl -n rook-ceph get cephcluster <clusterName> -o yaml > backup/cephcluster.yaml # perform this for each cephblockpool kubectl -n rook-ceph get cephblockpool <cephBlockPool-i> -o yaml > backup/<cephBlockPool-i>.yaml # perform this for each client kubectl -n rook-ceph get cephclient <cephclient-i> -o yaml > backup/<cephclient-i>.yaml kubectl -n rook-ceph get cephobjectstore <cephObjectStoreName> -o yaml > backup/<cephObjectStoreName>.yaml # perform this for each secret kubectl -n rook-ceph get secret <secret-i> -o yaml > backup/<secret-i>.yaml # perform this for each configMap kubectl -n rook-ceph get cm <cm-i> -o yaml > backup/<cm-i>.yaml
SSH to each node where the Ceph Monitors or Ceph OSDs were placed before the failure and back up the valuable data:
mv /var/lib/rook /var/lib/rook.backup mv /etc/ceph /etc/ceph.backup mv /etc/rook /etc/rook.backup
Once done, close the SSH connection.
Clean up the previous installation of
ceph-operator. For details, see Rook documentation: Cleaning up a cluster.Delete the
ceph-lcm-mirantis/ceph-controllerdeployment:kubectl -n ceph-lcm-mirantis delete deployment ceph-controller
Delete all deployments, DaemonSets, and jobs from the
rook-cephnamespace, if any:kubectl -n rook-ceph delete deployment --all kubectl -n rook-ceph delete daemonset --all kubectl -n rook-ceph delete job --all
Edit the
MiraCephandMiraCephHealthCRs of theceph-lcm-mirantisnamespace and remove thefinalizerparameter from themetadatasection:kubectl -n ceph-lcm-mirantis edit miraceph kubectl -n ceph-lcm-mirantis edit miracephhealth
Edit the
CephCluster,CephBlockPool,CephClient, andCephObjectStoreCRs of therook-cephnamespace and remove thefinalizerparameter from themetadatasection:kubectl -n rook-ceph edit cephclusters kubectl -n rook-ceph edit cephblockpools kubectl -n rook-ceph edit cephclients kubectl -n rook-ceph edit cephobjectstores kubectl -n rook-ceph edit cephobjectusers
Once you clean up every single resource related to the Ceph release, open the
ClusterCR for editing:kubectl -n <projectName> edit cluster <clusterName>
Substitute
<projectName>withdefaultfor the management cluster or with a related project name for the MOSK cluster.Remove the
ceph-controllerHelm release item from thespec.providerSpec.value.helmReleasesarray and save theClusterCR:- name: ceph-controller values: {}
Verify that
ceph-controllerhas disappeared from the corresponding HelmBundle:kubectl -n <projectName> get helmbundle -o yaml
Create the
MiraCephCR template and edit the roles of nodes. The entirenodesspec must contain only onemonrole. Save theMiraCephtemplate after editing:apiVersion: lcm.mirantis.com/v1alpha1 kind: MiraCeph metadata: name: rook-ceph namespace: ceph-lcm-mirantis spec: nodes: - name: <nodeName> roles: - mon
Substitute
<nodeName>with node name of the node where monitor is placed.Open the
ClusterCR for editing:kubectl -n <projectName> edit cluster <clusterName>
Substitute
<projectName>withdefaultfor the management cluster or with a related project name for the MOSK cluster.Add
ceph-controllertospec.providerSpec.value.helmReleasesto restore theceph-controllerHelm release. SaveClusterafter editing.- name: ceph-controller values: {}
Verify that the
ceph-controllerHelm release is deployed:Inspect the Rook Operator logs and wait until the orchestration has settled:
kubectl -n rook-ceph logs -l app=rook-ceph-operator
Verify that the pods in the
rook-cephnamespace haverook-ceph-mon-a,rook-ceph-mgr-a, and all the auxiliary pods are up and running, and norook-ceph-osd-ID-xxxxxxare running:kubectl -n rook-ceph get pod
Verify the Ceph state. The output must indicate that one
monand onemgrare running, all Ceph OSDs are down, and all PGs are in theUnknownstate.kubectl -n rook-ceph exec -it deploy/rook-ceph-tools -- ceph -s
Note
Rook should not start any Ceph OSD daemon because all devices belong to the old cluster that has a different
fsid. To verify the Ceph OSD daemons, inspect theosd-preparepods logs:kubectl -n rook-ceph logs -l app=rook-ceph-osd-prepare
Connect to the terminal of the
rook-ceph-mon-apod:kubectl -n rook-ceph exec -it deploy/rook-ceph-mon-a -- bash
Output the
keyringfile and save it for further usage:cat /etc/ceph/keyring-store/keyring exit
Obtain and save the
nodeNameofmon-afor further usage:kubectl -n rook-ceph get pod $(kubectl -n rook-ceph get pod \ -l app=rook-ceph-mon -o jsonpath='{.items[0].metadata.name}') -o jsonpath='{.spec.nodeName}'
Obtain and save the
cephImageused in the Ceph cluster for further usage:kubectl -n ceph-lcm-mirantis get cm ccsettings -o jsonpath='{.data.cephImage}'
Stop Rook Operator and scale the deployment replicas to
0:kubectl -n rook-ceph scale deploy rook-ceph-operator --replicas 0
Remove the Rook deployments generated with Rook Operator:
kubectl -n rook-ceph delete deploy -l app=rook-ceph-mon kubectl -n rook-ceph delete deploy -l app=rook-ceph-mgr kubectl -n rook-ceph delete deploy -l app=rook-ceph-osd kubectl -n rook-ceph delete deploy -l app=rook-ceph-crashcollector
Using the saved
nodeName, SSH to the host whererook-ceph-mon-ain the new Kubernetes cluster is placed and perform the following steps:Remove
/var/lib/rook/mon-aor copy it to another folder:mv /var/lib/rook/mon-a /var/lib/rook/mon-a.new
Pick a healthy
rook-ceph-mon-IDdirectory (/var/lib/rook.backup/mon-ID) in the previous backup, copy to/var/lib/rook/mon-a:cp -rp /var/lib/rook.backup/mon-<ID> /var/lib/rook/mon-a
Substitute
IDwith any healthymonnode ID of the old cluster.Replace
/var/lib/rook/mon-a/keyringwith the previously saved keyring, preserving only the[mon.]section. Remove the[client.admin]section.Run the
cephImageDocker container using the previously savedcephImageimage:docker run -it --rm -v /var/lib/rook:/var/lib/rook <cephImage> bash
Inside the container, create
/etc/ceph/ceph.conffor a stable operation ofceph-mon:touch /etc/ceph/ceph.confChange the directory to
/var/lib/rookand editmonmapby replacing the existingmonhosts with the newmon-aendpoints:cd /var/lib/rook rm /var/lib/rook/mon-a/data/store.db/LOCK # Make sure the quorum lock file does not exist ceph-mon --extract-monmap monmap --mon-data ./mon-a/data # Extract monmap from old ceph-mon db and save as monmap monmaptool --print monmap # Print the monmap content, which reflects the old cluster ceph-mon configuration. monmaptool --rm a monmap # Delete `a` from monmap. monmaptool --rm b monmap # Repeat and delete `b` from monmap. monmaptool --rm c monmap # Repeat this pattern until all the old ceph-mons are removed and monmap is empty monmaptool --addv a [v2:<nodeIP>:3300,v1:<nodeIP>:6789] monmap # Replace it with the rook-ceph-mon-a address you obtained from the previous command. ceph-mon --inject-monmap monmap --mon-data ./mon-a/data # Replace monmap in ceph-mon db with our modified version. rm monmap exit
Substitute
<nodeIP>with the IP address of the current<nodeName>node.Close the SSH connection.
Change
fsidto the original one to run Rook as an old cluster:kubectl -n rook-ceph edit secret/rook-ceph-mon
Note
The
fsidisbase64encoded and must not contain a trailing carriage return. For example:echo -n a811f99a-d865-46b7-8f2c-f94c064e4356 | base64 # Replace with the fsid from the old cluster.
Scale the
ceph-lcm-mirantis/ceph-controllerdeployment replicas to0:kubectl -n ceph-lcm-mirantis scale deployment ceph-controller --replicas 0
Disable authentication:
Open the
cm/rook-config-overrideConfigMap for editing:kubectl -n rook-ceph edit cm/rook-config-override
Add the following content:
data: config: | [global] ... auth cluster required = none auth service required = none auth client required = none auth supported = none
Start Rook Operator by scaling its deployment replicas to
1:kubectl -n rook-ceph scale deploy rook-ceph-operator --replicas 1
Inspect the Rook Operator logs and wait until the orchestration has settled:
kubectl -n rook-ceph logs -l app=rook-ceph-operator
Verify that the pods in the
rook-cephnamespace have therook-ceph-mon-a,rook-ceph-mgr-a, and all the auxiliary pods are up and running, and allrook-ceph-osd-ID-xxxxxxgreater than zero are running:kubectl -n rook-ceph get pod
Verify the Ceph state. The output must indicate that one
mon, onemgr, and all Ceph OSDs must be up and running and all PGs are either in theActiveorDegradedstate:kubectl -n rook-ceph exec -it deploy/rook-ceph-tools -- ceph -s
Enter the
ceph-toolspod and import the authentication key:kubectl -n rook-ceph exec -it deploy/rook-ceph-tools -- bash vi key [paste keyring content saved before, preserving only `[client admin]` section] ceph auth import -i key rm key exit
Stop Rook Operator by scaling the deployment to
0replicas:kubectl -n rook-ceph scale deploy rook-ceph-operator --replicas 0
Re-enable authentication:
Open the
cm/rook-config-overrideConfigMap for editing:kubectl -n rook-ceph edit cm/rook-config-override
Remove the following content:
data: config: | [global] ... auth cluster required = none auth service required = none auth client required = none auth supported = none
Remove all Rook deployments generated with Rook Operator:
kubectl -n rook-ceph delete deploy -l app=rook-ceph-mon kubectl -n rook-ceph delete deploy -l app=rook-ceph-mgr kubectl -n rook-ceph delete deploy -l app=rook-ceph-osd kubectl -n rook-ceph delete deploy -l app=rook-ceph-crashcollector
Start Ceph Controller by scaling its deployment replicas to
1:kubectl -n ceph-lcm-mirantis scale deployment ceph-controller --replicas 1
Start Rook Operator by scaling its deployment replicas to
1:kubectl -n rook-ceph scale deploy rook-ceph-operator --replicas 1
Inspect the Rook Operator logs and wait until the orchestration has settled:
kubectl -n rook-ceph logs -l app=rook-ceph-operator
Verify that the pods in the
rook-cephnamespace have therook-ceph-mon-a,rook-ceph-mgr-a, and all the auxiliary pods are up and running, and allrook-ceph-osd-ID-xxxxxxgreater than zero are running:kubectl -n rook-ceph get pod
Verify the Ceph state. The output must indicate that one
mon, onemgr, and all Ceph OSDs must be up and running and the overall stored data size equals to the old cluster data size.kubectl -n rook-ceph exec -it deploy/rook-ceph-tools -- ceph -s
Edit the
MiraCephCR and add two moremonandmgrroles to the corresponding nodes:kubectl -n ceph-lcm-mirantis edit miraceph
Inspect the Rook namespace and wait until all Ceph Monitors are in the
Runningstate:kubectl -n rook-ceph get pod -l app=rook-ceph-mon
Verify the Ceph state. The output must indicate that three
mon(three in quorum), onemgr, and all Ceph OSDs must be up and running and the overall stored data size equals to the old cluster data size.kubectl -n rook-ceph exec -it deploy/rook-ceph-tools -- ceph -s
Once done, the data from the failed or removed Ceph cluster is restored and ready to use.