kubernetes / kubernetes/kubectl
kubectl should suggest next kubectl commands
- Dominant language
- Go
- Stars
- 3.3k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
If I do `kubectl describe replicationcontroller/foo`, there is a good chance that the next
thing I want to do is to see details about the pods created by that replication controller.
Therefore, `kubectl` should suggest these next steps to me. I'm thinking an output format like this:
``` console
$ ./kubectl describe rc/foo
$ ./kubectl describe rc/temp
Name: temp
Namespace: default
Image(s): redis
Selector: run=temp
Labels: run=temp
Replicas: 1 current / 1 desired
Pods Status: 1 Running / 0 Waiting / 0 Succeeded / 0 Failed
No volumes.
No events.
...
Suggested Next Commands:
# List all pods created by this replication controller.
kubectl get pods -l run=temp
# Describe a running pod created by this replication controller.
kubectl get pods temp-d729d
# Get logs from first container of the last failed pod of this replication controller.
kubectl logs -p pods temp-5sj4k
```
Since we don't use URLs and HATEOAS in kubernetes, and since new users do not understand the
conventions by which controllers add labels, it is hard for users to know what to do next. As we get more levels of controllers (Deployment/Rc/Pod, ScheduledJob/Workflow/Job/Pod) and as we get more types of objects created by the same controller (PetSet/{Secret,ConfigMap,RC}), it will become tedious for users to navigate the hierarchy even if they know the right commands.
Other example of this feature:
- Job:
- show Pods it created
- show all still running pods
- show last failed pod (if there was a failure)
- RC:
- show all pods created by the RC
- show all
- Service:
- show all pods matching the selector
- ScheduledJob:
- show Jobs or Workflows it created
- Workflow:
- show Jobs it created
- Pod:
- show logs of its containers
- show logs of previous invokation (if there has been a failure).
- Deployment:
- show its RCs (since there are typically only 2 or 3 RCs, maybe show one command for individually listing each RC?
Contributor guide
Research direction
The issue names no files, tests, or implementation entry points. Start by locating the existing kubectl describe command and reviewing how it discovers related resources and selectors. Done would require an agreed, tested set of suggested commands for the supported resource types.
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
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100