云服务器内容精选

  • 水平自动伸缩(HPA) 如果业务不需要使用hpa,请不要配置hpa相关参数。hpa开关配置关闭,也会创建hpa资源,只是不会生效扩缩容。 表15 水平自动伸缩(HPA) 参数 说明 是否必填 备注 hpa_scale_disabled 是否禁用hpa,false表示不禁用;true表示禁用。 是 取值为false是开启hpa。 polling_interval 负载检测周期,单位秒。 否 - origin_instances 初始副本数,不配置则使用min_instances值。 否 - min_instances 最小副本数 是 不配置默认为1。 max_instances 最大副本数 是 不配置默认为1。 hpa_scale_triggers 扩缩容指标配置,目前仅支持cpu/memory。 是 仅统计主容器资源。 hpa_scale_up_rules 扩容规则,定义稳定时间窗,减少扩容毛刺。 否 - hpa_scale_down_rules 缩容规则,定义稳定时间窗,减少缩容毛刺。 否 - hpa_scale_up_policies 扩容策略,定义扩容步长。 否 - hpa_scale_down_policies 缩容策略,定义缩容步长。 否 - 示例: 在resources.yaml中添加hpa参数如下: hpa: #弹性伸缩配置 $ref: 'config/hpa.yaml#/recommend' 在config目录,增加一个hpa.yaml文件,存放hpa的相关配置项。 recommend: disabled: true #true表示关闭hpa,false表示开启hpa pollingInterval: 5 #负载检测周期,单位秒 minReplicas: 2 #最小副本数 maxReplicas: 4 #最大副本数 triggers: #业务根据时间情况选择弹性伸缩策略 -type: CPU #业务容器的CPU利用率大于40%则触发扩容条件 metadata: averageUtilization: 40% -type: Memory #业务容器的内存利用率大于60%则触发扩容条件 metadata: averageUtilization: 60%
  • 指定分组和资源标签 表16 指定分组和资源标签 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 resourceTag type = object ({group = stringfeatures = string}) 可选 无 group:指定集群部署的分组。 features:指定集群部署的标签信息。 此处配置的信息要再Runtime页面提前预置好。 resourceTag: group: "common" features: "dev"
  • 灰度策略 表14 灰度策略 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 grayStage type = object({grayInstances = number grayProcess= stringgrayStatus = number }) 可选 null 灰度升级策略配置。 grayInstances:灰度升级的实例数比例,范围为1~100。 grayStatus:灰度实例对接SLB时的状态,1:生产,2:灰度。 grayProcess:灰度状态,只能填"INGRAY"和"FINISHED"。 - grayStage: grayInstances: 50 grayProcess: "INGRAY" grayStatus: 2 示例: - name: WiseCloudFGCEventBuilderService type: WiseCloud::MicroService::NuwaContainer properties: grayStage: grayInstances: 50 grayProcess: "INGRAY" grayStatus: 2
  • 优雅下线 表13 优雅下线 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 preStopConfig type = object({ execCommand = list }) 必选 [] 优雅退出处理 - preStopConfig: execCommand: ["/bin/bash", "-c", "sleep 20"] terminationGracePeriodSeconds int 可选 30 优雅退出宽限时间,此时间为整个POD的最大退出时间。 - terminationGracePeriodSeconds: 30
  • 业务配置 表11 业务配置 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 configs object(private = object( name = string prefix = string version = string schema = object records = object) public = object( name = string prefix = string)) 否 {} 配置项的根字段,包含两个属性,分别是private和public,分别为业务配置项和公共配置项,其下各个字段的描述如下所示。 - 见下文样例 prefix string 否 "" 配置项的归属路径 仅限于publicConfig /public/cloudeye/wiseEyeConfigService schema object(type = string properties = object( key1 = object( type = string description = string format = string))) 否 {} 配置项属性,properties属性为key-object格式,key是配置名称 ,object是配置项各项描述,其中format指配置项类型,默认为notype,如果是敏感配置项为sensitive。 说明: 如果是非敏感配置项,可以不在schema中声明,以减少维护工作量。 仅限于privateConfig 见下文样例 records object(key1 = string key2 = string) 否 {} 描述配置,key-value格式,key为配置名称 ,value为配置值。 value仅支持字符串类型 如果是数字、布尔值、对象和数组,需要加单引号,例:'10'、'true'、'{"test": 1}'、'[1,2]'。 仅限于privateConfig records: test: '{"a":"a","b":"b"}' timeout: '10' enableSa: 'true' name string 否 "" 配置项名称,对应NuwaRuntime的Container[0].configTag,对应PublicConfig和PrivateConfig的name。 说明: 配合动态配置生效,需要nuwa基础镜像版本要保持在3.0.11版本以上,否则报错。 publicConfig/privateConfig均有 限制:8位以内的小写字母和数字 见下文样例 version string 否 "" 配置版本,对应NuwaRuntime的Container[0].configVeersion,对应PrivateConfig的version。 说明: 配合动态配置生效,需要nuwa基础镜像版本要保持在3.0.11版本以上,否则报错。 仅限于privateConfig 见下文样例 示例: # resources.yaml - name: WiseCloudFGCEventBuilderService_cluster1 type: WiseCloud::MicroService::NuwaContainer properties: configs: $ref: 'config/business_config.yaml#' # business_config.yaml public: prefix: /com.huawei.wiseeye name: public5 private: version: 1.0.0 #(配合动态配置生效,需要nuwa基础镜像版本要保持在3.0.11版本以上,否则报错) name: fgcva #(配合动态配置生效,需要nuwa基础镜像版本要保持在3.0.11版本以上,否则报错) schema: type: object properties: AIOPSCONFIG_AIOPSSERVER: # 默认为format: notype,如果非敏感项,可以不填 format: notype # 默认为notype,如果非敏感项,可以不填 AIOPSCONFIG_AIOPSTOKENURI: # 敏感项必须填 format: sensitive # 敏感项必须填 records: # 必填 AIOPSCONFIG_AIOPSSERVER: https://XX.XX.XX.XX:XXXX/ test: '{"a":"a","b":"b"}' # 仅支持字符串类型,[]、{}的值,yaml会识别为对象和数组,必须加单引号 timeout: '10' # 仅支持字符串类型,数字和布尔值也要加引号 enableSa: 'true'
  • 滚动升级策略 表12 滚动升级策略 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 rollingUpdateStrategy type = object({ maxSurge = string maxUnavailable = string }) 可选 maxSurge : "25%" maxUnavailable: 0 滚动升级策略配置 maxSurge:滚动升级时最多可以多启动多少个pod。 maxUnavailable:滚动升级时最大可以删除多少个pod。 整数:最小值为0 百分比:0% ~ 100% 说明: maxSurge和maxUnavailable不能同时为0 maxUnavailable不能设置为100或者100%,避免升级时集群没有可用的pod。 rollingUpdateStrategy: maxSurge = "50%" maxUnavailable = "25%"
  • 网络配置 表7 网络配置 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 isolatedDomain string 可选 - 隔离域 只有CCE_TURBO集群支持,老CCE集群不支持。如果不配置,则使用ENS隔离域规划中对应的隔离域,见上面隔离域说明链接中的说明。 - slbEnable bool 可选 FALSE 是否启用slb “否”仅针对第一次添加SLB信息时有效 说明: 如果之前有部署过,并且配置为“是”,此时再修改为“否”是无效的。 - 示例: - name: WiseCloudFGCEventBuilderService_cluster1 type: WiseCloud::MicroService::NuwaContainer properties: network: slbEnable: true isolatedDomain: $ {创建的隔离 域名 称}
  • SLB配置(可选) 表8 SLB配置 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 port int32 必选 null 微服务在SLB上暴露的端口 - 8080 weight int32 必选 null 微服务在SLB上负载的权重 - 20 timeout int32 必选 null 微服务调用转发的超时时间 - 20 maxFails int32 必选 null 微服务调用的失败次数 - 3 targetGroup object{ name, loadBalancer } 必选 "" 微服务注册到SLB上的后端服务器组名 用于创建RouteRule,其中的name为必选,对应NuwaRuntime的backendClusterName,其它为可选。 在routes配置的情况下,loadBalancer也属于必选,不配置routes的话,loadBalancer则是可选。 loadBalancer当前仅支持配置roundRobin(加权轮询)且不支持修改为其它策略,如需修改可登录SLB管理台修改。 name: chaosmonekey_portal_static loadBalancer: strategy: roundRobin listenerGroupName string 必选 "" 微服务前端关联的SLB Listenser Group实例IaC名称 对应NuwaRuntime中的slbServiceName,长度为[1, 64] SLB下需要存在这个监听,为空时不会创建RouteRule。 chaos_slb_listener_lhq routes array[ location: string] 可选 [] 微服务的路由规则 不推荐使用,请直接使用slb的iac3.0创建。 /fgc/v1 示例: - name: WiseCloudFGCEventBuilderService_cluster1 type: WiseCloud::MicroService::NuwaContainer properties: bindSlb: - port: 8080 grayStatus: 1 weight: 20 maxFails: 3 timeout: 20 listenerGroupName: chaos_slb_listener_lhq targetGroup: name: chaosmonekey_portal_static loadBalancer: strategy: roundRobin
  • 证书配置 表9 证书配置 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 certConfigs type = list(object({ name = string tag = string })) 可选 [] 证书配置 name:证书名称 tag:证书tag # 业务证书配置 certConfigs: name: "server" # 证书名称 tag: "default" # 证书tag
  • sidecar配置 表6 sidecar配置 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 sidecars type = list(object) - [] 由于POD销毁或被驱逐时,日志文件会丢失,因此AIOps Log Sidecar为必选参数,需要业务配置此sidecar及时将日志进行采集。 name:sidecar的名称,比如AIOpsLog。 type:sidecar的类型,详见代码示例。 version:sidecar的版本。 cpu:sidecar容器的 cpu,配置举例:0.5 或者 2 或者 500m,配置为null或者"“时,代表使用系统默认值。 memory:sidecar的内存,单位为M Mi G Gi,配置举例:100M 0.5G 2G,配置为null或者”"时,代表使用系统默认值。注意M和Mi的区别,M是1000的倍比,Mi是1024的倍比。 param:sidecar的配置参数,不同sidecar的配置参数不一样,具体可以参考各个sidecar的配置方式。 详见代码示例,按照业务需求配置所需的sidecar。 示例: sidecars: - name: AIOpsLog type: WiseCloud::Agent::AIOpsLog version: 3.3.0.100 flavor: 0.4C500M param: $ref: 'config/sidecar_aiops_param.json' - name: RASP type: WiseCloud::Agent::RASP version: 2.2.0.102.SP5 flavor: 0.3C500M param: '' - name: BIFlume type: WiseCloud::Agent::BIFlume version: x.x.x.x flavor: 0.2C500M param: $ref: 'config/sidecar_biflume_param.json' - name: APIGateway type: WiseCloud::Agent::APIGateway version: x.x.x.x flavor: 1C2G param: $ref: 'config/sidecar_apigw_param.json
  • daemonSet 表10 daemonSet 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 daemonSet type = list(object) 可选 [] 目前仅支持AIOps DaemonSet和BI DaemonSet,挂载hostpath提供存储持久化到node的能力。 name:AIOps or BI type:DaemonSet的类型,详见代码示例 enable:true|false,是否启用 logPath:推送日志路径(非文件名),选填。 AIOps固定为'/opt/huawei/logs' limitSize: 日志存储限制,选填,默认值为100G。仅AIOps生效。 groups:日志配置组名,必填。当前BI场景支持1个或多个分组,AIOps场景有且只能填写一个分组并且提前在AIOps管理面创建好。 详见代码示例 示例: daemonSet: - name: AIOps type: WiseCloud::Agent::AIOps enable: true logPath: '/opt/huawei/logs' limitSize: 100G groups: ["logConfigGroupName"] - name: BI type: WiseCloud::Agent::BI enable: false logPath: '/opt/huawei/logs/bi' groups: ["ODS_V001_DM_service1", "ODS_V001_DM_service2"] paramJson: "{\"dataGroups\":[{\"dataGroup\":\"ODSName_BatchFileExampleDS\",\"agentType\":\"batch\",\"batchConfig\":{\"datapushInputs\":{\"jobType\":\"file\",\"dayPeriod\":{\"startTime\":\"10:00:00\",\"offset\":\"1\"},\"file\":{\"sources\":[{\"pattern\":\"/opt/huawei/hcy/*.txt\",\"filename\":\"test.txt\"}]}},\"datapushOutput\":{\"postfix\":\"txt\",\"permitEmptyFile\":true},\"advanced\":{\"extendFields\":{\"datapushInput.isUtc\":false,\"datapushInput.file.sourcePolicy\":3,\"datapushInput.file.countThreshold\":0,\"datapushInput.file.sizeThreshold\":0,\"sendThreadCount\":3,\"datapushInput.file.fileRetryTimes\":3,\"datapushInput.file.fileWaitTimes\":3}}}},{\"dataGroup\":\"ODSName_StreamFileExampleDS\",\"agentType\":\"stream\",\"streamConfig\":{\"filebeatInputs\":{\"type\":\"log\",\"enabled\":true,\"paths\":[\"/opt/huawei/logs/*.log\",\"/opt/huawei/logs/*.txt\"]},\"advanced\":{\"extendFields\":{\"filebeatInputs.harvester_limit\":5,\"queue.mem.events\":4096,\"queue.mem.flush.min_events\":2048}}}}]}" # 配置json格式化
  • 容器健康检查 表5 容器健康检查 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 readinessProbe: exec: command: list(string) 必须配置其中一种,且只能配置一种 [] 命令行检查方式 命令行检查方式\http请求检查方式\tcp端口检查三种方式只能选择一种。 readinessProbe: exec: command: ["echo", "hello"] readinessProbe: httpGet: object - http请求检查方式 命令行检查方式\http请求检查方式\tcp端口检查三种方式只能选择一种。 readinessProbe: httpGet: path: /health port: 8080 scheme: HTTP readinessProbe: tcpSocket: port: int - tcp端口检查 命令行检查方式\http请求检查方式\tcp端口检查三种方式只能选择一种。 readinessProbe: tcpSocket: port:8080 livenessProbe: exec: command: list(string) 必须配置其中一种,且只能配置一种 [] 命令行检查方式 命令行检查方式\http请求检查方式\tcp端口检查三种方式只能选择一种。 livenessProbe: exec: command: ["echo", "hello"] livenessProbe: httpGet: object - http请求检查方式 命令行检查方式\http请求检查方式\tcp端口检查三种方式只能选择一种。 livenessProbe: httpGet: path: /health.html port: 8080 scheme: HTTP livenessProbe: tcpSocket: port: int - tcp端口检查 命令行检查方式\http请求检查方式\tcp端口检查三种方式只能选择一种。 livenessProbe: tcpSocket: port:8080 initialDelaySeconds int 可选 10s 表示容器启动多少秒之后开始探测,单位秒。默认值为10s。 不小于5 readinessProbe: exec: command: ["echo", "hello"] initialDelaySeconds: 10 periodSeconds: 20 successThreshold :1 failureThreshold: 3 timeoutSeconds:5 periodSeconds int 可选 20s 间隔周期,表示每多少秒探测一次容器,单位秒,默认值为20s。 不大于180 successThreshold int 可选 1 表示连续检测多少次成功后则记作成功。默认值为1。 不大于10,liveness探针只能为1。 failureThreshold int 可选 3 表示连续检测多少次失败当做是失败处理,并会重启容器。默认值为3。 不大于10 示例: livenessProbe: httpGet: path: /health port: 8080 scheme: HTTP initialDelaySeconds: 20 timeoutSeconds: 3 periodSeconds: 10 successThreshold: 1 failureThreshold: 3 readinessProbe: httpGet: path: /health port: 8080 scheme: HTTP initialDelaySeconds: 20 timeoutSeconds: 3 periodSeconds: 10 successThreshold: 1 failureThreshold: 10 - name: APIGateway type: WiseCloud::Agent::APIGateway version: x.x.x.x flavor: 1C2G param: $ref: 'config/sidecar_apigw_param.json
  • 挂载信息 表2 挂载信息 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 name string 必选 - log_volume:日志卷 data_volume:data卷 sfs_volume:sfs卷 说明: sfs的卷命名并非固定,此处的名称主要还是供container的volumeMounts引用。 log_volume 每个POD的日志卷大小,log_volume_type不配置或者配置为local时,代表使用集群节点的本地盘,有如下注意事项:容器场景下对/opt/huawei/logs的日志卷大小限制为100G,当日志磁盘写满之后,k8s会驱逐该POD并重新拉起一个新的POD,在此过程中,会影响业务。请在log配置文件中配置绕接策略对总的日志大小不超过此限制,由于NUWA及中间件也会记录一部分日志,建议业务配置保存的log总大小不要超过90G。另外业务需要将所有的日志配置到AIOps sidecar日志服务中,以通过AIOps日志服务进行日志采集,否则POD销毁时会造成日志丢失。 如果log_volume_type配置为evs,则根据实际的大小进行配置。 data_volume data卷大小,默认挂载了/opt/huawei/data的路径,最大支持配置为5Gi。data_volume_type配置为evs则不受此限制。 volumes: - name: log_volume size: 12Gi type: local - name: data_volume size: 2Gi type: local size string 必选 - 定义存储空间 type string 可选 默认是local,代表使用集群节点本地存储。 evs sfs 参见右侧样例 sfs: volumes: - name: sfs_volume id: 11a701c9-529f-4992-9291-bc47bbf5b4c5 # 如果是已有的存储,该值代表存储的资源id type: sfs shareLocation: xxx # 共享路径 mountOptions: ["vers=3","hard","nolock"] local 示例: - name: WiseCloudFGCEventBuilderService_cluster1 type: WiseCloud::MicroService::NuwaContainer properties: volumes: - name: log_volume size: 12Gi type: local - name: data_volume size: 2Gi type: local
  • 基础参数 表1 基础参数 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 name string 必选 - IaC3.0资源名 只能包括数字、字母、'-'、'_'、'.',必须以字母开头,字母或数字结尾。长度2-64。 说明: 如果没有配置clusterName,则资源名会被当做微服务集群名,参数规范则会以微服务集群名的为准。 WiseCloudFGCEventBuilderService_cluster1 type string 必选 - BaaS服务类型,operator要求必填,固定为WiseCloud::MicroService::NuwaContainer 固定为WiseCloud::MicroService::NuwaContainer WiseCloud::MicroService::NuwaContainer microserviceName string 必选 - 微服务名称 微服务名称 WiseCloudFGCEventBuilderService clusterName string 非必选 (建议填写) 默认与name值相同 微服务集群名 只能包括数字、字母、'-'、'_'、'.',必须以字母开头,字母或数字结尾。长度2-56。 说明: 不填与name值相同,由于两字段限制不同,超过限制会报错。 cluster1 replicas int 必选 - Pod副本数 整数类型 说明: 多AZ要配置AZ的倍数,如果部署了双AZ,那么此处要配置为2的倍数。 如果使用了evs盘或者elb,为保证滚动升级每个AZ至少保留一个节点,那么单AZ至少要配置为2,双AZ至少配置为4。 1 pdbMaxUnavailable string 非必选 - Pod干扰预算 整数百分比,整数范围为[1, 50] - terminationGracePeriodSeconds integer 非必选 - 优雅下线宽限期 1-65535 - 示例: - name: WiseCloudFGCEventBuilderService_cluster1 type: WiseCloud::MicroService::NuwaContainer properties: microserviceName: WiseEyeChaosMonkeyExecutor clusterName: cluster1 replicas: 5
  • 指定分组和资源标签 表15 指定分组和资源标签 参数名称 参数类型 是否必选 默认值 说明 参数规范 举例 resourceTag type = object ({group = stringfeatures = string}) 可选 无 group:指定集群部署的分组。 features:指定集群部署的标签信息。 此处配置的信息要再Runtime页面提前预置好。 resourceTag: group: "common" features: "dev"