-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to scale down a clustered samba server instance? #318
Comments
You may remember that you had to enable this experimental feature, it's experimental precisely because of items like this. To try and summarize the main issue - kubernetes pods are dynamic and easy to create and destroy, however Samba's CTDB is more oriented towards managing actual physical nodes. The CTDB configuration is not very flexible and expects to retain references to nodes that have been removed in the config file by we try to generate the config file based on what pods are present. Therefore it was simply not implemmented (yet) due to the complexity. The minimum quantity question is related but not fully overlapping. There was a desire to not force the operator to prematurely shrink a working cluster. Additionally, we have the ability to host multiple shares on one "instance" (one smbd or a cluster of smbds). It permits the system to host a share with a minimum of 2 pods on a cluster with 3 (or more) actual pods for instance. |
Thanks for the reply. It seems that scaling down involve considerations related to CTDB configuration. To the best of my knowledge, CTDB uses config file(/etc/ctdb/nodes) to maintain the relationship between IPs and PNNs (node number). When removing a node, one should follow the procedure to remove nodes in CTDB to keep the correct line numbers. Specifically, the config file still stores the information about removed nodes(by commenting out the lines). I agree that ensuring the consistency of CTDB configurations while operators scale up or down pods is a complex issue. |
That's exactly the issue. I don't think it's insurmountable but what I think would be better would be to work with the Samba team to support alternative means of configuration that work better with k8s or other orchestration frameworks. This is a long term thing IMO. Please continue to try out the samba-operator but be aware that the CTDB mode will have more sharp edges - bug reports and assistance there are very welcome - but I've been pulled in other directions for now and don't have time for large projects improving the operator at the moment. |
Okay. Still thanks for the advice. I think I can try investigating this issue and see if I can do something. |
Hi, recently I have more time to study this issue. To scale down the replica of a clustered samba instance, I think there are several steps to do:
For implementation, My initial idea is using preStop hook in k8s to deal with this. By adding the hook, one can perform CTDB configuration when a pod is terminated by k8s api server. The modification should also include sambacc, which provides a method to update state file and node file in the shared storage, then reload ctdb. For example, the modified Samba server pod in StatefulSet would be like:
So this is my current rough idea, not sure if there’s anything I thought wrong or didn’t take into consideration. If everything is fine, I can try to implement this feature and send a PR. Thanks for any advice! Ref: |
@phlogistonjohn So this is my current plan for scaling down a clustered Samba server, the situation is when a user wants to reduce the replica number by editing
I have implemented and tested it in my local environment. I want to ask some advices to see if there are any mistakes and maybe send a PR to samba-operator and sambacc. Thanks. |
Hi, I have deployed a Samba server with clustering feature enabled. According to the documentation, I can change the number of Samba servers by configuring scaling.minClusterSize in smbshare CRD, and this will directly impact the number of replicas in the Samba Statefulset.
Based on the documentation and actual testing, it appears that when modifying a running Samba instance, I can only increase the number of replicas by raising scaling.minClusterSize(scale out), but cannot decrease the number of replicas by lowering the parameter(scale down).
I would like to understand why this parameter is designed to represent the "minimum quantity" rather than being designed to be "exactly equal to the current replicas quantity in the Statefulset." What is the difficulty in reducing the cluster quantity? On the other hand, I also whant to know the recommended approach for decreasing the number of replicas manually.(Should I do anything rather than just modify the replica number if I want to do a scale down?)
Thanks!
The text was updated successfully, but these errors were encountered: