I\'m setting up a k8s cluster on GKE. A wildcard DNS *.server.com
will point to a Ingress controller. Internally to the cluster, there will be webserver pods, eac
I found a solution to add a rule to an ingress by executing the following patch:
[
{
"op": "add",
"path": "/spec/rules/-",
"value": {
"host": "",
"http": {
"paths": [
{
"path": "/*",
"backend": {
"serviceName": "",
"servicePort":
}
}
]
}
}
}
]
kubectl patch ingress ${INGRESS_NAME} --type json -p "$(cat patch.json)"
But I cant find the solution to remove it. What I tried is the follwoing patch;
[
{
"op": "remove",
"path": '{.spec.rules[?(@.host=="")]}'
}
]
But I just get the error 'The "" is invalid' back from kubectl
Whats wrong with it? I followed the jsonPath syntax from https://kubernetes.io/docs/reference/kubectl/jsonpath/