应用程序管理员可以创建应用程序映像并将其部署到 Kubernetes 环境。 使用具有 YAML 结构的 WebSphereLibertyApplication 定制资源 (CR) 文件来设置应用程序映像部署的参数值。
过程
- 创建一个应用程序映像。 请参阅 将应用程序移动到容器。
- 创建用于指定应用程序映像部署参数的 CR 文件。
- 从以下 WebSphereLibertyApplication CR 文件开始,该文件指定用于将应用程序映像部署到 Kubernetes 环境的最小参数。
apiVersion: liberty.websphere.ibm.com/v1
kind: WebSphereLibertyApplication
metadata:
name: my-app
spec:
license:
accept: false
edition: IBM WebSphere Application Server
productEntitlementSource: Standalone
applicationImage: quay.io/my-repo/my-app:1.0
- 对于 .metadata.name,将
my-app 替换为 CR 的名称。
- 对于 .spec.license,根据需要替换其参数值。
对于 accept,请指定true。 要部署该应用程序,必须将 accept 参数设置为 true。
对于 edition,请指定 WebSphere Liberty 版本。 缺省值为 IBM
WebSphere Application Server(基本)。 其他可用值包括 IBM WebSphere
Application Server Liberty Core 和 IBM WebSphere Application Server Network
Deployment。
对于 productEntitlementSource,请指定该产品或您拥有许可证的产品的权利源。 缺省值为 Standalone,其中包括 WebSphere Application Server 产品(例如 Liberty)。 其他可用值包括 IBM Cloud Pak for Applications、IBM WebSphere Application Server Family
Edition 和 IBM WebSphere Hybrid Edition。
- 对于 .spec.applicationImage,将
quay.io/my-repo/my-app:1.0 替换为应用程序映像的路径。 指定一个值,即要部署的映像的绝对名称(其中包含注册表和标记)。 必须在 WebSphereLibertyApplication CR 中定义 applicationImage 值。
在 Red Hat® OpenShift® 上,该操作程序使用 applicationImage 值来查找映像流名称。 如果操作程序无法找到与该值匹配的任何映像流,那么它将回退到注册表查找。
要将名为 my-company/my-app(my-company 是项目,my-app 是映像流名称)的映像流与 Docker Hub my-company/my-app 映像区分开来,可以将完全映像引用用作 docker.io/my-company/my-app。
- 将 CR 部署到 Kubernetes 环境中正在运行的集群。
下一步做什么?
检查已部署的应用程序的状态。 有关更多信息,请参阅查看应用程序状态。
缺省情况下,.spec.manageTLS 设置为 true,且无需在 CR 中指定。 如果已将 CR 部署到 Kubernetes 集群,那么必须在 Kubernetes 集群上安装证书管理器。 如果已部署到 Red Hat OpenShift 集群,那么不需要安装证书管理器。