2017-08-04 13:15:34 -07:00
---
2022-05-12 19:29:40 +02:00
title : Ceph Configuration
2017-08-04 13:15:34 -07:00
---
2017-04-17 15:05:12 -05:00
These examples show how to perform advanced configuration tasks on your Rook
storage cluster.
## Prerequisites
Most of the examples make use of the `ceph` client command. A quick way to use
2022-05-12 19:29:40 +02:00
the Ceph client suite is from a [Rook Toolbox container ](../../Troubleshooting/ceph-toolbox.md ).
2017-04-17 15:05:12 -05:00
2018-05-18 14:28:05 -07:00
The Kubernetes based examples assume Rook OSD pods are in the `rook-ceph` namespace.
If you run them in a different namespace, modify `kubectl -n rook-ceph [...]` to fit
2017-04-17 15:05:12 -05:00
your situation.
2020-12-09 15:50:08 -07:00
## Using alternate namespaces
If you wish to deploy the Rook Operator and/or Ceph clusters to namespaces other than the default
`rook-ceph` , the manifests are commented to allow for easy `sed` replacements. Change
`ROOK_CLUSTER_NAMESPACE` to tailor the manifests for additional Ceph clusters. You can choose
to also change `ROOK_OPERATOR_NAMESPACE` to create a new Rook Operator for each Ceph cluster (don't
forget to set `ROOK_CURRENT_NAMESPACE_ONLY` ), or you can leave it at the same value for every
Ceph cluster if you only wish to have one Operator manage all Ceph clusters.
2023-10-23 15:35:34 +02:00
If the operator namespace is different from the cluster namespace, the operator namespace must be
created before running the steps below. The cluster namespace does not need to be created first,
as it will be created by `common.yaml` in the script below.
```console
kubectl create namespace $ROOK_OPERATOR_NAMESPACE
```
2020-12-09 15:50:08 -07:00
This will help you manage namespaces more easily, but you should still make sure the resources are
configured to your liking.
2022-05-12 19:29:40 +02:00
```console
2021-09-22 10:37:07 +02:00
cd deploy/examples
2020-12-09 15:50:08 -07:00
export ROOK_OPERATOR_NAMESPACE="rook-ceph"
export ROOK_CLUSTER_NAMESPACE="rook-ceph"
sed -i.bak \
-e "s/\(.*\):.*# namespace:operator/\1: $ROOK_OPERATOR_NAMESPACE # namespace:operator/g" \
-e "s/\(.*\):.*# namespace:cluster/\1: $ROOK_CLUSTER_NAMESPACE # namespace:cluster/g" \
-e "s/\(.*serviceaccount\):.*:\(.*\) # serviceaccount:namespace:operator/\1:$ROOK_OPERATOR_NAMESPACE:\2 # serviceaccount:namespace:operator/g" \
-e "s/\(.*serviceaccount\):.*:\(.*\) # serviceaccount:namespace:cluster/\1:$ROOK_CLUSTER_NAMESPACE:\2 # serviceaccount:namespace:cluster/g" \
-e "s/\(.*\): [-_A-Za-z0-9]*\.\(.*\) # driver:namespace:cluster/\1: $ROOK_CLUSTER_NAMESPACE.\2 # driver:namespace:cluster/g" \
common.yaml operator.yaml cluster.yaml # add other files or change these as desired for your config
# You need to use ` apply` for all Ceph clusters after the first if you have only one Operator
2025-05-05 14:51:25 +03:00
kubectl apply -f crds.yaml -f common.yaml -f operator.yaml -f cluster.yaml # add other files as desired for yourconfig
2020-12-09 15:50:08 -07:00
```
2024-01-25 12:51:28 +01:00
Also see the CSI driver
[documentation ](../Ceph-CSI/ceph-csi-drivers.md#Configure-CSI-Drivers-in-non-default-namespace )
to update the csi provisioner names in the storageclass and volumesnapshotclass.
2021-04-14 15:43:33 +02:00
## Deploying a second cluster
2023-10-24 14:43:14 +02:00
If you wish to create a new CephCluster in a separate namespace, you can easily do so
by modifying the `ROOK_OPERATOR_NAMESPACE` and `SECOND_ROOK_CLUSTER_NAMESPACE` values in the
below instructions. The default configuration in `common-second-cluster.yaml` is already
set up to utilize `rook-ceph` for the operator and `rook-ceph-secondary` for the cluster.
There's no need to run the `sed` command if you prefer to use these default values.
2021-04-14 15:43:33 +02:00
2022-05-12 19:29:40 +02:00
```console
2021-09-22 10:37:07 +02:00
cd deploy/examples
2023-10-24 14:43:14 +02:00
export ROOK_OPERATOR_NAMESPACE="rook-ceph"
export SECOND_ROOK_CLUSTER_NAMESPACE="rook-ceph-secondary"
2021-04-14 15:43:33 +02:00
2023-10-24 14:43:14 +02:00
sed -i.bak \
-e "s/\(.*\):.*# namespace:operator/\1: $ROOK_OPERATOR_NAMESPACE # namespace:operator/g" \
-e "s/\(.*\):.*# namespace:cluster/\1: $SECOND_ROOK_CLUSTER_NAMESPACE # namespace:cluster/g" \
common-second-cluster.yaml
kubectl create -f common-second-cluster.yaml
2021-04-14 15:43:33 +02:00
```
This will create all the necessary RBACs as well as the new namespace. The script assumes that `common.yaml` was already created.
When you create the second CephCluster CR, use the same `NAMESPACE` and the operator will configure the second cluster.
2017-08-01 12:10:32 -07:00
## Log Collection
All Rook logs can be collected in a Kubernetes environment with the following command:
2019-10-24 10:22:08 +02:00
```console
2020-04-27 11:39:34 +08:00
for p in $(kubectl -n rook-ceph get pods -o jsonpath='{.items[*].metadata.name}')
2017-08-01 12:10:32 -07:00
do
2018-05-18 14:28:05 -07:00
for c in $(kubectl -n rook-ceph get pod ${p} -o jsonpath='{.spec.containers[*].name}')
2017-09-01 13:09:44 +02:00
do
echo "BEGIN logs from pod: ${p} ${c}"
2018-05-18 14:28:05 -07:00
kubectl -n rook-ceph logs -c ${c} ${p}
2017-09-01 13:09:44 +02:00
echo "END logs from pod: ${p} ${c}"
done
2017-08-01 12:10:32 -07:00
done
```
2019-10-24 10:22:08 +02:00
2017-08-01 12:10:32 -07:00
This gets the logs for every container in every Rook pod and then compresses them into a `.gz` archive
for easy sharing. Note that instead of `gzip` , you could instead pipe to `less` or to a single text file.
2017-04-17 15:05:12 -05:00
## OSD Information
2020-01-13 16:58:51 +01:00
Keeping track of OSDs and their underlying storage devices can be
difficult. The following scripts will clear things up quickly.
2017-04-17 15:05:12 -05:00
### Kubernetes
2019-10-24 10:22:08 +02:00
```console
2017-04-17 15:05:12 -05:00
# Get OSD Pods
2017-06-23 23:48:40 -05:00
# This uses the example/default cluster name "rook"
2017-04-17 15:05:12 -05:00
OSD_PODS=$(kubectl get pods --all-namespaces -l \
2018-05-18 14:28:05 -07:00
app=rook-ceph-osd,rook_cluster=rook-ceph -o jsonpath='{.items[*].metadata.name}')
2017-04-17 15:05:12 -05:00
# Find node and drive associations from OSD pods
for pod in $(echo ${OSD_PODS})
do
echo "Pod: ${pod}"
2018-05-18 14:28:05 -07:00
echo "Node: $(kubectl -n rook-ceph get pod ${pod} -o jsonpath='{.spec.nodeName}')"
kubectl -n rook-ceph exec ${pod} -- sh -c '\
2020-07-24 17:38:36 +09:00
for i in /var/lib/ceph/osd/ceph-*; do
2017-04-17 15:05:12 -05:00
[ -f ${i}/ready ] || continue
echo -ne "-$(basename ${i}) "
echo $(lsblk -n -o NAME,SIZE ${i}/block 2> /dev/null || \
findmnt -n -v -o SOURCE,SIZE -T ${i}) $(cat ${i}/type)
2019-10-24 10:22:08 +02:00
done | sort -V
2017-04-17 15:05:12 -05:00
echo'
done
```
2020-07-24 17:38:36 +09:00
The output should look something like this.
2017-08-07 12:13:18 -07:00
2022-05-12 19:29:40 +02:00
```console
Pod: osd-m2fz2
Node: node1.zbrbdl
-osd0 sda3 557.3G bluestore
-osd1 sdf3 110.2G bluestore
-osd2 sdd3 277.8G bluestore
-osd3 sdb3 557.3G bluestore
-osd4 sde3 464.2G bluestore
-osd5 sdc3 557.3G bluestore
2017-04-17 15:05:12 -05:00
2022-05-12 19:29:40 +02:00
Pod: osd-nxxnq
Node: node3.zbrbdl
-osd6 sda3 110.7G bluestore
-osd17 sdd3 1.8T bluestore
-osd18 sdb3 231.8G bluestore
-osd19 sdc3 231.8G bluestore
Pod: osd-tww1h
Node: node2.zbrbdl
-osd7 sdc3 464.2G bluestore
-osd8 sdj3 557.3G bluestore
-osd9 sdf3 66.7G bluestore
-osd10 sdd3 464.2G bluestore
-osd11 sdb3 147.4G bluestore
-osd12 sdi3 557.3G bluestore
-osd13 sdk3 557.3G bluestore
-osd14 sde3 66.7G bluestore
-osd15 sda3 110.2G bluestore
-osd16 sdh3 135.1G bluestore
```
2017-04-17 15:05:12 -05:00
## Separate Storage Groups
2022-05-12 19:29:40 +02:00
!!! attention
It is **deprecated to manually need to set this** , the `deviceClass` property can be used on Pool structures in `CephBlockPool` , `CephFilesystem` and `CephObjectStore` CRD objects.
2019-10-24 10:22:08 +02:00
2017-04-17 15:05:12 -05:00
By default Rook/Ceph puts all storage under one replication rule in the CRUSH
Map which provides the maximum amount of storage capacity for a cluster. If you
would like to use different storage endpoints for different purposes, you'll
have to create separate storage groups.
In the following example we will separate SSD drives from spindle-based drives,
a common practice for those looking to target certain workloads onto faster
(database) or slower (file archive) storage.
## Configuring Pools
### Placement Group Sizing
2022-05-12 19:29:40 +02:00
!!! note
Since Ceph Nautilus (v14.x), you can use the Ceph MGR `pg_autoscaler`
2022-08-24 17:25:06 +05:30
module to auto scale the PGs as needed. It is highly advisable to configure
default pg_num value on per-pool basis, If you want to enable this feature,
please refer to [Default PG and PGP
counts ](configuration.md#default-pg-and-pgp-counts ).
2019-10-24 10:22:08 +02:00
2017-04-17 15:05:12 -05:00
The general rules for deciding how many PGs your pool(s) should contain is:
2019-10-24 10:22:08 +02:00
2022-07-18 00:55:39 -07:00
* Fewer than 5 OSDs set `pg_num` to 128
* Between 5 and 10 OSDs set `pg_num` to 512
* Between 10 and 50 OSDs set `pg_num` to 1024
2017-04-17 15:05:12 -05:00
If you have more than 50 OSDs, you need to understand the tradeoffs and how to
calculate the pg_num value by yourself. For calculating pg_num yourself please
2022-07-18 00:55:39 -07:00
make use of [the pgcalc tool ](https://old.ceph.com/pgcalc/ ).
2017-04-17 15:05:12 -05:00
### Setting PG Count
Be sure to read the [placement group sizing ](#placement-group-sizing ) section
2018-07-13 14:29:57 -06:00
before changing the number of PGs.
2017-04-17 15:05:12 -05:00
2019-10-24 10:22:08 +02:00
```console
2017-04-17 15:05:12 -05:00
# Set the number of PGs in the rbd pool to 512
ceph osd pool set rbd pg_num 512
```
2022-05-12 19:29:40 +02:00
## Custom `ceph.conf` Settings
2019-10-24 10:22:08 +02:00
2024-09-20 14:04:51 -06:00
!!! info
2025-04-11 17:59:28 +02:00
The advised method for controlling Ceph configuration is to use the [`cephConfig` ](../../CRDs/Cluster/ceph-cluster-crd.md#ceph-config ) and [`cephConfigFromSecret` ](../../CRDs/Cluster/ceph-cluster-crd.md#ceph-config-from-secret )
2023-11-21 12:11:16 +01:00
in the `CephCluster` CRD.
2024-04-22 11:54:27 -06:00
<br><br>It is highly recommended that this only be used when absolutely necessary and that the `config` be
2023-11-21 12:11:16 +01:00
reset to an empty string if/when the configurations are no longer necessary. Configurations in the
config file will make the Ceph cluster less configurable from the CLI and dashboard and may make
future tuning or debugging difficult.
2017-04-17 15:05:12 -05:00
2019-09-03 16:07:30 -06:00
Setting configs via Ceph's CLI requires that at least one mon be available for the configs to be
2022-07-18 00:55:39 -07:00
set, and setting configs via dashboard requires at least one mgr to be available. Ceph also has
a number of very advanced settings that cannot be modified easily via the CLI or
dashboard. In order to set configurations before monitors are available or to set advanced
2019-09-03 16:07:30 -06:00
configuration settings, the `rook-config-override` ConfigMap exists, and the `config` field can be
set with the contents of a `ceph.conf` file. The contents will be propagated to all mon, mgr, OSD,
MDS, and RGW daemons as an `/etc/ceph/ceph.conf` file.
2017-04-17 15:05:12 -05:00
2022-05-12 19:29:40 +02:00
!!! warning
Rook performs no validation on the config, so the validity of the settings is the
user's responsibility.
2019-09-03 16:07:30 -06:00
2019-09-24 17:49:33 -06:00
If the `rook-config-override` ConfigMap is created before the cluster is started, the Ceph daemons
will automatically pick up the settings. If you add the settings to the ConfigMap after the cluster
has been initialized, each daemon will need to be restarted where you want the settings applied:
2019-09-03 16:07:30 -06:00
2019-10-24 10:22:08 +02:00
* mons: ensure all three mons are online and healthy before restarting each mon pod, one at a time.
* mgrs: the pods are stateless and can be restarted as needed, but note that this will disrupt the
2024-04-22 11:54:27 -06:00
Ceph dashboard during restart.
2019-10-24 10:22:08 +02:00
* OSDs: restart your the pods by deleting them, one at a time, and running `ceph -s`
2019-09-03 16:07:30 -06:00
between each restart to ensure the cluster goes back to "active/clean" state.
2019-10-24 10:22:08 +02:00
* RGW: the pods are stateless and can be restarted as needed.
* MDS: the pods are stateless and can be restarted as needed.
2019-09-03 16:07:30 -06:00
After the pod restart, the new settings should be in effect. Note that if the ConfigMap in the Ceph
cluster's namespace is created before the cluster is created, the daemons will pick up the settings
at first launch.
2022-03-15 11:51:31 -06:00
To automate the restart of the Ceph daemon pods, you will need to trigger an update to the pod specs.
2022-06-24 15:48:14 -06:00
The simplest way to trigger the update is to add [annotations or labels ](../../CRDs/Cluster/ceph-cluster-crd.md#annotations-and-labels )
2022-03-15 11:51:31 -06:00
to the CephCluster CR for the daemons you want to restart. The operator will then proceed with a rolling
update, similar to any other update to the cluster.
2025-04-14 15:24:35 -06:00
### Node-specific OSD settings
The OSD ceph config settings can also be customized per-node. This may be helpful for some ceph.conf settings that need to be unique per node depending on the hardware. This can be configured by creating a node-specific configmap that will be loaded for all OSDs and OSD prepare jobs on that node, instead of the default settings that are loaded from the rook-config-override configmap.
The node-specific configmaps must have the label:
```yaml
node.config.rook.io/osd
```
The configmaps must follow the naming convention:
```yaml
rook-config-override-<hostname>
```
2019-09-03 16:07:30 -06:00
### Example
2019-10-24 10:22:08 +02:00
2017-05-12 15:54:29 -07:00
In this example we will set the default pool `size` to two, and tell OSD
2017-04-17 15:05:12 -05:00
daemons not to change the weight of OSDs on startup.
2022-05-12 19:29:40 +02:00
!!! warning
Modify Ceph settings carefully. You are leaving the sandbox tested by Rook.
Changing the settings could result in unhealthy daemons or even data loss if used incorrectly.
2017-05-12 15:54:29 -07:00
When the Rook Operator creates a cluster, a placeholder ConfigMap is created that
2017-06-23 23:49:13 -05:00
will allow you to override Ceph configuration settings. When the daemon pods are started, the
2017-05-12 15:54:29 -07:00
settings specified in this ConfigMap will be merged with the default settings
2017-06-23 23:49:13 -05:00
generated by Rook.
2017-04-17 15:05:12 -05:00
2017-06-23 23:49:13 -05:00
The default override settings are blank. Cutting out the extraneous properties,
2017-05-12 15:54:29 -07:00
we would see the following defaults after creating a cluster:
2017-08-07 12:13:18 -07:00
2019-10-24 10:22:08 +02:00
```console
2021-02-18 18:24:22 +05:30
kubectl -n rook-ceph get ConfigMap rook-config-override -o yaml
```
2021-06-02 18:29:22 -06:00
```yaml
2017-05-12 15:54:29 -07:00
kind : ConfigMap
apiVersion : v1
metadata :
name : rook-config-override
2018-05-18 14:28:05 -07:00
namespace : rook-ceph
2017-05-12 15:54:29 -07:00
data :
config : ""
2017-04-17 15:05:12 -05:00
```
2019-09-03 16:07:30 -06:00
To apply your desired configuration, you will need to update this ConfigMap. The next time the
daemon pod(s) start, they will use the updated configs.
2017-05-12 15:54:29 -07:00
2019-10-24 10:22:08 +02:00
```console
2018-05-18 14:28:05 -07:00
kubectl -n rook-ceph edit configmap rook-config-override
2017-04-17 15:05:12 -05:00
```
2017-05-12 15:54:29 -07:00
Modify the settings and save. Each line you add should be indented from the `config` property as such:
2017-08-07 12:13:18 -07:00
2017-04-17 15:05:12 -05:00
```yaml
apiVersion : v1
kind : ConfigMap
metadata :
2017-05-12 15:54:29 -07:00
name : rook-config-override
2018-05-18 14:28:05 -07:00
namespace : rook-ceph
2017-04-17 15:05:12 -05:00
data :
2017-05-12 15:54:29 -07:00
config : |
2017-04-17 15:05:12 -05:00
[global]
osd crush update on start = false
2017-05-12 15:54:29 -07:00
osd pool default size = 2
2017-04-17 15:05:12 -05:00
```
2022-05-12 19:29:40 +02:00
## Custom CSI `ceph.conf` Settings
2021-12-13 18:30:19 +05:30
2022-05-12 19:29:40 +02:00
!!! warning
It is highly recommended to use the default setting that comes with
CephCSI and this can only be used when absolutely necessary.
The `ceph.conf` should be reset back to default values if/when the configurations are no
longer necessary.
2021-12-13 18:30:19 +05:30
If the `csi-ceph-conf-override` ConfigMap is created before the cluster is
started, the CephCSI pods will automatically pick up the settings. If you
add the settings to the ConfigMap after the cluster has been initialized,
you can restart the Rook operator pod and wait for Rook to recreate CSI pods
to take immediate effect.
After the CSI pods are restarted, the new settings should be in effect.
2022-05-12 19:29:40 +02:00
### Example CSI `ceph.conf` Settings
2021-12-13 18:30:19 +05:30
2023-11-17 13:38:21 +01:00
In this [Example ](https://github.com/rook/rook/tree/master/deploy/examples/csi-ceph-conf-override.yaml ) we
2021-12-13 18:30:19 +05:30
will set the `rbd_validate_pool` to `false` to skip rbd pool validation.
2022-05-12 19:29:40 +02:00
!!! warning
Modify Ceph settings carefully to avoid modifying the default
configuration.
Changing the settings could result in unexpected results if used incorrectly.
2021-12-13 18:30:19 +05:30
```console
kubectl create -f csi-ceph-conf-override.yaml
```
Restart the Rook operator pod and wait for CSI pods to be recreated.
2017-05-12 15:54:29 -07:00
## OSD CRUSH Settings
2017-04-17 15:05:12 -05:00
2019-08-05 15:06:47 -06:00
A useful view of the [CRUSH Map ](http://docs.ceph.com/docs/master/rados/operations/crush-map/ )
2017-04-17 15:05:12 -05:00
is generated with the following command:
2017-08-07 12:13:18 -07:00
2019-10-24 10:22:08 +02:00
```console
2017-04-17 15:05:12 -05:00
ceph osd tree
```
In this section we will be tweaking some of the values seen in the output.
### OSD Weight
The CRUSH weight controls the ratio of data that should be distributed to each
OSD. This also means a higher or lower amount of disk I/O operations for an OSD
with higher/lower weight, respectively.
By default OSDs get a weight relative to their storage capacity, which maximizes
overall cluster capacity by filling all drives at the same rate, even if drive
sizes vary. This should work for most use-cases, but the following situations
could warrant weight changes:
2017-08-07 12:13:18 -07:00
2019-10-24 10:22:08 +02:00
* Your cluster has some relatively slow OSDs or nodes. Lowering their weight can
2024-04-22 11:54:27 -06:00
reduce the impact of this bottleneck.
2019-10-24 10:22:08 +02:00
* You're using bluestore drives provisioned with Rook v0.3.1 or older. In this
2024-04-22 11:54:27 -06:00
case you may notice OSD weights did not get set relative to their storage
capacity. Changing the weight can fix this and maximize cluster capacity.
2017-04-17 15:05:12 -05:00
This example sets the weight of osd.0 which is 600GiB
2017-08-07 12:13:18 -07:00
2019-10-24 10:22:08 +02:00
```console
2017-04-17 15:05:12 -05:00
ceph osd crush reweight osd.0 .600
```
### OSD Primary Affinity
When pools are set with a size setting greater than one, data is replicated
between nodes and OSDs. For every chunk of data a Primary OSD is selected to be
used for reading that data to be sent to clients. You can control how likely it
is for an OSD to become a Primary using the Primary Affinity setting. This is
similar to the OSD weight setting, except it only affects reads on the storage
device, not capacity or writes.
2022-07-18 00:55:39 -07:00
In this example we will ensure that `osd.0` is only selected as Primary if all
other OSDs holding data replicas are unavailable:
2017-08-07 12:13:18 -07:00
2019-10-24 10:22:08 +02:00
```console
2017-04-17 15:05:12 -05:00
ceph osd primary-affinity osd.0 0
```
2017-10-20 22:47:09 +02:00
2018-11-29 01:36:11 -05:00
## OSD Dedicated Network
2023-08-22 13:15:08 -06:00
!!! tip
This documentation is left for historical purposes. It is still valid, but Rook offers native
support for this feature via the
[CephCluster network configuration ](../../CRDs/Cluster/ceph-cluster-crd.md#ceph-public-and-cluster-networks ).
2018-11-29 01:36:11 -05:00
It is possible to configure ceph to leverage a dedicated network for the OSDs to
2023-08-22 13:15:08 -06:00
communicate across. A useful overview is the [Ceph Networks ](http://docs.ceph.com/docs/master/rados/configuration/network-config-ref/#ceph-networks )
2018-11-29 01:36:11 -05:00
section of the Ceph documentation. If you declare a cluster network, OSDs will
2023-08-22 13:15:08 -06:00
route heartbeat, object replication, and recovery traffic over the cluster
2022-07-18 00:55:39 -07:00
network. This may improve performance compared to using a single network,
2023-08-22 13:15:08 -06:00
especially when slower network technologies are used. The tradeoff is
2022-07-18 00:55:39 -07:00
additional expense and subtle failure modes.
2018-11-29 01:36:11 -05:00
Two changes are necessary to the configuration to enable this capability:
2022-07-18 00:55:39 -07:00
### Use hostNetwork in the cluster configuration
2018-11-29 01:36:11 -05:00
2022-06-24 15:48:14 -06:00
Enable the `hostNetwork` setting in the [Ceph Cluster CRD configuration ](../../CRDs/Cluster/ceph-cluster-crd.md#samples ).
2018-11-29 01:36:11 -05:00
For example,
```yaml
network :
2020-08-21 10:12:18 +00:00
provider : host
2018-11-29 01:36:11 -05:00
```
2022-05-12 19:29:40 +02:00
!!! important
Changing this setting is not supported in a running Rook cluster. Host networking
should be configured when the cluster is first created.
2020-02-26 17:30:08 -07:00
2018-11-29 01:36:11 -05:00
### Define the subnets to use for public and private OSD networks
Edit the `rook-config-override` configmap to define the custom network
configuration:
2019-10-24 10:22:08 +02:00
```console
2018-11-29 01:36:11 -05:00
kubectl -n rook-ceph edit configmap rook-config-override
```
In the editor, add a custom configuration to instruct ceph which subnet is the
public network and which subnet is the private network. For example:
```yaml
apiVersion : v1
data :
config : |
[global]
2023-08-22 13:15:08 -06:00
public network = 10.0.7.0/24
2018-11-29 01:36:11 -05:00
cluster network = 10.0.10.0/24
public addr = ""
cluster addr = ""
```
After applying the updated rook-config-override configmap, it will be necessary
to restart the OSDs by deleting the OSD pods in order to apply the change.
Restart the OSD pods by deleting them, one at a time, and running ceph -s
between each restart to ensure the cluster goes back to "active/clean" state.
2017-10-20 22:47:09 +02:00
## Phantom OSD Removal
If you have OSDs in which are not showing any disks, you can remove those "Phantom OSDs" by following the instructions below.
2022-05-12 19:29:40 +02:00
To check for "Phantom OSDs", you can run (example output):
2019-10-24 10:22:08 +02:00
```console
2022-05-12 19:29:40 +02:00
$ ceph osd tree
ID CLASS WEIGHT TYPE NAME STATUS REWEIGHT PRI-AFF
-1 57.38062 root default
-13 7.17258 host node1.example.com
2 hdd 3.61859 osd.2 up 1.00000 1.00000
-7 0 host node2.example.com down 0 1.00000
2017-10-20 22:47:09 +02:00
```
2019-10-24 10:22:08 +02:00
2017-10-20 22:47:09 +02:00
The host `node2.example.com` in the output has no disks, so it is most likely a "Phantom OSD".
Now to remove it, use the ID in the first column of the output and replace `<ID>` with it. In the example output above the ID would be `-7` .
The commands are:
2019-10-24 10:22:08 +02:00
```console
2022-05-12 19:29:40 +02:00
ceph osd out <ID>
ceph osd crush remove osd.<ID>
ceph auth del osd.<ID>
ceph osd rm <ID>
2017-10-20 22:47:09 +02:00
```
2020-02-26 17:30:08 -07:00
To recheck that the Phantom OSD was removed, re-run the following command and check if the OSD with the ID doesn't show up anymore:
2019-10-24 10:22:08 +02:00
```console
2017-10-20 22:47:09 +02:00
ceph osd tree
```
2019-03-07 19:59:11 +01:00
2021-06-08 20:30:59 +05:30
## Auto Expansion of OSDs
2022-05-12 19:29:40 +02:00
### Prerequisites for Auto Expansion of OSDs
2021-06-08 20:30:59 +05:30
2022-06-24 15:48:14 -06:00
1) A [PVC-based cluster ](../../CRDs/Cluster/ceph-cluster-crd.md#pvc-based-cluster ) deployed in dynamic provisioning environment with a `storageClassDeviceSet` .
2021-06-08 20:30:59 +05:30
2022-05-12 19:29:40 +02:00
2) Create the Rook [Toolbox ](../../Troubleshooting/ceph-toolbox.md ).
2021-06-08 20:30:59 +05:30
2022-05-12 19:29:40 +02:00
!!! note
[Prometheus Operator ](../Monitoring/ceph-monitoring.md#prometheus-operator ) and [Prometheus ../Monitoring/ceph-monitoring.mdnitoring.md#prometheus -instances) are Prerequisites that are created by the auto-grow-storage script.
2021-06-08 20:30:59 +05:30
### To scale OSDs Vertically
2022-06-16 10:56:03 +02:00
Run the following script to auto-grow the size of OSDs on a PVC-based Rook cluster whenever the OSDs have reached the storage near-full threshold.
2022-05-12 19:29:40 +02:00
2021-06-08 20:30:59 +05:30
```console
2021-09-22 12:39:16 -06:00
tests/scripts/auto-grow-storage.sh size --max maxSize --growth-rate percent
2021-06-08 20:30:59 +05:30
```
2022-05-12 19:29:40 +02:00
`growth-rate` percentage represents the percent increase you want in the OSD capacity and maxSize represent the maximum disk size.
2021-06-08 20:30:59 +05:30
For example, if you need to increase the size of OSD by 30% and max disk size is 1Ti
2022-05-12 19:29:40 +02:00
2021-06-08 20:30:59 +05:30
```console
2021-09-22 12:39:16 -06:00
./auto-grow-storage.sh size --max 1Ti --growth-rate 30
2021-06-08 20:30:59 +05:30
```
### To scale OSDs Horizontally
2022-06-16 10:56:03 +02:00
Run the following script to auto-grow the number of OSDs on a PVC-based Rook cluster whenever the OSDs have reached the storage near-full threshold.
2022-05-12 19:29:40 +02:00
2021-06-08 20:30:59 +05:30
```console
tests/scripts/auto-grow-storage.sh count --max maxCount --count rate
```
2022-05-12 19:29:40 +02:00
Count of OSD represents the number of OSDs you need to add and maxCount represents the number of disks a storage cluster will support.
2021-06-08 20:30:59 +05:30
For example, if you need to increase the number of OSDs by 3 and maxCount is 10
2022-05-12 19:29:40 +02:00
2021-06-08 20:30:59 +05:30
```console
./auto-grow-storage.sh count --max 10 --count 3
```