-
Notifications
You must be signed in to change notification settings - Fork 974
Open
kubernetes/kubernetes
#133197Labels
kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Description
What would you like to be added:
I want to add a feature to kubectl that outputs a command-line string capable of reproducing the current execution context of a kubectl command in environments where kuberc is not configured, effectively replicating the functionality currently provided by kuberc.
Why is this needed:
In Kubernetes, SREs sometimes share kubectl command snippets within their teams to consistently verify the state of clusters and applications.
Example
## Check running specific production pods
$ kubectl get po -n app-01 --field-selector status.phase=Running -l environment=production
However, as kuberctl becomes more widely used, individual kubectl command snippets may become unshareable. Therefore, it would be beneficial to have a method to share requests made by kubectl even without kuberc configuration.
Design Proposal:
## kuberc
apiVersion: kubectl.config.k8s.io/v1alpha1
kind: Preference
aliases:
- name: getdbprod
command: get
prependArgs:
- pods
flags:
- name: labels
default: what=database
- name: namespace
default: us-2-production
overrides:
- command: apply
flags:
- name: server-side
default: "true"
- command: delete
flags:
- name: interactive
default: "true"
snippetOutput: true ## example
Example output
$ KUBECTL_KUBERC=true kubectl getdbprod
## Execute: $ kubectl get pods -l what=database -n us-2-production
...
$ KUBECTL_KUBERC=true kubectl apply -f -
## Execute: $ kubectl apply --server-side=true -f -
...
link
jvoravong
Metadata
Metadata
Assignees
Labels
kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.