How to fix kubectl unknown shorthand flag: 'f' in -f
Problem:
You want to run a Kubernetes kubectl command like
kubectl-missing-command.sh
kubectl -f my-app-deployment.yamlbut you see this error message after kubectl prints its entire help page:
kubectl-error.txt
unknown shorthand flag: 'f' in -fSolution
You are missing an actual command to kubectl. Most likely you want create something on your Kubernetes instance, in which case you want to run this instead:
kubectl-create-example.sh
kubectl create -f my-app-deployment.yamlYou might also want to apply or replace your config instead. Note that apply does not automatically restart your Kubernetes Pods. Read How to fix Kubernetes kubectl apply not restarting pods for more information.
Check out similar posts by category:
Cloud, Container, Kubernetes
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow