本文共 2311 字,大约阅读时间需要 7 分钟。
map: one: 1 two: 2 three: 3sequence: - one - two - three
coffee: / Latte Cappuccino Espresso#output:Latte\nCappuccino\nEspresso\ncoffee: |- Latte Cappuccino Espresso#output: Latte\nCappuccino\nEspresso (with no trailing \n).减号表示减去末尾换行符(不换行)coffee: |+ Latte Cappuccino Espresso#output: Now the value of coffee will be Latte\nCappuccino\nEspresso\n\n\n.加号表示加上末尾换行符(换行)
1、YAML规范提供了一种存储对值的引用,并在以后通过引用引用该值的方法。YAML将此称为“锚定”:
The YAML spec provides a way to store a reference to a value, and later refer to that value by reference. YAML refers to this as “anchoring”: 2、就是先通过引用赋值,然后通过取址的方式取得值
coffee: "yes, please"favorite: &favoriteCoffee "Cappucino" #引用赋值coffees: - Latte - *favoriteCoffee #取址来取值 - Espresso #上面表达式等同为coffee: yes, pleasefavorite: Cappucinocoffees:- Latte- Cappucino- Espresso
注意:Because Helm and Kubernetes often read, modify, and then rewrite YAML files, the anchors will be lost.由于Helm和Kubernetes经常读取,修改然后重写YAML文件,因此锚点将丢失。
apiversion: group/apiversionversionskind: metadata: name: namespace: labels annotationsspec:
参数名 | 说明 |
---|---|
spec.container[] | |
spec.container[].name | |
spec.container[].image | |
spec.container[].imagePullPolicy | |
spec.container[].command[] | |
spec.container[].args[] | |
spec.container[].workingDir | |
spec.container[].wolumeMounts[] | |
spec.container[].wolumeMounts[].name | |
spec.container[].wolumeMounts[].mountPath | |
spec.container[].wolumeMounts[].readOnly | |
spec.container[].ports[] | |
spec.container[].ports[].name | |
spec.container[].ports[].containerPort | |
spec.container[].ports[].hostPort | |
spec.container[].ports[].protocol | |
spec.container[].env[] | |
spec.container[].env[].name | |
spec.container[].env[].value | |
spec.container[].resources.limits | |
spec.container[].resources.limits.cpu | |
spec.container[].resources.limits.memory | |
spec.container[].resources.requests | |
spec.container[].resources.requests.cpu | |
spec.container[].resources.requests.memory | |
spec.nodeSelector | |
spec.imagePullsecrets | |
spec.hostNetwork |
apiVersion: v1kind: ReplicationControllermetadata: name: kikispec: replicas: 3 selector: app: kiki template: metadata: labels: app: kiki spec: containers: - name: kiki image: centos imagePullPolicy: IfNotPresent command: - "/bin/sh" - "-c" - "sleep 3600"
转载地址:http://qxnkk.baihongyu.com/