examples icon indicating copy to clipboard operation
examples copied to clipboard

Error: unknown flag: --from-file

Open ftripier opened this issue 8 years ago • 4 comments

Hey! When I run this command from the book for example 14-3:

kubectl apply cm --from-file ghost-config.js ghost-config

I get this error:

Error: unknown flag: --from-file

I'm on kubectl version:

Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.3", GitCommit:"f0efb3cb883751c5ffdbe6d515f3cb4fbe7b7acd", GitTreeState:"clean", BuildDate:"2017-11-08T18:39:33Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.4", GitCommit:"d6f433224538d4f9ca2f7ae19b252e6fcb66a3ae", GitTreeState:"dirty", BuildDate:"2017-06-22T04:31:09Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}

Do I need to be on an older version for that invocation to work?

For anyone else with this problem, I used this command to get it working:

kubectl create configmap ghost-config --from-file ghost-config.js

ftripier avatar Nov 18 '17 19:11 ftripier

Thanks so much for making this correction!

snyderdb avatar Feb 25 '18 18:02 snyderdb

Thanks for posting this work-around for this error in the book!

stephenfrench9 avatar Mar 04 '19 06:03 stephenfrench9

@ftripier ,

kubectl create configmap ghost-config --from-file ghost-config.js

This command would fail if a configmap ghost-config already exists.

kubectl apply is used mainly to update resources if there is change in manifests. So how can we update an existing configmap ?

karthikc911 avatar Feb 25 '20 22:02 karthikc911

@karthikc911, I know this issue isn't too fresh, but I'll post this here anyways for future readers. You could try to do something like this: https://blog.atomist.com/updating-a-kubernetes-secret-or-configmap/

markmak77 avatar Jul 07 '21 22:07 markmak77

Looks like this has been addressed. Feel free to reopen if that's not the case.

lachie83 avatar Nov 15 '23 18:11 lachie83