所选语种没有对应资源,请选择:

本站点使用Cookies,继续浏览表示您同意我们使用Cookies。Cookies和隐私政策>

提示

尊敬的用户,您的IE浏览器版本过低,为获取更好的浏览体验,请升级您的IE浏览器。

升级

FusionCloud 6.3.1 用户指南 (Region Type II) 10

评分并提供意见反馈 :
华为采用机器翻译与人工审校相结合的方式将此文档翻译成不同语言,希望能帮助您更容易理解此文档的内容。 请注意:即使是最好的机器翻译,其准确度也不及专业翻译人员的水平。 华为对于翻译的准确性不承担任何责任,并建议您参考英文文档(已提供链接)。
资源描述文件配置说明

资源描述文件配置说明

Json格式资源文件配置说明

背景信息

本章节主要介绍Json类型的资源描述文件的配置示例。

Secret资源描述文件

文件名称为secret.json,配置示例如下:

Sercret资源文件详细描述请参见kubernetes官方文档。

{
  "kind": "Secret",
  "apiVersion": "v1",
  "metadata": {
    "name": "lcq-test-secret",
    "namespace": "lcqtest",
    "enable": true
 },
  "data": {
   "token": "xxxxxx"   //使用token创建secret,token需进行base64转码
  },
  "type": "Opaque"     //Secret类型,采用base64编码格式字符串
}
DaemonSet资源描述文件

文件名称为daemonset.json,配置示例如下:

DaemonSet详细知识请参见kubernetes官方文档。

{
  "kind": "DaemonSet",
  "apiVersion": "extensions/v1beta1",
  "metadata": {
    "name": "icagent",                  
    "namespace": "cse-system",
    "labels": {                 // 给资源添加icagent标签
      "name": "icagent"
   },
    "enable": true
  },
//DaemonSet内容说明
  "spec": {
    "selector": {
       "matchLabels": {
        "app": "icagent"      //标签选择器,选择带icagent标签的实例
       }
    },
//应用实例模板,DaemontSet使用该模板创建并调度应用实例
    "template": {
      "metadata": {
        "creationTimestamp": null,
        "labels": {
         "app": "icagent"      //应用实例的标签
       },
        "enable": true
    },
//应用实例资源内容说明
      "spec": {
        "restartPolicy": "Always",            //重启策略,Always表示当容器失效时总是重启该容器
       "terminationGracePeriodSeconds": 30,   //终结等待时间,当终结容器或进程时有30s缓冲时间
        "dnsPolicy": "ClusterFirst",          //DNS查询被发送到kube-dns服务
        "securityContext": {},                //容器或进程执行时的安全上下文定义,此处为空
        "imagePullSecrets": [
          {
             "name": "cse-system-secret"      //拉取镜像或程序包时使用的secrets
          }
        ],
        "processes": [
          {             "name": "foundation",             "package": "http://10.175.10.205:20202/app/v1/icagent-monitor/icagent-repo/undefined/undefined/ICProbeAgent-4.0.RC17.zip/4.0.RC17",
             "resources": {
              "limits": {                     //系统资源限制
                "cpu": "100m",                //CPU限制,m表示millicores,为CPU单位
                "memory": "100Mi"             //内存限制
             }
            },
            "lifecyclePlan": {                //生命周期管理,在每个生命周期中执行的一些操作
             "kind": "ProcessLifecycle",
             "namespace": "cse-system",
             "name": "icagent-plc"            //用户定义的lifecycle资源
            }
         }
      ]
      }
   }
  }
}
Pod资源描述文件

文件名称为pod.json,配置示例如下:

Pod资源文件详细描述请参见kubernetes官方文档。

{
  "kind": "Pod",
  "apiVersion": "v1",
  "metadata": {
    "name": "icagent-af6hc",
    "namespace": "lcqtest",
    "labels": {
      "app": "icagent"
    },
    "annotations": {                 //用户自定义注解列表,用于kubernetes内部进程或外部工具使用
      "kubernetes.io/created-by": "{\"kind\":\"SerializedReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"DaemonSet\",\"namespace\":\"cse-system\",\"name\":\"icagent\",\"uid\":\"aaf82d69-8e98-11e6-a651-0242ac102a14\",\"apiVersion\":\"extensions\",\"resourceVersion\":\"24290369\"}}\n",
      "scheduler.alpha.kubernetes.io/isExclusive": "Ignore"
    },
    "enable": true
  },
  "spec": {
    "restartPolicy": "Always",
    "terminationGracePeriodSeconds": 30,
    "dnsPolicy": "ClusterFirst",
    "serviceAccountName": "default",    //为pod指定特定的service account
    "serviceAccount": "default",
    "nodeName": "10.175.11.240",        //节点名称
    "securityContext": {},
    "imagePullSecrets": [
      {
        "name": "lcqtest-secret"
      }
    ],
    "processes": [
      {        "name": "foundation",        "package": "http://10.175.10.205:20202/app/v1/icagent-monitor/icagent-repo/undefined/undefined/ICProbeAgent-4.0.RC17.zip/4.0.RC17",
        "env": [                        // 设置软件包执行时的一些环境变量
          {
            "name": "KUBERNETES_SERVICE_TOKEN_DIR",
            "value": "/var/run/secrets/kubernetes.io/serviceaccount/cse-system/icagent-af6hc"
          }
        ],
        "resources": {                  //系统资源请求
          "limits": {
            "cpu": "100m",
            "memory": "100Mi"
          },
          "requests": {
            "cpu": "100m",
            "memory": "100Mi"
          }
        },
        "volumeMounts": [                 //挂载本地目录
          {
            "name": "default-token-o4uqj",
            "readOnly": true,             //挂载目录权限为只读
            "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount/cse-system/icagent-af6hc"
          }
        ],
        "lifecyclePlan": {
          "kind": "ProcessLifecycle",
          "namespace": "cse-system",
          "name": "icagent-plc",
          "apiVersion": "v1alpha1"
        }
      }
    ]
  }
}
LifeCycle资源描述文件

