YAML templates for pod creation in Kubernetes

A pod can be created using a YAML template

$vim pod_definition.yml

A simple pod_definition template in YAML is as follows:

apiVersion: v1

kind: Pod

metadata:

name: new-pod

spec:

containers:

- name: nginx

image: nginx

Then, execute the command:

$kubectl create -f pod_definition.yml

Now, Kubernetes creates a pod.

To see the list of pods created: $kubectl get pods

To describe a pod: $kubectl describe pod <pod_name>