how can I enable the record parameter by default each time I want to create a new pod? My goal is change the default behaviour of the record parameter in order to avoid to use the --record=true eache time I want to instantiate new pod.
This is an example:
kubectl create -f https://raw.githubusercontent.com/mhausenblas/kbe/master/specs/deployments/d09.yaml --record=true
Otherwise, if is not possible change the default behaviour of kubectl create, is there a possibility to add record option to my yaml configuration file?
Thank you.
The best way to address the problem is to create a wrapper script around kubectl create. call the wrapper script with 'r' param to append --record=true
In my opinion your use case is ideal for packaging your Kubernetes deployment manifest file in Helm. Once you have your own helm chart, you would run following cmd:
helm template --output-dir ./manifests ./charts/diego-chart --set record=true | kubectl apply ./manifests
AFAIK, you can't define default values for commands parameters
Your alternatives are:
create a bash function with the default parameters and call it with the parameters you want
diego@PC:/$
k8s() { kubectl $1 $2 $3 --record=true;}
diego@PC:/$
k8s create -f https://test
Create kubectl plugins and write your custom command to replace the create
subcommand with your own parameter set and internally you call the kubectl create.
The idea is similar to above, but you would still use the kubectl,
i.e: kubectl createrec -f https://raw.githubusercontent.com/../d09.yaml
The other alternative is download the source and change the default value and compile a new version