Home > Software engineering >  YAML code to create a configmap with a particular file (.js/.sh)
YAML code to create a configmap with a particular file (.js/.sh)

Time:06-29

What will be the equivalent ConfigMap YAML code for the following command line?

kubectl create configmap mongo-initdb --from-file=init-mongo.js

CodePudding user response:

There is actually a kubectl command that lets you get the generated yaml for a created config map. In your case:

kubectl get configmaps mongo-initdb -o yaml

CodePudding user response:

You can use the command as suggested by Mo Xue, however here is YAML,

Example :

apiVersion: v1
kind: ConfigMap
metadata:
  name: mongo-initdb
data:
  init-mongo.js: |
    <Content> 

Read more about : https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#create-configmaps-from-directories

  • Related