云服务器内容精选

  • 创建静态EIPPool 静态EIPPool,即根据用户指定的多个未使用的EIP,静态纳管底层的EIP资源,同时在CCI命名空间下创建相应的EIP对象。如果EIPPool中的EIP已经被NAT或者ELB使用,则会纳管失败。 以下示例创建了一个名为eippool-demo2的静态EIPPool,并在此EIPPool中纳管10.246.173.254和10.246.172.3两个公网IP。示例如下: apiVersion: crd.yangtse.cni/v1 kind: EIPPool # 创建的对象类别 metadata: # 资源对象的元数据定义 name:eippool-demo2 spec: # EIPPool的配置信息 eips: # 纳管的公网IP - 10.246.173.254 - 10.246.172.3 父主题: 创建EIPPool
  • 更新EIPPool 考虑到用户实际场景,EIPPool对象当前只允许用户调整EIP的数量,即对EIPPool进行扩缩容。用户如果需要调整EIP其他参数,可新建EIPPool对象后在负载配置中替换即可。 EIPPool缩容时,如果EIP资源被占用,则不会删除对应的EIP,直到占用解除。 以动态创建的eippool-demo1为例,将amount:3改为amount: 5。 apiVersion: crd.yangtse.cni/v1 kind: EIPPool metadata: name: eippool-demo1 namespace: xxx spec: amount: 5 # EIP资源池中的EIP数量 eipAttributes: # EIP的一些属性 ... 执行以下命令,查看EIPPool详情,-n表示EIPPool所在的命名空间。 回显信息中名称为eippool-demo1的EIPPool,USAGE由0/3更新为0/5,表示EIPPool更新成功。 # kubectl get eippool -n $namespace_name NAME EIPS USAGE AGE eippool-demo1 0/5 39m
  • 状态码 状态码 描述 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" : "crd.yangtse.cni/v1", "kind" : "EIPPool", "metadata" : { "creationTimestamp" : "2022-09-07T01:22:50Z", "finalizers" : [ "yangtse.io/eip-pool" ], "generation" : 1, "labels" : { "some-key" : "some-value" }, "name" : "eippool-test", "namespace" : "namespace-test", "resourceVersion" : "42396258", "selfLink" : "/apis/crd.yangtse.cni/v1/namespaces/namespace-test/eippools/eippool-test", "uid" : "e4dc5432-1d9b-4fcb-8840-ee445b6511ae" }, "spec" : { "amount" : 1, "eipAttributes" : { "bandwidth" : { "chargeMode" : "bandwidth", "name" : "eip-test", "shareType" : "PER", "size" : 5 }, "ipVersion" : 4, "networkType" : "5_g-vm" } }, "status" : { "eips" : [ { "alias" : "eip-test", "bandWidthChargeMode" : "bandwidth", "bandwidthShareType" : "PER", "bandwidthSize" : 5, "id" : "034a0bae-81f7-46f4-b933-3273adc32b54", "ipv4" : "100.85.221.2", "networkType" : "5_g-vm", "status" : "DOWN" } ], "usage" : "0/1" } }
  • URI PATCH /apis/crd.yangtse.cni/v1/namespaces/{namespace}/eippools/{name} 表1 路径参数 参数 是否必选 参数类型 描述 name 是 String name of the EIPPool 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.
  • URI GET /apis/crd.yangtse.cni/v1/namespaces/{namespace}/eippools/{name}/status 表1 路径参数 参数 是否必选 参数类型 描述 name 是 String name of the EIPPool namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 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 pretty 否 String If 'true', then the output is pretty printed.
  • 响应示例 状态码: 200 OK { "apiVersion" : "crd.yangtse.cni/v1", "kind" : "EIPPool", "metadata" : { "creationTimestamp" : "2022-09-07T01:22:50Z", "finalizers" : [ "yangtse.io/eip-pool" ], "generation" : 1, "name" : "eippool-test", "namespace" : "namespace-test", "resourceVersion" : "42396258", "selfLink" : "/apis/crd.yangtse.cni/v1/namespaces/namespace-test/eippools/eippool-test", "uid" : "e4dc5432-1d9b-4fcb-8840-ee445b6511ae" }, "spec" : { "amount" : 1, "eipAttributes" : { "bandwidth" : { "chargeMode" : "bandwidth", "name" : "eip-test", "shareType" : "PER", "size" : 5 }, "ipVersion" : 4, "networkType" : "5_g-vm" } }, "status" : { "eips" : [ { "alias" : "eip-test", "bandWidthChargeMode" : "bandwidth", "bandwidthShareType" : "PER", "bandwidthSize" : 5, "id" : "034a0bae-81f7-46f4-b933-3273adc32b54", "ipv4" : "100.85.221.2", "networkType" : "5_g-vm", "status" : "DOWN" } ], "usage" : "0/1" } }
  • 状态码 状态码 描述 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