I have seen that PATCH request is supported in Kubernetes REST API reference manual from this link: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#patch-ingress-v1beta1-networking-k8s-io
HTTP Request
PATCH /apis/networking.k8s.io/v1beta1/namespaces/{namespace}/ingresses/{name}
However, I get HTTP 415 Unsupported Media Type error when sending PATCH request to Kubernetes cluster through Kubernetes REST API server in Postman.
I want to update our specified ingress partially outside the cluster. For this purpose, I added a snapshot from my trial.
Kubernetes REST API server Ingress PATCH Request
Our Kubernetes version is:
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.3", GitCommit:"2d3c76f9091b6bec110a5e63777c332469e0cba2", GitTreeState:"clean", BuildDate:"2019-08-19T11:13:54Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.3", GitCommit:"2d3c76f9091b6bec110a5e63777c332469e0cba2", GitTreeState:"clean", BuildDate:"2019-08-19T11:05:50Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Patching JSON:
{
"apiVersion": "networking.k8s.io/v1beta1",
"kind": "Ingress",
"metadata": {
"name": "demo-ingress",
"annotations": {
"nginx.org/rewrites": "serviceName=demo-service-235 rewrite=/"
}
},
"spec": {
"rules": [
{
"host": "www.demodeployment.com",
"http": {
"paths": [
{
"path": "/235/",
"backend": {
"serviceName": "demo-service-235",
"servicePort": 8088
}
}
]
}
}
]
}
}
I can use GET, POST, PUT and DELETE successfully, in PATCH request I can't get the same results. What could be the root cause of the problem? What are your ideas?