如何修复 kubectl unknown shorthand flag: 'f' in -f
问题:
你想运行类似这样的 Kubernetes kubectl 命令
kubectl-missing-command.sh
kubectl -f my-app-deployment.yaml但在 kubectl 打印其整个帮助页面后你看到此错误消息:
kubectl-error.txt
unknown shorthand flag: 'f' in -f解决方案
你缺少 kubectl 的实际命令。最可能的是你想在 Kubernetes 实例上 create 某些内容,在这种情况下你想运行:
kubectl-create-example.sh
kubectl create -f my-app-deployment.yaml你可能还想 apply 或 replace 你的配置。注意 apply 不会自动重启你的 Kubernetes Pod。请阅读如何修复 Kubernetes kubectl apply 不重启 pod了解更多信息。
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