What's is the purpose of a trailing '-' in a Kubernetes apply -f –

Chris Halcrow asked:

I was passed the following, which does a dry run of the creation of a kubernetes secret from an appsettings.json file, which is then piped to a kubernetes apply. I think that the -f will take the filename of the --dry-run created secret and use that when applying the secret, but I’m wondering if the trailing - has any significance or if it’s just a typo?

kubectl create secret generic test --from-file=appsettings.json --dry-run -oyaml | kubectl apply -f -

My answer:


The - is a parameter to the -f option, which means to accept input from standard input instead of a named file. Hundreds of UNIX/Linux commands have options like this.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.