更新时间:2022-04-18 GMT+08:00
分享

替换指定的Ingress

功能介绍

This API is used to replace the specified Ingress.

其中以下字段支持更新:

  • metadata.name
  • metadata.namespace
  • metadata.selfLink
  • metadata.resourceVersion
  • metadata.uid
  • metadata.labels
  • metadata.annotations
  • spec.rules
  • spec.loadBalancerIP

URI

PUT /apis/networking.k8s.io/v1beta1/namespaces/{namespace}/ingresses/{name} (Supports 1.15 and 1.15+)

PUT /apis/extensions/v1beta1/namespaces/{namespace}/ingresses/{name} (Supports 1.15-)

表1描述该API的参数。

表1 参数解释

参数

是否必选

描述

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

-

请求消息

响应参数:

请求参数的详细描述请参见表2

请求示例:

{
    "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",
        "resourceVersion": "1486389"
    },
    "spec": {
        "rules": [
            {
                "host": "test",
                "http": {
                    "paths": [
                        {
                            "backend": {
                                "serviceName": "ingress-test",
                                "servicePort": 8086
                            },
                            "path": "/sssss",
                            "property": {
                                "ingress.beta.kubernetes.io/url-match-mode": "STARTS_WITH"
                            }
                        }
                    ]
                }
            }
        ]
    }
}

响应消息

响应参数:

响应参数的详细描述请参见请求消息

响应示例:

{
    "kind": "Ingress",
    "apiVersion": "extensions/v1beta1",
    "metadata": {
        "name": "ingress-test",
        "namespace": "default",
        "selfLink": "/apis/extensions/v1beta1/namespaces/default/ingresses/ingress-test",
        "uid": "3acdf7b4-7ac5-11e8-a5f8-fa163e458c2a",
        "resourceVersion": "1490779",
        "generation": 2,
        "creationTimestamp": "2018-06-28T11:20:14Z",
        "labels": {
            "isExternal": "true",
            "zone": "data"
        },
        "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"
        }
    },
    "spec": {
        "rules": [
            {
                "host": "test",
                "http": {
                    "paths": [
                        {
                            "path": "/sssss",
                            "backend": {
                                "serviceName": "ingress-test",
                                "servicePort": 8086
                            },
                            "property": {
                                "ingress.beta.kubernetes.io/url-match-mode": "STARTS_WITH"
                            }
                        }
                    ]
                }
            }
        ]
    },
    "status": {
        "loadBalancer": {
            "ingress": [
                {
                    "ip": "10.154.199.81",
                    "hostname": "test"
                }
            ]
        }
    }
}

状态码

表2描述API的状态码。

表2 状态码

状态码

描述

200

success

201

Created

分享:

    相关文档

    相关产品

close