Home > Net >  Unknown flag --from-file (Kubectl)
Unknown flag --from-file (Kubectl)

Time:10-26

I'm trying to create a config map from my mongodb configuration file. I have used the following command:

kubectl create configMap mongodb-config-file --from-file=conf=mongodb.cfg

and I get this error:

Error: unknown flag: --from-file
See 'kubectl create --help' for usage.

Why is --from-file an unknown flag? Am I missing something? I'm using windows if that information is useful. I'm still new to kubernetes and kubectl so any extra information on conigMaps is welcome.

I tried to find a soloution on Google or other stack overflow questions and couldn't find one.

CodePudding user response:

The proper syntax for a configMap object creation is as follows:

kubectl create configmap NAME [--from-file=[key=]source]

The resource object is configmap and not configMap:

kubectl create configmap mongodb-config-file --from-file=conf=mongodb.cfg
  • Related