[英]Kubectl patch adding extra “-” character
I'm trying to use kubectl patch to add an extra annotation to my k8s nginx ingress. 我正在尝试使用kubectl补丁程序为我的k8s nginx入口添加一个额外的注释。
Here's the ingress that I start with: 这是我开始的入口:
apiVersion: v1
items:
- apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
field.cattle.io/publicEndpoints: '[{"stuff:false}]'
kubernetes.io/ingress.class: nginx-external
creationTimestamp: "2019-02-25T20:38:29Z"
generation: 1
Here is my patch file that I'm applying ingress_annotation.yaml
. 这是我正在应用
ingress_annotation.yaml
补丁文件。
metadata:
annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header l5d-dst-override $service_name.$namespace.svc.cluster.local:80;
proxy_hide_header l5d-remote-ip;
proxy_hide_header l5d-server-id;
I apply this patch by running kubectl patch ingress kibana --patch "$(cat ingress_annotation.yaml)"
. 我通过运行
kubectl patch ingress kibana --patch "$(cat ingress_annotation.yaml)"
应用此补丁。
When I apply this it does add the annotation to the ingress looks like this when I run kubectl get ingress <my_ingress> -o yaml
: 当我应用它时,确实在运行
kubectl get ingress <my_ingress> -o yaml
时将注释添加到入口,如下kubectl get ingress <my_ingress> -o yaml
:
apiVersion: v1
items:
- apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
field.cattle.io/publicEndpoints: '[{"Stuff:false}]'
kubernetes.io/ingress.class: nginx-external
nginx.ingress.kubernetes.io/configuration-snippet: |-
proxy_set_header l5d-dst-override $service_name.$namespace.svc.cluster.local:80;
proxy_hide_header l5d-remote-ip;
proxy_hide_header l5d-server-id;
creationTimestamp: "2019-02-25T20:38:29Z"
generation: 1
Note the extra "-"
character after nginx.ingress.kubernetes.io/configuration-snippet: |
注意
nginx.ingress.kubernetes.io/configuration-snippet: |
之后的多余"-"
字符nginx.ingress.kubernetes.io/configuration-snippet: |
. 。 I'm not sure where this character is coming from or what it's doing here.
我不确定这个角色来自哪里或在这里做什么。 Can anyone shine some light on this for me, or how I can prevent this character from being added to my annotation?
谁能为我提供一些启发,或者如何防止将此字符添加到注释中?
This is YAML syntax that is probably added automatically by kubectl: 这是kubectl可能自动添加的YAML语法 :
- indicator: remove extra newlines after block
-指示器:阻止后删除多余的换行符
content: |-
Arbitrary free text without newlines after it
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.