Can someone point me to some documentation that explains the indentations for kubernetes objects, files, etc.
I am not understanding when, why and, how to indent.
Can someone point me to some documentation that explains the indentations for kubernetes objects, files, etc.
I am not understanding when, why and, how to indent.
IBM’s developer site has a nice introduction to YAML; it covers the basics. Some points:
akey: "a value
")nameOfList:
- item1
- item2
- item3
nameOfDictionary:
key1: val1
key2: val2
fred: another key
Indentation reflects when something like a list is inside of a dictionary, or a list of dictionaries. But the key to getting indentation right is to learn what the various parts of the YAML file are doing – are they list of items? Are they objects/dictionaries with keys? Are they just scalars with a single value? But you intent when you are adding items of a list, or keys to a dictionary.
The other rules is: in a list or a dictionary, everything at the same level needs the same indentation. It doesn’t matter how much, although I think it’s a best practice to be consistent – always use spaces and never use tabs, and use two spaces per indentation level.
@andrew-reichek Please also see https://github.com/kodekloudhub/community-faq/blob/main/docs/yaml-faq.md