华为云用户手册

  • 响应示例 状态码: 200 OK { "apiVersion" : "apps/v1", "items" : [ { "metadata" : { "creationTimestamp" : "2018-09-04T07:13:00Z", "generation" : 1, "labels" : { "app" : "statefulset-test" }, "name" : "statefulset-test", "namespace" : "namespace-test", "resourceVersion" : "5209881", "selfLink" : "/apis/apps/v1/namespaces/namespace-test/statefulsets/statefulset-test", "uid" : "f4a35f35-b011-11e8-b6ef-f898ef6c78b4" }, "spec" : { "podManagementPolicy" : "OrderedReady", "replicas" : 3, "revisionHistoryLimit" : 10, "selector" : { "matchLabels" : { "app" : "statefulset-test" } }, "serviceName" : "", "template" : { "metadata" : { "annotations" : { "cri.cci.io/container-type" : "secure-container" }, "creationTimestamp" : null, "labels" : { "app" : "statefulset-test" } }, "spec" : { "containers" : [ { "image" : "redis", "imagePullPolicy" : "IfNotPresent", "name" : "container-0", "resources" : { "limits" : { "cpu" : "500m", "memory" : "1Gi" }, "requests" : { "cpu" : "500m", "memory" : "1Gi" } }, "terminationMessagePath" : "/dev/termination-log", "terminationMessagePolicy" : "File" } ], "dnsPolicy" : "ClusterFirst", "imagePullSecrets" : [ { "name" : "imagepull-secret" } ], "restartPolicy" : "Always", "schedulerName" : "default-scheduler", "securityContext" : { } } }, "updateStrategy" : { "type" : "OnDelete" } }, "status" : { "collisionCount" : 0, "currentReplicas" : 3, "currentRevision" : "statefulset-test-f986b645b", "observedGeneration" : 1, "readyReplicas" : 2, "replicas" : 3, "updateRevision" : "statefulset-test-f986b645b" } } ], "kind" : "StatefulSetList", "metadata" : { "resourceVersion" : "5215730", "selfLink" : "/apis/apps/v1/namespaces/namespace-test/statefulsets" } }
  • URI GET /apis/apps/v1/namespaces/{namespace}/statefulsets 表1 路径参数 参数 是否必选 参数类型 描述 namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 allowWatchBookmarks 否 Boolean allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. continue 否 String The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. fieldSelector 否 String A selector to restrict the list of returned objects by their fields. Defaults to everything. labelSelector 否 String A selector to restrict the list of returned objects by their labels. Defaults to everything. limit 否 Integer limit is a maximum number of responses to return for a list call. If more items exist, the server will set the continue field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. resourceVersion 否 String resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset resourceVersionMatch 否 String resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset timeoutSeconds 否 Integer Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. watch 否 Boolean Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. pretty 否 String If 'true', then the output is pretty printed.
  • 响应示例 状态码: 200 OK { "apiVersion" : "v1", "items" : [ { "metadata" : { "annotations" : { "cri.cci.io/container-type" : "secure-container", "kubernetes.io/availablezone" : "dc1", "network.alpha.kubernetes.io/network" : "[{\"name\":\"namespace-test-dc1-default-network\",\"interface\":\"eth0\",\"network_plane\":\"default\"}]" }, "creationTimestamp" : "2018-09-03T12:26:12Z", "labels" : { "name" : "pod-test" }, "name" : "pod-test", "namespace" : "namespace-test", "resourceVersion" : "5030610", "selfLink" : "/api/v1/namespaces/namespace-test/pods/pod-test", "uid" : "8b985a27-af74-11e8-9d5d-c88d83be759f" }, "spec" : { "containers" : [ { "image" : "redis", "imagePullPolicy" : "Always", "name" : "test", "resources" : { "limits" : { "cpu" : "500m", "memory" : "1Gi" }, "requests" : { "cpu" : "500m", "memory" : "1Gi" } }, "terminationMessagePath" : "/dev/termination-log", "terminationMessagePolicy" : "File" } ], "dnsPolicy" : "ClusterFirst", "imagePullSecrets" : [ { "name" : "imagepull-secret" } ], "nodeName" : "c0dd6256-195a-e811-90a2-10c17294fcbc", "restartPolicy" : "Always", "schedulerName" : "default-scheduler", "securityContext" : { }, "tolerations" : [ { "effect" : "NoExecute", "key" : "node.kubernetes.io/not-ready", "operator" : "Exists", "tolerationSeconds" : 300 }, { "effect" : "NoExecute", "key" : "node.kubernetes.io/unreachable", "operator" : "Exists", "tolerationSeconds" : 300 } ] }, "status" : { "conditions" : [ { "lastProbeTime" : null, "lastTransitionTime" : "2018-09-03T12:26:12Z", "status" : "True", "type" : "Initialized" }, { "lastProbeTime" : null, "lastTransitionTime" : "2018-09-03T12:26:16Z", "status" : "True", "type" : "Ready" }, { "lastProbeTime" : null, "lastTransitionTime" : "2018-09-03T12:26:12Z", "status" : "True", "type" : "PodScheduled" } ], "containerStatuses" : [ { "containerID" : "docker://aee55d8dedb8371f96aa5d5116f69a53bf1cb23afe1802567c24081514d3b048", "image" : "redis", "imageID" : "docker-pullable://redis@sha256:3ab7046bd035a47aa06963d8240651d00b57e82dab07ba374ad01f84dfa1230c", "lastState" : { }, "name" : "test", "ready" : true, "restartCount" : 0, "state" : { "running" : { "startedAt" : "2018-09-03T12:26:16Z" } } } ], "phase" : "Running", "podIP" : "192.168.245.185", "qosClass" : "Guaranteed", "startTime" : "2018-09-03T12:26:12Z" } } ], "kind" : "PodList", "metadata" : { "resourceVersion" : "5032373", "selfLink" : "/api/v1/namespaces/namespace-test/pods" } }
  • URI GET /api/v1/namespaces/{namespace}/pods 表1 路径参数 参数 是否必选 参数类型 描述 namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 allowWatchBookmarks 否 Boolean allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. continue 否 String The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. fieldSelector 否 String A selector to restrict the list of returned objects by their fields. Defaults to everything. labelSelector 否 String A selector to restrict the list of returned objects by their labels. Defaults to everything. limit 否 Integer limit is a maximum number of responses to return for a list call. If more items exist, the server will set the continue field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. resourceVersion 否 String resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset resourceVersionMatch 否 String resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset timeoutSeconds 否 Integer Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. watch 否 Boolean Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. 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" : "batch/v1", "kind" : "Job", "metadata" : { "creationTimestamp" : "2018-09-05T01:10:59Z", "labels" : { "controller-uid" : "8c923079-b0a8-11e8-8bcb-f898ef6c78b4", "job-name" : "pi" }, "name" : "pi", "namespace" : "namespace-test", "resourceVersion" : "5391205", "selfLink" : "/apis/batch/v1/namespaces/namespace-test/jobs/pi/status", "uid" : "8c923079-b0a8-11e8-8bcb-f898ef6c78b4" }, "spec" : { "backoffLimit" : 6, "completions" : 1, "parallelism" : 1, "selector" : { "matchLabels" : { "controller-uid" : "8c923079-b0a8-11e8-8bcb-f898ef6c78b4" } }, "template" : { "metadata" : { "annotations" : { "cri.cci.io/container-type" : "secure-container" }, "creationTimestamp" : null, "labels" : { "controller-uid" : "8c923079-b0a8-11e8-8bcb-f898ef6c78b4", "job-name" : "pi" }, "name" : "pi" }, "spec" : { "containers" : [ { "command" : [ "perl", "-Mbignum=bpi", "-wle", "print bpi(2000)" ], "image" : "perl", "imagePullPolicy" : "Always", "name" : "pi", "resources" : { "limits" : { "cpu" : "500m", "memory" : "1Gi" }, "requests" : { "cpu" : "500m", "memory" : "1Gi" } }, "terminationMessagePath" : "/dev/termination-log", "terminationMessagePolicy" : "File" } ], "dnsPolicy" : "ClusterFirst", "imagePullSecrets" : [ { "name" : "imagepull-secret" } ], "restartPolicy" : "Never", "schedulerName" : "default-scheduler", "securityContext" : { } } } }, "status" : { "active" : 1, "startTime" : "2018-09-05T01:10:59Z" } }
  • URI GET /apis/batch/v1/namespaces/{namespace}/jobs/{name}/status 表1 路径参数 参数 是否必选 参数类型 描述 name 是 String name of the Job namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 pretty 否 String If 'true', then the output is pretty printed.
  • 响应参数 状态码: 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 { "apiVersion" : "v1", "kind" : "APIGroup", "name" : "networking.cci.io", "preferredVersion" : { "groupVersion" : "networking.cci.io/v1beta1", "version" : "v1beta1" }, "versions" : [ { "groupVersion" : "networking.cci.io/v1beta1", "version" : "v1beta1" } ] }
  • 状态码 状态码 描述 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", "kind" : "Service", "metadata" : { "creationTimestamp" : "2018-09-04T00:45:36Z", "labels" : { "app" : "redis" }, "name" : "redis", "namespace" : "namespace-test", "resourceVersion" : "5146412", "selfLink" : "/api/v1/namespaces/namespace-test/services/redis/status", "uid" : "d6a1ce79-afdb-11e8-b6ef-f898ef6c78b4" }, "spec" : { "clusterIP" : "10.247.212.210", "ports" : [ { "name" : "service0", "port" : 8080, "protocol" : "TCP", "targetPort" : 80 } ], "selector" : { "app" : "redis" }, "sessionAffinity" : "None", "type" : "ClusterIP" }, "status" : { "loadBalancer" : { } } }
  • URI GET /api/v1/namespaces/{namespace}/services/{name}/status 表1 路径参数 参数 是否必选 参数类型 描述 name 是 String name of the Service namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 pretty 否 String If 'true', then the output is pretty printed.
  • 响应示例 状态码: 200 OK { "apiVersion" : "apps/v1beta1", "items" : [ { "metadata" : { "creationTimestamp" : "2017-04-18T06:05:02Z", "generateName" : "sz", "generation" : 1, "labels" : { "app" : "mysql" }, "name" : "mysql", "namespace" : "default", "resourceVersion" : "1809843", "selfLink" : "/apis/apps/v1beta1/namespaces/default/statefulsets/mysql", "uid" : "f5cf50f5-23fc-11e7-9c83-fa163ec08232" }, "spec" : { "replicas" : 1, "selector" : { "matchLabels" : { "app" : "mysql" } }, "serviceName" : "mysql-service", "template" : { "metadata" : { "creationTimestamp" : null, "labels" : { "app" : "mysql" }, "name" : "-sz" }, "spec" : { "containers" : [ { "image" : "10.154.52.159:443/test/nginx:latest", "imagePullPolicy" : "IfNotPresent", "name" : "container01", "ports" : [ { "containerPort" : 80, "protocol" : "TCP" } ], "resources" : { }, "terminationMessagePath" : "/dev/termination-log" } ], "dnsPolicy" : "ClusterFirst", "restartPolicy" : "Always", "securityContext" : { } } }, "volumeClaimTemplates" : [ { "metadata" : { "creationTimestamp" : null, "name" : "db" }, "spec" : { "accessModes" : [ "ReadWriteOnce" ], "resources" : { "requests" : { "storage" : "1Gi" } } }, "status" : { "phase" : "Pending" } } ] }, "status" : { "replicas" : 1 } } ], "kind" : "StatefulSetList", "metadata" : { "resourceVersion" : "1809953", "selfLink" : "/apis/apps/v1beta1/statefulsets" } }
  • 状态码 状态码 描述 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
  • URI GET /apis/apps/v1/statefulsets 表1 Query参数 参数 是否必选 参数类型 描述 allowWatchBookmarks 否 Boolean allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. continue 否 String The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. fieldSelector 否 String A selector to restrict the list of returned objects by their fields. Defaults to everything. labelSelector 否 String A selector to restrict the list of returned objects by their labels. Defaults to everything. limit 否 Integer limit is a maximum number of responses to return for a list call. If more items exist, the server will set the continue field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. pretty 否 String If 'true', then the output is pretty printed. resourceVersion 否 String resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset resourceVersionMatch 否 String resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset timeoutSeconds 否 Integer Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. watch 否 Boolean Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
  • 状态码 状态码 描述 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" : "extensions/v1beta1", "items" : [ { "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" : 1, "labels" : { "app" : "redis", "isExternal" : "true", "zone" : "data" }, "name" : "redis", "namespace" : "namespace-test", "resourceVersion" : "5161128", "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" : { "ingress" : [ { "ip" : "192.168.137.182" } ] } } } ], "kind" : "IngressList", "metadata" : { "resourceVersion" : "5161998", "selfLink" : "/apis/extensions/v1beta1/namespaces/namespace-test/ingresses" } }
  • URI GET /apis/extensions/v1beta1/namespaces/{namespace}/ingresses 表1 路径参数 参数 是否必选 参数类型 描述 namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 allowWatchBookmarks 否 Boolean allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. continue 否 String The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. fieldSelector 否 String A selector to restrict the list of returned objects by their fields. Defaults to everything. labelSelector 否 String A selector to restrict the list of returned objects by their labels. Defaults to everything. limit 否 Integer limit is a maximum number of responses to return for a list call. If more items exist, the server will set the continue field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. resourceVersion 否 String resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset resourceVersionMatch 否 String resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset timeoutSeconds 否 Integer Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. watch 否 Boolean Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. pretty 否 String If 'true', then the output is pretty printed.
  • AK/SK认证 AK/SK签名认证方式仅支持消息体大小在12MB以内,12MB以上的请求请使用Token认证。 AK/SK认证就是使用AK/SK对请求进行签名,在请求时将签名信息添加到消息头,从而通过身份认证。 AK(Access Key ID):访问密钥ID。与私有访问密钥关联的唯一标识符;访问密钥ID和私有访问密钥一起使用,对请求进行加密签名。 SK(Secret Access Key):私有访问密钥。与访问密钥ID结合使用,对请求进行加密签名,可标识发送方,并防止请求被修改。 使用AK/SK认证时,您可以基于签名算法使用AK/SK对请求进行签名,也可以使用专门的签名SDK对请求进行签名。详细的签名方法和SDK使用方法请参见API签名指南。 签名SDK只提供签名功能,与服务提供的SDK不同,使用时请注意。
  • Token认证 Token的有效期为24小时,需要使用一个Token鉴权时,可以先缓存起来,避免频繁调用。 Token在计算机系统中代表令牌(临时)的意思,拥有Token就代表拥有某种权限。Token认证就是在调用API的时候将Token加到请求消息头中,从而通过身份认证,获得操作API的权限。Token可通过调用获取用户Token接口获取。 调用本服务API需要项目级别的Token,即调用获取用户Token接口时,请求body中auth.scope的取值需要选择project,如下所示。 { "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": "username", // IAM 用户名 "password": "********", //IAM用户密码 "domain": { "name": "domainname" //IAM用户所属账号名 } } } }, "scope": { "project": { "name": "xxxxxxxx" //项目名称 } } } } 获取Token 后,再调用其他接口时,您需要在请求消息头中添加“X-Auth-Token”,其值即为Token。例如Token值为“ABCDEFJ....”,则调用接口时将“X-Auth-Token: ABCDEFJ....”加到请求消息头即可,如下所示。 1 2 3 POST https://iam.cn-north-1.myhuaweicloud.com/v3/auth/projects Content-Type: application/json X-Auth-Token: ABCDEFJ.... 您还可以通过这个视频教程了解如何使用Token认证:https://bbs.huaweicloud.com/videos/101333。
  • 响应示例 状态码: 201 Created { "apiVersion" : "v1", "kind" : "Pod", "metadata" : { "annotations" : { "cri.cci.io/container-type" : "secure-container" }, "creationTimestamp" : "2022-08-30T03:14:15Z", "finalizers" : [ "billing.kubernetes.io/podbilling-finalizer" ], "labels" : { "name" : "pod-test", "tenant.kubernetes.io/domain-id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, "name" : "pod-test", "namespace" : "test", "resourceVersion" : "33742743", "selfLink" : "/api/v1/namespaces/test/pods/pod-test", "uid" : "c0f9820e-188c-4612-be69-b9c65c8bdb5a" }, "spec" : { "containers" : [ { "image" : "redis", "imagePullPolicy" : "Always", "name" : "test", "resources" : { "limits" : { "cpu" : "500m", "memory" : "1Gi" }, "requests" : { "cpu" : "500m", "memory" : "1Gi" } }, "terminationMessagePath" : "/dev/termination-log", "terminationMessagePolicy" : "File" } ], "dnsPolicy" : "Default", "enableServiceLinks" : false, "imagePullSecrets" : [ { "name" : "imagepull-secret" } ], "nodeSelector" : { "node.cci.io/default-cpu-choice" : "true", "node.cci.io/flavor" : "general-computing" }, "priority" : 0, "restartPolicy" : "Always", "runtimeClassName" : "kata", "schedulerName" : "volcano", "securityContext" : { }, "terminationGracePeriodSeconds" : 30, "tolerations" : [ { "effect" : "NoExecute", "key" : "node.kubernetes.io/not-ready", "operator" : "Exists", "tolerationSeconds" : 300 }, { "effect" : "NoExecute", "key" : "node.kubernetes.io/unreachable", "operator" : "Exists", "tolerationSeconds" : 300 }, { "effect" : "NoSchedule", "key" : "node.cci.io/occupied", "operator" : "Equal", "value" : "default" }, { "effect" : "NoSchedule", "key" : "node.cci.io/allowed-on-shared-node", "operator" : "Exists" }, { "effect" : "NoSchedule", "key" : "node.kubernetes.io/memory-pressure", "operator" : "Exists" } ] }, "status" : { "phase" : "Pending", "qosClass" : "Guaranteed" } }
  • 状态码 状态码 描述 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 /api/v1/namespaces/{namespace}/pods 表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.
  • 请求示例 创建普通Pod,使用redis镜像,Pod资源占用CPU为0.5,内存为1024Mi。 { "apiVersion" : "v1", "kind" : "Pod", "metadata" : { "labels" : { "name" : "pod-test" }, "name" : "pod-test" }, "spec" : { "containers" : [ { "image" : "redis", "imagePullPolicy" : "Always", "name" : "test", "resources" : { "limits" : { "cpu" : "0.5", "memory" : "1024Mi" }, "requests" : { "cpu" : "0.5", "memory" : "1024Mi" } } } ], "imagePullSecrets" : [ { "name" : "imagepull-secret" } ], "priority" : 0, "restartPolicy" : "Always" } } 创建GPU型Pod,使用gpu-418.126版本显示驱动,使用redis镜像,Pod资源占用CPU为4,内存为32Gi。 说明: “华北-北京四”区域,仅支持NVIDIA TeslaV100 32G显卡。“华东-上海一”可支持NVIDIA TeslaV100 32G、NVIDIA TeslaV100 16G显卡。 { "apiVersion" : "v1", "kind" : "Pod", "metadata" : { "annotations" : { "cri.cci.io/gpu-driver" : "gpu-418.126" }, "labels" : { "name" : "pod-test" }, "name" : "pod-test" }, "spec" : { "containers" : [ { "image" : "redis", "imagePullPolicy" : "Always", "name" : "test", "resources" : { "limits" : { "cpu" : "4", "memory" : "32Gi", "nvidia.com/gpu-tesla-v100-16GB" : "1" }, "requests" : { "cpu" : "4", "memory" : "32Gi", "nvidia.com/gpu-tesla-v100-16GB" : "1" } } } ], "imagePullSecrets" : [ { "name" : "imagepull-secret" } ], "priority" : 0, "restartPolicy" : "Always" } } 通过LVM方式创建本地卷的Pod,容器内卷的挂载路径为“/tmp/log”。 { "apiVersion" : "v1", "kind" : "Pod", "metadata" : { "labels" : { "app" : "localvolume" }, "name" : "localvolume", "namespace" : "cci-namespace-12192721" }, "spec" : { "containers" : [ { "command" : [ "/bin/sh", "-c", "sleep 10000" ], "image" : "100.79.1.215:20202/paas_cci_test/redis:v1", "imagePullPolicy" : "Always", "lifecycle" : { }, "name" : "container-0", "resources" : { "limits" : { "cpu" : "500m", "memory" : "1024Mi" }, "requests" : { "cpu" : "500m", "memory" : "1024Mi" } }, "terminationMessagePath" : "/dev/termination-log", "terminationMessagePolicy" : "File", "volumeMounts" : [ { "mountPath" : "/tmp/log", "name" : "innerevs123" } ] } ], "dnsPolicy" : "Default", "imagePullSecrets" : [ { "name" : "imagepull-secret" } ], "nodeSelector" : { "node.cci.io/allowed-on-poc-dedicated-node" : "sina" }, "restartPolicy" : "Always", "schedulerName" : "default-scheduler", "tolerations" : [ { "effect" : "NoSchedule", "key" : "node.cci.io/allowed-on-poc-dedicated-node", "operator" : "Equal", "value" : "sina" } ], "volumes" : [ { "emptyDir" : { "sizeLimit" : "100Gi" }, "name" : "innerevs123" } ] } }
  • 功能介绍 创建一个Pod。 说明: Pod的生命周期是短暂的,Pod是用后即焚的实体。在实际使用中,请谨慎单独创建Pod,请使用Deployment、StatefulSet和Job这些控制器创建应用,从而保障应用高可用。 云容器实例中Pod规格有限制,具体的限制请参见约束限制页面的“Pod规格”部分。 当前支持使用Nvidia GPU的驱动版本为418.126和460.106,您应用程序中使用的CUDA需满足如下表所示的配套关系。CUDA与驱动的配套关系来源于Nvidia官网,详细信息请参见CUDA Compatibility。 表:NVIDIA GPU驱动与CUDA配套关系 NVIDIA GPU驱动版本 CUDA Toolkit版本 418.126 CUDA 10.1 (10.1.105)及以下 460.106 CUDA 11.2.2 Update 2 及以下 如果选择GPU加速型Pod,您需要设置Pod的metadata.annotations中添加cri.cci.io/gpu-driver字段,指定使用哪个版本显卡驱动,取值如下: gpu-418.126 gpu-460.106 创建Pod时挂载OBS的使用限制请参见挂载OBS使用限制。
  • 状态码 状态码 描述 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" : "apps/v1", "items" : null, "kind" : "DeploymentList", "metadata" : { "resourceVersion" : "5039958", "selfLink" : "/apis/apps/v1/namespaces/namespace-test/deployments" } }
  • URI DELETE /apis/apps/v1/namespaces/{namespace}/deployments 表1 路径参数 参数 是否必选 参数类型 描述 namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 continue 否 String The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. 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 fieldSelector 否 String A selector to restrict the list of returned objects by their fields. Defaults to everything. gracePeriodSeconds 否 Integer The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. labelSelector 否 String A selector to restrict the list of returned objects by their labels. Defaults to everything. limit 否 Integer limit is a maximum number of responses to return for a list call. If more items exist, the server will set the continue field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. orphanDependents 否 Boolean Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. propagationPolicy 否 String Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. resourceVersion 否 String resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset resourceVersionMatch 否 String resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset timeoutSeconds 否 Integer Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. pretty 否 String If 'true', then the output is pretty printed.
共100000条