Updating a Specified Ingress
Function
This API is used to update a specified Ingress.
The following fields can be updated:
- metadata.name
- metadata.namespace
- metadata.selfLink
- metadata.resourceVersion
- metadata.uid
- metadata.labels
- metadata.annotations
- spec.rules
- spec.loadBalancerIP
URI
PATCH /apis/networking.k8s.io/v1beta1/namespaces/{namespace}/ingresses/{name} (Supports 1.15 and 1.15+)
PATCH /apis/extensions/v1beta1/namespaces/{namespace}/ingresses/{name} (Supports 1.15-)
Table 1 describes the parameters of this API.
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
name |
Yes |
Name of the Ingress. |
|
namespace |
Yes |
Object name and auth scope, such as for teams and projects. |
|
pretty |
No |
If 'true', then the output is pretty printed. |
|
body |
Yes |
- |
Request
Request parameters:
For the description about request parameters, see Table 2.
For the description about the Content-Type field, see Patch Request Method Operation Description.
Example request:
{
"spec": {
"rules": [
{
"http": {
"paths": [
{
"backend": {
"serviceName": "test",
"servicePort": 8080
},
"path": "/sssss",
"property": {
"ingress.beta.kubernetes.io/url-match-mode": "STARTS_WITH"
}
}
]
},
"host": "agag"
}
]
}
}
Example response:
{
"kind": "Ingress",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "ingress-test",
"namespace": "default",
"selfLink": "/apis/extensions/v1beta1/namespaces/default/ingresses/ingress-test",
"uid": "138af621-7ad3-11e8-a5f8-fa163e458c2a",
"resourceVersion": "1490196",
"generation": 10,
"creationTimestamp": "2018-06-28T12:59:21Z",
"labels": {
"isExternal": "true",
"zone": "data"
},
"annotations": {
"ingress.beta.kubernetes.io/role": "data",
"ingress.kubernetes.io/secure-backends": "false",
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"extensions/v1beta1\",\"kind\":\"Ingress\",\"metadata\":{\"annotations\":{\"ingress.beta.kubernetes.io/role\":\"data\",\"ingress.kubernetes.io/secure-backends\":\"false\",\"kubernetes.io/elb.id\":\"203e27c4-ceaa-4bca-b652-6947f77d1ce0\",\"kubernetes.io/elb.ip\":\"10.154.199.81\",\"kubernetes.io/elb.port\":\"80\",\"kubernetes.io/ingress.class\":\"public-elb\",\"protocol\":\"HTTP\"},\"labels\":{\"isExternal\":\"true\",\"zone\":\"data\"},\"name\":\"ingress-test\",\"namespace\":\"default\"},\"spec\":{\"rules\":[{\"host\":\"agag\",\"http\":{\"paths\":[{\"backend\":{\"serviceName\":\"ingress-test\",\"servicePort\":8086},\"path\":\"/sssss\",\"property\":{\"ingress.beta.kubernetes.io/url-match-mode\":\"STARTS_WITH\"}}]}}]}}\n",
"kubernetes.io/elb.id": "203e27c4-ceaa-4bca-b652-6947f77d1ce0",
"kubernetes.io/elb.ip": "10.154.199.81",
"kubernetes.io/elb.port": "80",
"kubernetes.io/ingress.class": "public-elb",
"protocol": "HTTP"
}
},
"spec": {
"rules": [
{
"host": "agaaaa",
"http": {
"paths": [
{
"path": "/sssss",
"backend": {
"serviceName": "test",
"servicePort": 8080
},
"property": {
"ingress.beta.kubernetes.io/url-match-mode": "STARTS_WITH"
}
}
]
}
}
]
},
"status": {
"loadBalancer": {
"ingress": [
{
"ip": "10.154.199.81",
"hostname": "sssss"
}
]
}
}
}
Status Code
Table 2 describes the status code of this API.
For the description about error status codes, see Status Code.
Last Article: Creating an Ingress
Next Article: Replacing a Specified Ingress
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.