appendix B Basics of YAML
Yet Another Markup Language (YAML) is a human-readable data serialization format. It’s often used for configuration files and data exchange between languages with different data structures. In Kubernetes, YAML is used for defining configuration files that describe the desired state of Kubernetes resources. These configuration files are then used with the kubectl command-line tool to create, update, or delete resources in a Kubernetes cluster. With this in mind, it’s quite important to learn a bit about YAML.
B.1 Basic YAML files
A basic YAML file consists of key-value pairs and may include lists and nested structures. Following is an example of a simple YAML file, which we’ll use to understand the YAML format:
#YAML comment
name: John Doe
age: 30
is_student: false
grades:
- subject: Math
score: 95
- subject: English
score: 80
address:
city: "New York"
zip: 10001
country: USA
The example used here represents information about a person, including their name, age, student status, grades, and address. YAML’s simplicity and readability make it a popular choice for configuration files and data exchange formats.