Consider the following ConfigMap
definition, in, say, foo.yml
:
apiVersion: v1
kind: ConfigMap
metadata:
name: foo-data
data:
foo.json: |-
{
"foo": "foo",
"bar": 42
}
Is there a way to load the foo.json
data from an external file, instead of inlining it in the template? It would be nice if I could put the data in a file foo.json
next to foo.yml
, reference it somehow, and have K8s figure it out when I apply the template.
Is that possible? How?
If not, is the feature on the roadmap?
In the . yaml file for the Kubernetes object you want to create, you'll need to set values for the following fields: apiVersion - Which version of the Kubernetes API you're using to create this object. kind - What kind of object you want to create.
As mentioned above, using the YAML field allows you to declaratively manage your Kubernetes applications. These YAML files can be stored in a common directory and may all be applied using kubectl apply -f <directory>.
To create a Kubernetes pod with YAML, you first create an empty file, assign it the necessary access permissions, and then define the necessary key-value pairs. The important ones are the apiVersion, the kind (pod), name, and the containers within the pod.
Afaik there is no build-in templating as for now but you can use ansible templating capabilities with k8s yaml files saute or together with e.g. k8s plugin.
Works like a charm :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With