title | description |
---|---|
YAML Basics for Kubernetes |
Learn YAML Basics |
- Space after colon is mandatory to differentiate key and value
# Defining simple key value pairs
name: kalyan
age: 23
city: Hyderabad
- Set of properties grouped together after an item
- Equal amount of blank space required for all the items under a dictionary
person:
name: kalyan
age: 23
city: Hyderabad
- Dash indicates an element of an array
person: # Dictionary
name: kalyan
age: 23
city: Hyderabad
hobbies: # List
- cycling
- cookines
hobbies: [cycling, cooking] # List with a differnt notation
- Dash indicates an element of an array
person: # Dictionary
name: kalyan
age: 23
city: Hyderabad
hobbies: # List
- cycling
- cooking
hobbies: [cycling, cooking] # List with a differnt notation
friends: # Multiple Lists
- name: friend1
age: 22
- name: friend2
age: 25
apiVersion: v1 # String
kind: Pod # String
metadata: # Dictionary
name: myapp-pod
labels: # Dictionary
app: myapp
spec:
containers: # List
- name: myapp
image: stacksimplify/kubenginx:1.0.0
ports: # Multiple Lists
- containerPort: 80
protocol: "TCP"
- containerPort: 81
protocol: "TCP"