apiVersion: v1
kind: Pod
metadata:
name: mytest
labels:
app: myapp
spec:
containers:
- image: xxx/readytest:v1
name: myapp
该yaml树状结构如下:
其中containers的内容是拥有两个键值对的数组
转换成行内表示法:
{
'apiVersion': 'v1',
'kind': 'Pod',
'metadata': {'name': 'mytest', 'labels': {'app': 'myapp'}},
'spec': {'containers':[{'name': 'myapp', 'image': 'hub.atguigu.com/library/readytest:v1'}]}
}