kubernetes / kubernetes/kubectl
`kubectl get sts` cannot show its status if it is in terminating
- Dominant language
- Go
- Stars
- 3.3k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
The current behavior
```
[root@demo-dev-master-01 ~]# kubectl get sts
NAME READY AGE
prometheus-insight-agent-kube-prometh-prometheus 1/1 8d
```
If the stateful set is terminating with a finalizer, it will block there. But, if an admin debugs using `kubectl get`, he could not see anything about the terminating status. (**The only signal is that its `metadata.deletionTimestamp` is not nil.**)
- For namespace/pod, the terminating status is quite visible.
**What would you like to be added**:
An easy-seeing status about sts/deployment is in terminating status.
some proposals:
1. but this is a significant behavior change, some shells will mistakenly take the status as the Name.
```
[root@demo-dev-master-01 ~]# kubectl get sts
NAME READY AGE
prometheus-insight-agent-kube-prometh-prometheus(Terminating) 0/1 8d
```
2. add new status in default get-table. (Or show the status only with `-o wide` by default)
```
[root@demo-dev-master-01 ~]# kubectl get sts
NAME READY AGE Status
prometheus-insight-agent-kube-prometh-prometheus 0/1 8d Terminating
```
3. add a warning event if a sts/deploy is not deleted after being marked as Terminating for a long period(maybe 1h).
Why do I choose 1h here? The default event-ttl in kube-apiserver is 1h.
Even when the user describes the statefulset/deployment after 1h, the deleting event will not be there and the admin will still be very confused about why the STS/deploy is not creating a new pod.
The event can just show a message that the object hangs for termination.
**Why is this needed**:
As there are more and more operators, the finalizer is used widely, which has become a big problem for Ops admins.
Contributor guide
Research direction
Start with the kubectl get output for StatefulSets and Deployments, and review how metadata.deletionTimestamp is currently exposed. Clarify which proposed user-facing behavior should be implemented, then verify that terminating objects show an unambiguous status without breaking existing column output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100