應用程式管理者可以建立應用程式映像檔,並將它部署至 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 取代為應用程式映像檔的路徑。 指定一個值,該值是要部署的映像檔的絕對名稱,包含登錄及標籤。 applicationImage 值必須定義在 WebSphereLibertyApplication CR 中。
在 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 叢集,則不需要安裝憑證管理程式。