Skip to content

Commit 51fc013

Browse files
Madhu-1ceph-csi-bot
authored andcommitted
doc: update the qos design
The containers scope file will not be created before the NodePublish RPC call, due to that we cannot apply qos at the container level rather we need apply at the pod level. updating the design to apply the qos at the pod level. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
1 parent 467b979 commit 51fc013

1 file changed

Lines changed: 46 additions & 57 deletions

File tree

docs/design/proposals/rbd-qos.md

Lines changed: 46 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -93,60 +93,38 @@ above `kubepods-besteffort.slice` or `kubepods-burstable.slice` or
9393
`kubepods.slice` (Guaranteed QoS) cgroup. The 3 QoS classes are defined
9494
[here](https://kubernetes.io/docs/concepts/workloads/pods/pod-QoS/#quality-of-service-classes)
9595

96-
To identify the right cgroup file, we need pod UUID and container UUID from the
97-
`pod yaml` output
96+
To identify the right cgroup file, we need pod UUID from the `pod yaml` output
9897

9998
```bash
10099
[$]kubectl get po csi-rbd-demo-pod -oyaml |grep uid
101100
uid: cdf7b785-4eb7-44f7-99cc-ef53890f4dfd
102-
[$]kubectl get po csi-rbd-demo-pod -oyaml |grep -i containerID
103-
- containerID: cri-o://77e57fbbc0f0630f41f9f154f4b5fe368b6dcf7bef7dcd75a9c4b56676f10bc9
104101
[$]kubectl get po csi-rbd-demo-pod -oyaml |grep -i qosClass
105102
qosClass: BestEffort
106103
```
107104

108105
Now check in the `kubepods-besteffort.slice` and identify the right path using
109-
pod UID and container UID
106+
pod UID (hyphens replaced with underscores).
110107

111-
Before that check `io.max` on the application pod and see if there is any limit
108+
Come back to the Node and navigate to the pod's cgroup slice
112109

113110
```bash
114-
[$]kubectl exec -it csi-rbd-demo-pod -- sh
115-
sh-4.4# cat /sys/fs/cgroup/io.max
116-
sh-4.4#
117-
```
118-
119-
Come back to the Node and find the right cgroup scope
120-
121-
```bash
122-
sh-5.1# cd kubepods-besteffort.slice/kubepods-besteffort-podcdf7b785_4eb7_44f7_99cc_ef53890f4dfd.slice/crio-77e57fbbc0f0630f41f9f154f4b5fe368b6dcf7bef7dcd75a9c4b56676f10bc9.scope/
123-
124-
111+
sh-5.1# cd kubepods-besteffort.slice/kubepods-besteffort-podcdf7b785_4eb7_44f7_99cc_ef53890f4dfd.slice/
125112
sh-5.1# echo "252:0 wbps=1048576" > io.max
126113
sh-5.1# cat io.max
127114
252:0 rbps=max wbps=1048576 riops=max wiops=max
128115
```
129116

130-
Now go back to the application pod and check if we have the right limit set
131-
132-
```bash
133-
[$]kubectl exec -it csi-rbd-demo-pod -- sh
134-
sh-4.4# cat /sys/fs/cgroup/io.max
135-
252:0 rbps=max wbps=1048576 riops=max wiops=max
136-
sh-4.4#
137-
```
138-
139117
Note:- We can only support the QoS that cgroup v2 io controller supports, this
140118
means that cumulative read+write QoS limits won't be supported.
141119

142120
Below are the configurations that will be supported
143121

144122
| Parameter | Description |
145123
| --- | --- |
146-
| MaxReadIOPS | Max read IO operations per second |
147-
| MaxWriteIOPS | Max write IO operations per second |
148-
| MaxReadBytesPerSecond | Max read bytes per second |
149-
| MaxWriteBytesPerSecond | Max write bytes per second |
124+
| maxReadIops | Max read IO operations per second |
125+
| maxWriteIops | Max write IO operations per second |
126+
| maxReadBps | Max read bytes per second |
127+
| maxWriteBps | Max write bytes per second |
150128

151129
## Implementation Approach
152130

@@ -160,10 +138,10 @@ kind: VolumeAttributesClass
160138
metadata:
161139
name: silver
162140
parameters:
163-
MaxReadIOPS: ""
164-
MaxWriteIOPS: ""
165-
MaxReadBytesPerSecond: ""
166-
MaxWriteBytesPerSecond: ""
141+
maxReadIops: ""
142+
maxWriteIops: ""
143+
maxReadBps: ""
144+
maxWriteBps: ""
167145
```
168146
169147
VolumeAttributesClassName is a new parameter in the PVC object the user can
@@ -182,41 +160,52 @@ QoS at the storage level which means setting some configuration at the storage
182160
1. During NodePublishVolume operation retrieve the QoS from image metadata
183161
1. Whenever a new pod comes in apply the QoS
184162
185-
#### Container Discovery and QoS Application
163+
#### Pod-Level QoS Application
186164
187165
When kubelet invokes the NodePublishVolume RPC call, it provides the pod UUID
188-
as part of the request. Ceph-CSI will use this pod UUID to locate the correct
189-
cgroup hierarchy path, following the same approach demonstrated in the manual
190-
steps above.
166+
as part of the request. Ceph-CSI uses this pod UUID to locate the pod's cgroup
167+
hierarchy path and applies QoS limits at the pod level.
168+
169+
##### Key Design Decision: Pod-Level io.max
191170
192-
Since Ceph-CSI cannot determine which specific container within the pod the
193-
RBD volume is being mounted to, the QoS limits (io.max) must be applied to
194-
**all containers** found in the pod's cgroup directory. This ensures that the
195-
QoS limits are enforced regardless of which container is using the volume.
171+
QoS limits are applied to the pod's io.max file, not individual container
172+
io.max files. This design choice provides several benefits:
196173
197-
The container discovery process follows these steps:
174+
1. **Automatic Propagation**: cgroup v2 hierarchical design ensures pod-level
175+
limits automatically apply to all containers within the pod
176+
1. **Simplified Implementation**: Single write operation instead of discovering
177+
and updating multiple container cgroups
178+
1. **Timing Independence**: No dependency on container creation timing - works
179+
even if containers start after volume mount
180+
1. **Consistent Behavior**: Same enforcement regardless of container runtime
181+
(CRI-O, containerd, etc.)
182+
183+
The QoS application process follows these steps:
198184
199185
1. Kubelet provides pod UUID in NodePublishVolume request (via pod info in
200186
volume context)
201187
1. Ceph-CSI identifies the pod's QoS class (BestEffort, Burstable, or
202-
Guaranteed) from the cgroup hierarchy
188+
Guaranteed) by probing the cgroup hierarchy
203189
1. Navigate to the appropriate kubepods slice based on QoS class:
204190
* `kubepods-besteffort.slice` for BestEffort
205191
* `kubepods-burstable.slice` for Burstable
206192
* `kubepods.slice` for Guaranteed
207-
1. Locate the pod-specific slice using the pod UUID:
208-
`kubepods-<qos>-pod<uuid>.slice/`
209-
1. Enumerate all container scopes (e.g., `crio-<container-id>.scope/`) within
210-
the pod slice
211-
1. Apply io.max limits to each container's cgroup by writing to
212-
`<container-scope>/io.max`
213-
214-
Example path construction:
215-
`/sys/fs/cgroup/kubepods-besteffort.slice/kubepods-besteffort-podcdf7b785_4eb7_44f7_99cc_ef53890f4dfd.slice/crio-77e57fbbc0f0630f41f9f154f4b5fe368b6dcf7bef7dcd75a9c4b56676f10bc9.scope/io.max`
216-
217-
This approach ensures QoS enforcement across all containers in the pod,
218-
addressing the limitation that the specific target container is not known at
219-
NodePublishVolume time.
193+
1. Locate the pod-specific slice using the normalized pod UUID (hyphens
194+
replaced with underscores): `kubepods-<qos>-pod<normalized-uuid>.slice/`
195+
1. Apply io.max limits to the pod's cgroup by writing to `<pod-slice>/io.max`
196+
1. cgroup v2 automatically enforces these limits on all containers in the pod
197+
198+
##### Example path construction
199+
200+
For a BestEffort pod with UUID `cdf7b785-4eb7-44f7-99cc-ef53890f4dfd`:
201+
202+
```text
203+
/sys/fs/cgroup/kubepods-besteffort.slice/kubepods-besteffort-podcdf7b785_4eb7_44f7_99cc_ef53890f4dfd.slice/io.max
204+
```
205+
206+
This pod-level approach leverages cgroup v2's hierarchical design to
207+
automatically enforce QoS limits on all containers, eliminating the need for
208+
container discovery and individual container updates.
220209

221210
#### Secret Management
222211

0 commit comments

Comments
 (0)