Kustomize Update Field with Slash

ยท
1 min read
notes
#kubernetes #kustomize #yaml

How to insert slash as key

TL:DR; use ~1 will be rendered as /

This is a common ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/whitelist-source-range: 10.0.0.0/8

To change this on an overlay:

- patch: |-
- op: replace
path: /metadata/annotations/nginx.ingress.kubernetes.io~1whitelist-source-range
value: "192.168.0.0/16"
target:
kind: Ingress
name: webdashboard-ingress

The ~1 in patch will be rendered as /