kubernetes: kubectl wait works for Deployment, but does not for StatefulSet
What happened:
kubectl wait -f schema-registry.yaml --for condition=available
works for Deployment, but it does not work for StatefulSet
What you expected to happen: Expected that kubectl wait works for StatefulSet
kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.2", GitCommit:"cff46ab41ff0bb44d8584413b598ad8360ec1def", GitTreeState:"clean", BuildDate:"2019-01-13T23:15:13Z", GoVersion:"go1.11.4", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 40
- Comments: 51 (11 by maintainers)
For everybody coming here, I suggest you try to use the
rollout status
command like this:It is not exactly the same thing, but it might solve your use-case for this feature.
If you want to wait until a statefulset rollout is finished, you can do the following:
Hey, I just wanted to share something that may be of use - instead of checking a condition on the
StatefulSet
, it might be easier to look for the same condition on the pods.With a
StatefulSet
:I can do a
and achieve the same result.
In https://github.com/kubernetes/kubernetes/issues/51594#issuecomment-334646068 @kow3ns wrote:
It looks like statefulset API supports conditions, but the statefulset controller doesn’t set them…at least it didn’t at time of writing: https://github.com/kubernetes/kubernetes/blob/v1.19.0-alpha.0/staging/src/k8s.io/api/apps/v1/types.go#L219
Is
rollout status
replacingwait
generally, or is there a timeline for StatefulsetConditions to be updated properly?Can confirm what @wallrj wrote: According to the docs,
conditions
are supported:But the condition field is never actually set.
Version:
That is really confusing.
just ran into this myself; here’s a workaround; it’s not sexy but it totally works.
Output from a run just iterates from the replica count:
And, there are only 5 variables to keep track of; easy.
@javajon You mentioned me by mistake, instead of @seeker25