Every resource in Kubernetes is defined in a file in either JSON or YAML format. The two formats are completely interchangeable. YAML is usually easier for a human to read. It is possible to have some resources defined in YAML and others in JSON. As a best practice, pick a format and stick to it.
All resources will have at least two fields:
apiVersion: This is the version of the API that is being used. As new features are added, the version may change.
kind: This is the type of resource. This tells Kubernetes what type of resource is being created.
Each resource may be defined in a separate file. In some cases, it is worth combining resources into a single file. For example, it makes sense to define an ingress object in the same file as the service that it exposes. In that case, separate the resources with three dashes,
---, alone on a line. Following is an example showing how to do this:
apiVersion: v1 kind: Service metadata: name: wp...