我从以下链接看到 Kubernetes REST API 参考手册支持 PATCH 请求: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}
Run Code Online (Sandbox Code Playgroud)
但是,在 Postman 中通过 Kubernetes REST API 服务器向 Kubernetes 集群发送 PATCH 请求时,出现 HTTP 415 Unsupported Media Type 错误。
我想在集群外部部分更新我们指定的入口。为此,我添加了试用版的快照。
Kubernetes REST API 服务器入口 PATCH 请求
我们的 Kubernetes 版本是:
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"}
Run Code Online (Sandbox Code Playgroud)
修补 JSON:
{
"apiVersion": "networking.k8s.io/v1beta1",
"kind": "Ingress",
"metadata": {
"name": "demo-ingress",
"annotations": {
"nginx.org/rewrites": "serviceName=demo-service-235 rewrite=/"
} …Run Code Online (Sandbox Code Playgroud)