Question
Is there a way to get the YAML manifest file of a configmap, without creating the corresponding Kubernetes resource?
At the moment I'm doing this:
kubectl create configmap <name> --from-file="<name>"kubectl get configmap <name> -o yaml > <name>.yamlkubectl delete configmap <name>
Is there some simple way to achieve this without having to create a temporary resource in the Kubernetes cluster?
Example
Directory structure:
myheader/+- handler.lua+- schema.lua
File handler.lua
:
local MyHeader = {}MyHeader.PRIORITY = 1000MyHeader.VERSION = "1.0.0"function MyHeader:header_filter(conf) -- do custom logic here kong.response.set_header("myheader", conf.header_value)endreturn MyHeader
File schema.lua
:
return { name = "myheader", fields = { { config = { type = "record", fields = { { header_value = { type = "string", default = "roar", }, }, }, }, }, }}
I can obtain the manifest file myheader-configmap.yaml
like this:
kubectl create configmap myheader --from-file "myheader/"kubectl get configmap myheader -o yaml > myheader-configmap.yamlkubectl delete configmap myheader
Is there some command or anything else to obtain the same manifest file, without having to preemptively create the corresponding Kubernetes resource?