华为云用户手册

  • 请求示例 将StatefulSet中的replicas值修改为2。 { "apiVersion" : "apps/v1", "kind" : "StatefulSet", "metadata" : { "name" : "statefulset-test" }, "spec" : { "replicas" : 2, "selector" : { "matchLabels" : { "app" : "statefulset-test" } }, "serviceName" : "statefulset-test", "template" : { "metadata" : { "labels" : { "app" : "statefulset-test" } }, "spec" : { "containers" : [ { "image" : "*.*.*.*:20202/cci/redis:V1", "name" : "container-0", "resources" : { "limits" : { "cpu" : "500m", "memory" : "1024Mi" }, "requests" : { "cpu" : "500m", "memory" : "1024Mi" } } } ], "imagePullSecrets" : [ { "name" : "imagepull-secret" } ] } } } }
  • URI PUT /apis/apps/v1/namespaces/{namespace}/statefulsets/{name} 表1 路径参数 参数 是否必选 参数类型 描述 name 是 String name of the StatefulSet namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 dryRun 否 String When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed fieldManager 否 String fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. pretty 否 String If 'true', then the output is pretty printed.
  • 功能介绍 替换StatefulSet。 The following fields can be updated: metadata.labels metadata.annotations spec.template spec.replicas spec.revisionHistoryLimit spec.progressDeadlineSeconds The other fields cannot be updated.
  • 状态码 状态码 描述 200 OK 201 Created 400 BadRequest 401 Unauthorized 403 Forbidden 404 NotFound 405 MethodNotAllowed 406 NotAcceptable 409 Conflict 415 UnsupportedMediaType 422 Invalid 429 TooManyRequests 500 InternalError 503 ServiceUnavailable 504 ServerTimeout
  • 请求示例 将Ingress的servicePort由"8080"替换为"8081"。 { "apiVersion" : "extensions/v1beta1", "kind" : "Ingress", "metadata" : { "annotations" : { "kubernetes.io/elb.id" : "2d48d034-6046-48db-8bb2-53c67e8148b5", "kubernetes.io/elb.ip" : "192.168.137.182", "kubernetes.io/elb.port" : "6071" }, "labels" : { "app" : "redis", "isExternal" : "true", "zone" : "data" }, "name" : "redis" }, "spec" : { "rules" : [ { "http" : { "paths" : [ { "backend" : { "serviceName" : "redis", "servicePort" : 8081 }, "path" : "/" } ] } } ] } }
  • 响应示例 状态码: 200 OK { "apiVersion" : "extensions/v1beta1", "kind" : "Ingress", "metadata" : { "annotations" : { "kubernetes.io/elb.id" : "2d48d034-6046-48db-8bb2-53c67e8148b5", "kubernetes.io/elb.ip" : "192.168.137.182", "kubernetes.io/elb.port" : "6071" }, "creationTimestamp" : "2018-09-04T02:16:14Z", "generation" : 2, "labels" : { "app" : "redis", "isExternal" : "true", "zone" : "data" }, "name" : "redis", "namespace" : "namespace-test", "resourceVersion" : "5162744", "selfLink" : "/apis/extensions/v1beta1/namespaces/namespace-test/ingresses/redis", "uid" : "7f86c310-afe8-11e8-b6ef-f898ef6c78b4" }, "spec" : { "rules" : [ { "http" : { "paths" : [ { "backend" : { "serviceName" : "redis", "servicePort" : 8081 }, "path" : "/" } ] } } ] }, "status" : { "loadBalancer" : { "ingress" : [ { "ip" : "192.168.137.182" } ] } } }
  • URI PUT /apis/extensions/v1beta1/namespaces/{namespace}/ingresses/{name} 表1 路径参数 参数 是否必选 参数类型 描述 name 是 String name of the Ingress namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 dryRun 否 String When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed fieldManager 否 String fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. pretty 否 String If 'true', then the output is pretty printed.
  • 请求示例 { "apiVersion" : "extensions/v1beta1", "kind" : "Ingress", "metadata" : { "annotations" : { "kubernetes.io/elb.id" : "2d48d034-6046-48db-8bb2-53c67e8148b5", "kubernetes.io/elb.ip" : "192.168.137.182", "kubernetes.io/elb.port" : "6071" }, "labels" : { "app" : "redis" }, "name" : "redis" }, "spec" : { "rules" : [ { "http" : { "paths" : [ { "backend" : { "serviceName" : "redis", "servicePort" : 8080 }, "path" : "/" } ] } } ] } }
  • 响应示例 状态码: 200 OK { "apiVersion" : "extensions/v1beta1", "kind" : "Ingress", "metadata" : { "annotations" : { "kubernetes.io/elb.id" : "2d48d034-6046-48db-8bb2-53c67e8148b5", "kubernetes.io/elb.port" : "6071" }, "creationTimestamp" : "2018-09-04T02:16:14Z", "generation" : 1, "labels" : { "app" : "redis", "isExternal" : "true", "zone" : "data" }, "name" : "redis", "namespace" : "namespace-test", "resourceVersion" : "5161127", "selfLink" : "/apis/extensions/v1beta1/namespaces/namespace-test/ingresses/redis", "uid" : "7f86c310-afe8-11e8-b6ef-f898ef6c78b4" }, "spec" : { "rules" : [ { "http" : { "paths" : [ { "backend" : { "serviceName" : "redis", "servicePort" : 8080 }, "path" : "/" } ] } } ] }, "status" : { "loadBalancer" : { } } }
  • 状态码 状态码 描述 200 OK 201 Created 202 Accepted 400 BadRequest 401 Unauthorized 403 Forbidden 404 NotFound 405 MethodNotAllowed 406 NotAcceptable 409 AlreadyExists 415 UnsupportedMediaType 422 Invalid 429 TooManyRequests 500 InternalError 503 ServiceUnavailable 504 ServerTimeout
  • URI POST /apis/extensions/v1beta1/namespaces/{namespace}/ingresses 表1 路径参数 参数 是否必选 参数类型 描述 namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 dryRun 否 String When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed fieldManager 否 String fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. pretty 否 String If 'true', then the output is pretty printed.
  • 功能介绍 创建Ingress,使用http协议,关联的后端Service为“redis:8080”,使用ELB作为Ingress控制器,ELB的ip为192.168.137.182,端口号为6071。 说明: 若需要在CCI工作负载详情页面的“访问方式”页签中显示对应的Ingress资源,则需要给创建的Ingress资源对象添加labels标签。添加的标签需满足如下要求: service的labels中设置的标签必须和负载的selector中matchLabels设置的label一致。 例如,负载中matchLabels标s签设置如下: "spec": { "replicas": 1, "selector": { "matchLabels": { "app": "redis" } } service中的labels也必须设置为**"app": "redis"**: "metadata": { "name": "redis", "labels": { "app": "redis" } ingress中定义的serviceName必须和service中定义的名称一致。
  • 响应示例 状态码: 200 OK { "apiVersion" : "v1", "kind" : "APIGroup", "name" : "apps", "preferredVersion" : { "groupVersion" : "apps/v1", "version" : "v1" }, "versions" : [ { "groupVersion" : "apps/v1", "version" : "v1" } ] }
  • 状态码 状态码 描述 200 OK 400 BadRequest 401 Unauthorized 403 Forbidden 404 NotFound 405 MethodNotAllowed 406 NotAcceptable 409 Conflict 415 UnsupportedMediaType 422 Invalid 429 TooManyRequests 500 InternalError 503 ServiceUnavailable 504 ServerTimeout
  • 响应参数 状态码: 200 表2 响应Body参数 参数 参数类型 描述 apiVersion String APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources kind String Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds name String name is the name of the group. preferredVersion io.k8s.apimachinery.pkg.apis.meta.v1.GroupVersionForDiscovery object preferredVersion is the version preferred by the API server, which probably is the storage version. serverAddressByClientCIDRs Array of io.k8s.apimachinery.pkg.apis.meta.v1.ServerAddressByClientCIDR objects a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP. versions Array of io.k8s.apimachinery.pkg.apis.meta.v1.GroupVersionForDiscovery objects versions are the versions supported in this group. 表3 io.k8s.apimachinery.pkg.apis.meta.v1.GroupVersionForDiscovery 参数 参数类型 描述 groupVersion String groupVersion specifies the API group and version in the form "group/version" version String version specifies the version in the form of "version". This is to save the clients the trouble of splitting the GroupVersion. 表4 io.k8s.apimachinery.pkg.apis.meta.v1.ServerAddressByClientCIDR 参数 参数类型 描述 clientCIDR String The CIDR with which clients can match their IP to figure out the server address that they should use. serverAddress String Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port.
  • 状态码 状态码 描述 200 OK 400 BadRequest 401 Unauthorized 403 Forbidden 404 NotFound 405 MethodNotAllowed 406 NotAcceptable 409 Conflict 415 UnsupportedMediaType 422 Invalid 429 TooManyRequests 500 InternalError 503 ServiceUnavailable 504 ServerTimeout
  • 请求参数 表3 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 Content-Type 是 String 目前支持三种类型的PATCH请求方法的操作,参考《使用JSON合并patch更新Deployment》。 Json Patch, Content-Type: application/json-patch+json 在RFC6902协议的定义中,Json Patch包含一系列对目标JSON对象的操作,其本身也为JSON对象。服务器接收到该对象后,会将其表示的操作应用于目标JSON对象。 Merge Patch, Content-Type: application/merge-patch+json 在RFC7386协议的定义中,Merge Patch必须包含对一个资源对象的部分描述,即为JSON对象。该JSON对象被提交到服务端后与服务端的当前对象合并,即替换当前资源对象中的列表域,从而创建一个新的对象。 Strategic Merge Patch, Content-Type: application/strategic-merge-patch+json Strategic Merge Patch是添加合法的元数据到API对象中,并通过这些新的元数据来决定哪个列表被合并,哪个列表不该被合并。当前这些元数据则作为结构标签。 表4 请求Body参数 参数 是否必选 参数类型 描述 - 是 Object Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.
  • 响应示例 状态码: 200 OK { "apiVersion" : "v1", "data" : { "property_1" : "test", "property_2" : "test" }, "kind" : "ConfigMap", "metadata" : { "creationTimestamp" : "2018-09-04T03:11:29Z", "name" : "configmap-test", "namespace" : "namespace-test", "resourceVersion" : "5171481", "selfLink" : "/api/v1/namespaces/namespace-test/configmaps/configmap-test", "uid" : "379519a3-aff0-11e8-8f17-c81fbe371a17" } }
  • URI PATCH /api/v1/namespaces/{namespace}/configmaps/{name} 表1 路径参数 参数 是否必选 参数类型 描述 name 是 String name of the ConfigMap namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 dryRun 否 String When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed fieldManager 否 String fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). force 否 Boolean Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. pretty 否 String If 'true', then the output is pretty printed.
  • 状态码 状态码 描述 200 OK 201 Created 400 BadRequest 401 Unauthorized 403 Forbidden 404 NotFound 405 MethodNotAllowed 406 NotAcceptable 409 Conflict 415 UnsupportedMediaType 422 Invalid 429 TooManyRequests 500 InternalError 503 ServiceUnavailable 504 ServerTimeout
  • 响应示例 状态码: 200 OK { "apiVersion" : "v1", "data" : { "key1" : "MWYyZDFlMmU2N2Rm", "test" : "dGVzdA==" }, "kind" : "Secret", "metadata" : { "creationTimestamp" : "2018-09-04T03:59:19Z", "name" : "secret-test", "namespace" : "namespace-test", "resourceVersion" : "5199399", "selfLink" : "/api/v1/namespaces/namespace-test/secrets/secret-test", "uid" : "e6170b6d-aff6-11e8-8f17-c81fbe371a17" }, "type" : "Opaque" }
  • 请求示例 将已创建Secret中的key2替换为"test"。 { "apiVersion" : "v1", "data" : { "key1" : "MWYyZDFlMmU2N2Rm", "test" : "dGVzdA==" }, "kind" : "Secret", "metadata" : { "name" : "secret-test" }, "type" : "Opaque" }
  • URI PUT /api/v1/namespaces/{namespace}/secrets/{name} 表1 路径参数 参数 是否必选 参数类型 描述 name 是 String name of the Secret namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 dryRun 否 String When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed fieldManager 否 String fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. pretty 否 String If 'true', then the output is pretty printed.
  • 状态码 状态码 描述 200 OK 400 BadRequest 401 Unauthorized 403 Forbidden 404 NotFound 405 MethodNotAllowed 406 NotAcceptable 409 Conflict 415 UnsupportedMediaType 422 Invalid 429 TooManyRequests 500 InternalError 503 ServiceUnavailable 504 ServerTimeout
  • 状态码 状态码 描述 200 OK 400 BadRequest 401 Unauthorized 403 Forbidden 404 NotFound 405 MethodNotAllowed 406 NotAcceptable 409 Conflict 415 UnsupportedMediaType 422 Invalid 429 TooManyRequests 500 InternalError 503 ServiceUnavailable 504 ServerTimeout
  • 响应示例 状态码: 200 OK { "apiVersion" : "v1", "groupVersion" : "batch/v1beta1", "kind" : "APIResourceList", "resources" : [ { "categories" : [ "all" ], "kind" : "CronJob", "name" : "cronjobs", "namespaced" : true, "shortNames" : [ "cj" ], "singularName" : "", "storageVersionHash" : "h/JlFAZkyyY=", "verbs" : [ "create", "delete", "deletecollection", "get", "list", "patch", "update", "watch" ] } ] }
  • 响应参数 状态码: 200 表2 响应Body参数 参数 参数类型 描述 apiVersion String APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources groupVersion String groupVersion is the group and version this APIResourceList is for. kind String Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds resources Array of io.k8s.apimachinery.pkg.apis.meta.v1.APIResource objects resources contains the name of the resources and if they are namespaced. 表3 io.k8s.apimachinery.pkg.apis.meta.v1.APIResource 参数 参数类型 描述 categories Array of strings categories is a list of the grouped resources this resource belongs to (e.g. 'all') group String group is the preferred group of the resource. Empty implies the group of the containing resource list. For subresources, this may have a different value, for example: Scale". kind String kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo') name String name is the plural name of the resource. namespaced Boolean namespaced indicates if a resource is namespaced or not. shortNames Array of strings shortNames is a list of suggested short names of the resource. singularName String singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. The singularName is more correct for reporting status on a single item and both singular and plural are allowed from the kubectl CLI interface. storageVersionHash String The hash value of the storage version, the version this resource is converted to when written to the data store. Value must be treated as opaque by clients. Only equality comparison on the value is valid. This is an alpha feature and may change or be removed in the future. The field is populated by the apiserver only if the StorageVersionHash feature gate is enabled. This field will remain optional even if it graduates. verbs Array of strings verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy) version String version is the preferred version of the resource. Empty implies the version of the containing resource list For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)".
  • 状态码 状态码 描述 200 OK 400 BadRequest 401 Unauthorized 403 Forbidden 404 NotFound 405 MethodNotAllowed 406 NotAcceptable 409 Conflict 415 UnsupportedMediaType 422 Invalid 429 TooManyRequests 500 InternalError 503 ServiceUnavailable 504 ServerTimeout
  • 请求参数 表3 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 Content-Type 是 String 目前支持三种类型的PATCH请求方法的操作,参考《使用JSON合并patch更新Deployment》。 Json Patch, Content-Type: application/json-patch+json 在RFC6902协议的定义中,Json Patch包含一系列对目标JSON对象的操作,其本身也为JSON对象。服务器接收到该对象后,会将其表示的操作应用于目标JSON对象。 Merge Patch, Content-Type: application/merge-patch+json 在RFC7386协议的定义中,Merge Patch必须包含对一个资源对象的部分描述,即为JSON对象。该JSON对象被提交到服务端后与服务端的当前对象合并,即替换当前资源对象中的列表域,从而创建一个新的对象。 Strategic Merge Patch, Content-Type: application/strategic-merge-patch+json Strategic Merge Patch是添加合法的元数据到API对象中,并通过这些新的元数据来决定哪个列表被合并,哪个列表不该被合并。当前这些元数据则作为结构标签。 表4 请求Body参数 参数 是否必选 参数类型 描述 - 是 Object Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.
  • URI PATCH /apis/batch/v1/namespaces/{namespace}/jobs/{name} 表1 路径参数 参数 是否必选 参数类型 描述 name 是 String name of the Job namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 dryRun 否 String When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed fieldManager 否 String fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). force 否 Boolean Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. pretty 否 String If 'true', then the output is pretty printed.
共100000条