文件名称为lifecycle.json,配置示例如下:

{
  "kind": "ProcessLifecycle",
  "apiVersion": "paas/v1alpha1",
  "metadata": {
    "name": "icagent-plc",
    "namespace": "lcqtest",
   "enable": true
  },
//生命周期操作配置,所执行的操作在actions中定义
  "spec": {
    "lifecycle": {
      "install": {
       "actionFlow": [
          "install"
        ]
     },
      "uninstall": {
        "actionFlow": [
          "uninstall"
         ]
      },
      "start": {
        "actionFlow": [
          "start"
       ]
      },
      "stop": {
         "actionFlow": [
           "stop"
       ]
      },
      "update": {
       "actionFlow": [
         "update"
        ]
      }
    },
//定义生命周期中执行的操作
    "actions": [
      {
        "name": "install",
        "commands": [
         "/bin/bash",
           "bin/manual/setup.sh",
          "-ip",
          "10.175.10.219:31943",
          "-localip",
          "127.0.0.1",
          "-user",
          "paas"
        ]
     },
     {
        "name": "start",
        "commands": [
          "/bin/bash",
           "-c",
           "cd /opt/oss/servicemgr/ICAgent/bin/manual/;su paas -c '/bin/bash mstart.sh'"
        ]
      },
      {
        "name": "stop",
        "commands": [
         "/bin/bash",
          "-c",
          "cd /opt/oss/servicemgr/ICAgent/bin/manual/;su paas -c '/bin/bash mstop.sh'"
       ]
     },
     {
        "name": "uninstall",
        "commands": [
          "/bin/bash",
          "-c",
          "cd /opt/oss/servicemgr/ICAgent/bin/manual/;/bin/bash uninstall.sh"
        ]
      },
     {
         "name": "update",
         "commands": [
          ""
        ]
      }
    ]
  }
}

Yaml格式资源文件配置说明

Secret资源描述文件

文件名称为secret.yaml,配置示例如下:

apiVersion: v1
kind: Secret
metadata:
  name: lcq-test-secret1
  namespace: cse-system
data:
  data1: OEdGTFFVUFZUSlBXWTdPUEFBRks=
  data2: VFM0M0VZUlJPTzFLWkJDVUhBWk9OVk5LTVVMR0s0TVpIU0ZUREVWSw==
DaemonSet资源描述文件

文件名称为daemonset.yaml,配置示例如下:

apiVersion: "extensions/v1beta1"
kind: DaemonSet
metadata:
  name: testprocess1
  labels:
    name: liveness
spec:
  selector:
    matchLabels:
      node: 127.0.0.1
  template:
    metadata:
      labels:
        node: 127.0.0.1
      enable: true
   spec: 
      restartPolicy: Always
      processes:
      - name: test1
         package: http://10.162.197.181/Test_process.tar.gz
         lifecyclePlan:
          kind: ProcessLifecycle
           name: universe
          readinessProbe:
          exec:
            command:
            - /bin/bash
            - -c
            - "/bin/cat /home/hello.sh && /bin/bash /home/hello.sh"
          initialDelaySeconds: 1
          timeoutSeconds: 1
          failureThreshold: 5
Pod资源描述文件

文件名称为pod.yaml,配置示例如下:

apiVersion: v1
kind: Pod
metadata:
  name: busybox0
  labels:
    app: busybox0
    status: replaced
spec:
  containers:
  - image: busybox
    command:
      - sleep
      - "3600"
    imagePullPolicy: IfNotPresent
    name: busybox
    resources:
      limits:
        cpu: 0.5k
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 100Mi
  restartPolicy: Always
LifeCycle资源描述文件

文件名称为lifecycle.yaml,配置示例如下:

kind: ProcessLifecycle
apiVersion: paas/v1alpha1
metadata:
  name: test
  enable: true
spec:
  lifecycle:
    install:
      actionFlow:
      - install
    postStart:
      actionFlow:
      - poststart
    configure:
      actionFlow:
      - configure
    update:
      actionFlow:
      - update
    rollback:
      actionFlow:
      - rollback
  actions:
  - name: fail
    commands: ["echo", "Fail >> /home/res.log"]
  - name: poststart
    commands: ["echo", "poststart >> /home/res.log"]
  - name: configure
    commands: ["echo", "configure >> /home/res.log"]
  - name: install
    commands: ["echo", "install >> /home/res.log"]
  - name: update
    commands: ["echo", "update >> /home/res.log"]
  - name: rollback
    commands: ["echo", "rollback >> /home/res.log"]
翻译
下载文档
更新时间:2019-08-15

文档编号:EDOC1100043091

浏览量:43974

下载量:305

平均得分:
本文档适用于这些产品
相关文档
相关版本
Share
上一页 下一页