Skip to content

Instantly share code, notes, and snippets.

@matiasah
Last active April 13, 2022 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matiasah/718313939916fd849948ff0f4d7273fb to your computer and use it in GitHub Desktop.
Save matiasah/718313939916fd849948ff0f4d7273fb to your computer and use it in GitHub Desktop.
How to apply a ConfigMap from a file, that may or may not exist

How to apply a ConfigMap from a file, when the ConfigMap may or may not exist

Will run kubectl create to generate the manifest, and kubectl apply to create it if it didn't exist or update it if it already existed.

kubectl create configmap <name-of-configmap> --from-file=<name-of-key>=<name-of-file> --namespace=<namespace> -o yaml --dry-run=client | kubectl apply -f -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment