CreateOrReplace not fully equivalent with `apply`
See original GitHub issueDescribe the bug
Client Version: 5.12.1 K8s version: 1.19
Function createOrReplace is not equivalent to kubectl apply
is instead behaves more like kubectl create
(as expressed in the code comments )
Despite being an old comment this is what we’re experiencing (https://github.com/kubernetes/kubernetes/issues/25238#issuecomment-306549174)
what is currently happening is that we have
- Deployment with no replica set
- HPA with min replicas 1
when using manually kubectl apply
it behaves as expected, doing the proper rolling update (25%, max unavailable 0)
when using the client it behaves like a create(or replace) operation forcing the deployment object to update to replicas 1 (default by k8s) and updating the replica set back to 1 this immediately terminates all remaining pods breaking what would else be a smooth deployment.
This completely invalidates the use of fabric8 client for applying manifests in a safe way.
Other refs: https://github.com/kubernetes/kubernetes/issues/25238#issuecomment-406415297 https://www.linkedin.com/pulse/kubectl-createreplace-vs-apply-which-one-use-samrat-sen/
Fabric8 Kubernetes Client version
5.12.1@latest
Steps to reproduce
- Use client apply twice a manifest with 1.1 HPA 10 min replicas (10 just allows to easily observe the behaviour) 1.2 Deployment with no replicas specified, rolling update (max surge 25%, max unavailable 0)
Expected behavior
Second apply should show a smooth transition of the pods to the new ones.
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
other (please specify in additional context)
Environment
Amazon
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:10 (8 by maintainers)
Top GitHub Comments
@sunix @rohanKanojia it would probably be good to still have an issue for a higher-level apply or serverSideApply method. That will be easier for users to find.
No, see https://github.com/fabric8io/kubernetes-client/issues/3896#issuecomment-1066739461.
It would be nice to have a DSL method to perform the Server Side Apply logic, instead of manually configuring the patch.