Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yaml templates in Kubernetes

Where can I find an official template which describes how to create your .yaml file to setup services/pods in Kubernetes?

like image 860
DenCowboy Avatar asked Oct 13 '16 07:10

DenCowboy


People also ask

What is Template in Kubernetes YAML?

The template is a template for how to create those pods. If you want to use a deployment (where K8s automatically maintains a configured number of replicas of your pod) then you must have a template for creating the pods. Note that the spec part also belongs to the template.

What is YAML template?

The YAML Templating Tool (ytt) is a new take on YAML templating, and when we say templating what we really mean is data structure building. At its core, ytt is the idea that we can use YAML comments to annotate YAML structures (such as maps, arrays, and even documents) with necessary instructions and metadata.

What is Template in deployment YAML?

template field of the YAML configuration. The Deployment object not only creates the pods but also ensures the correct number of pods is always running in the cluster, handles scalability, and takes care of updates to the pods on an ongoing basis.


1 Answers

You can find the specification for a pod here http://kubernetes.io/docs/api-reference/v1/definitions/#_v1_pod

A good starting point is also the examples https://github.com/kubernetes/kubernetes/tree/master/examples

Additional you can create the ressource via kubectl and export the resource to yaml

e.g. for a pod you can run this command:

kubectl run nginx --image=nginx kubectl get pods ngnix -o yaml > pod.yaml

like image 156
Sebastian Avatar answered Oct 18 '22 12:10

Sebastian