9.2. 导入部署配置模板

将 OpenShift 部署配置模板的 Data Grid 导入到 OpenShift 中,如下所示:

  1. 登录您的 OpenShift 集群。
  2. 导入特定模板或所有模板。

    • 导入特定模板:

      $ oc create -f \
      https://raw.githubusercontent.com/jboss-container-images/jboss-datagrid-7-openshift-image/7.3-v1.8/templates/datagrid73-mysql.json
    • 导入所有模板:

      $ for resource in datagrid73-image-stream.json \
        datagrid73-basic.json \
        datagrid73-https.json \
        datagrid73-mysql-persistent.json \
        datagrid73-mysql.json \
        datagrid73-partition.json \
        datagrid73-postgresql.json \
        datagrid73-postgresql-persistent.json
      do
        oc create -f \
        https://raw.githubusercontent.com/jboss-container-images/jboss-datagrid-7-openshift-image/7.3-v1.8/templates/${resource}
      done
      提示

      使用 oc create 导入新模板。使用 oc replace --force 覆盖现有模板。

      使用 -n 选项指定要导入模板的命名空间。例如,-n openshift 将资源导入到全局 openshift 命名空间中,需要管理权限。

  3. 导入 Data Grid 镜像。

    $ oc -n openshift import-image jboss-datagrid73-openshift:1.9
  4. 验证 OpenShift 上可用的模板。

    $ oc get templates -n openshift | grep datagrid73