YAML documents, at a high level, have three basic primatives (structures) that make up the structure of a YAML document:
- Scalars (strings, numbers, dates, etc...)
- Mappings (key/value pairs, hash maps, dictionaries)
- and Sequences (lists, arrays)
In this exercise, we will practice creating some mappings. Below is a graphical example of some of the different types of mappings you can expect to see:
As you can see in the picture above, a mapping is essentially a key/value pair. The "value" can be either a sequence (this is something we talk about in the next exercise), a scalar, or another mapping.
-
Open the file
l1_e2.yaml
and supply the create three mappings that have the following requirements. (NOTE: Please make the mappings in the order as they are listed):- Mapping with a key called MyName with an assigned scalar of type string.
- Mapping with a key called Age with an assigned scalar of type integer.
- Mapping with a key called HasHobbies with an assigned scalar of type boolean.
-
Open the terminal within VS Code, press the following keys together:
ctrl + shift + `
-
Change directory to this exercise folder with the following command:
cd ~/Kubernetes_Labs/lab1/exercise-2
-
After supplying all the values, run the following command to check your work:
./check-work
After completing the this exercise, please click on the button below to go to the next exercise where you'll learn about sequences.