You could use kustomize, and it manages not only configmaps but other resources easily. I think you wanted to create configmap from a file in yaml, so you could do something like the following in a kustomization.yaml file:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
configMapGenerator:
- files:
- ./conf/nginx.conf
name: nginx-config
Additionally, kustomize is very handy to manage all the deployments (particularly very handy for declarative management), and you can have everything in a single kustomize file as shown below:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
secretGenerator:
- envs:
- .env
name: my-secrets
configMapGenerator:
- files:
- ./conf/nginx.conf
name: nginx-config
resources:
- ./nginx-deployment.yaml
The to deploy everything you could run it like this:
$ kustomize build | kubectl apply -f -
For more information please refer here