YML File
YML file is used to define any object in kubernetes. It has following basic and mandatory fields.
apiVersion: v1
kind: Pod
metadata:
name: mypod
labels:
type: frontend
spec:
containers:
- name: nginx-container
image: nginxapiVersion tells which api version to use for a particular resource. Following table shows api version for different kind of resources.
| Kind | Version |
|---|---|
| Pod | v1 |
| Service | v1 |
| Deployment | apps/v1 |
| ReplicaSet | apps/v1 |
metadata contains information about the resource which consists of keys like name and labels. labels can have any key value pairs. labels help distinguish resources.
speccontainers specifications for the resources and it will be different for different kind. In this case of Pod, it has containers.