hpe-storage / truenas-csp

TrueNAS Container Storage Provider for HPE CSI Driver for Kubernetes
https://scod.hpedev.io
MIT License
65 stars 8 forks source link

Set different values for resource requests/limits for NFS resources #50

Open kingnarmer opened 9 months ago

kingnarmer commented 9 months ago

I'm encountering issues with NFS resources pre-allocating excessive CPU and memory in my Kubernetes cluster. For instance, I have several NFS mounts: most of NFS pods consume around 200Mi CPU and 150MiB memory, but two NFS pods are pre-allocated 1 CPU and 2GB. The default for resource/limit values are set at nfsResourceLimitsMemoryMi (2GiB) and nfsResourceLimitsCpuM (1 CPU).

How can I configure different values for NFS resource requests and limits? Currently, the same value is set for both, leading to resource over-allocation and potential CPU throttling for other workloads. Any advice would be appreciated. Thanks!

datamattsson commented 9 months ago

How to configure nfsResource request to be different from resource limits ?

Yes, the base StorageClass parameters applicable to all CSPs using the HPE CSI Driver can be found here.

What you're looking for is nfsResourceLimitsCpuM and nfsResourceLimitsMemoryMi.

kingnarmer commented 9 months ago

I'm aware of the nfsResourceLimitsMemoryMi/nfsResourceLimitsCpuM settings. My problem is that a single parameter sets the values for both requests and limits. I need to configure the requests to be significantly smaller than the limits. This adjustment is necessary to allow various pods to consume resources as needed without leading to CPU throttling for other workloads. For instance, in the case of 6 NFS mounts, the cluster pre-allocates 6 CPUs and 12GB of memory, whether the pods are actively using these resources or not.

datamattsson commented 9 months ago

Ok, I see what you're saying now and I somehow mixed this up with your other question. I'm not sure why this was left out in the implementation to be quite honest, it's clearly not complete without requests and obviously has impacts on systems with scarce resources.

I can file a JIRA with HPE because that's clearly where the change need to come from. If you're handy with golang you can add the necessary stanzas here in the meantime: https://github.com/hpe-storage/csi-driver/blob/8874fe968539c6f42c2d7fa6eccd52b584cdf0a8/pkg/flavor/kubernetes/nfs.go#L489 (or easier, remove the resource limit code and add defaults in a LimitRange that is applied on the Namespace).

kingnarmer commented 9 months ago

I can file issue on HPE github if this helps.

kingnarmer commented 9 months ago

I opened issue with HPE on github.

https://github.com/hpe-storage/csi-driver/issues/366

datamattsson commented 4 months ago

Fixed in https://github.com/hpe-storage/csi-driver/pull/397