diff --git a/documentation/site/content/samples/azure-kubernetes-service/domain-on-pv.md b/documentation/site/content/samples/azure-kubernetes-service/domain-on-pv.md index 46490679509..4c2284fd981 100644 --- a/documentation/site/content/samples/azure-kubernetes-service/domain-on-pv.md +++ b/documentation/site/content/samples/azure-kubernetes-service/domain-on-pv.md @@ -11,19 +11,19 @@ This sample demonstrates how to use the [WebLogic Kubernetes Operator](https://o - [Prerequisites](#prerequisites) - [Prepare Parameters](#prepare-parameters) - - [Clone WKO repository](#clone-wko-repository) - [Create Resource Group](#create-resource-group) - [Create an AKS cluster](#create-the-aks-cluster) - - [Create and Configure Storage](#create-storage) + - [Create and configure storage](#create-storage) - [Create an Azure Storage account and NFS share](#create-an-azure-storage-account-and-nfs-share) - [Create SC and PVC](#create-sc-and-pvc) + - [Create a domain creation image](#create-a-domain-creation-image) - [Install WebLogic Kubernetes Operator](#install-weblogic-kubernetes-operator-into-the-aks-cluster) - [Create WebLogic domain](#create-weblogic-domain) - [Create secrets](#create-secrets) - [Create WebLogic Domain](#create-weblogic-domain-1) - [Create LoadBalancer](#create-loadbalancer) - [Automation](#automation) - - [Deploy sample application](#deploy-sample-application) + - [Access sample application](#access-sample-application) - [Validate NFS volume](#validate-nfs-volume) - [Clean up resources](#clean-up-resources) - [Troubleshooting](#troubleshooting) @@ -84,7 +84,7 @@ export AKS_PERS_LOCATION=eastus export AKS_PERS_STORAGE_ACCOUNT_NAME="${NAME_PREFIX}storage${TIMESTAMP}" export AKS_PERS_SHARE_NAME="${NAME_PREFIX}-weblogic-${TIMESTAMP}" export SECRET_NAME_DOCKER="${NAME_PREFIX}regcred" -export ACR_ACCOUNT_NAME="${NAME_PREFIX}acr${TIMESTAMP}" +export ACR_NAME="${NAME_PREFIX}acr${TIMESTAMP}" ``` @@ -98,60 +98,139 @@ export ACR_ACCOUNT_NAME="${NAME_PREFIX}acr${TIMESTAMP}" {{< readfile file="/samples/azure-kubernetes-service/includes/create-aks-cluster-storage.txt" >}} -#### Create the Azure Container Registry and connect it to the AKS cluster +#### Create a domain creation image -Your AKS cluster must be connected to a container registry so it can pull and interact with container images. The WebLogic Kubernetes Operator assumes that the docker images in the container registry have the correct structure so they are ready to run as WebLogic Docker images. The WebLogic Image Toolkit you used when satisfying the preconditions produces images that meet this requirement. In particular the image `wdt-domain-image:WLS-v1`. The steps in this section show you how to create an Azure Container Registry, connect it to your existing AKS cluster, and push the `wdt-domain-image:WLS-v1` to this registry. +This sample requires [Domain creation images]({{< relref "/managing-domains/domain-on-pv/domain-creation-images" >}}). For more information, see [Domain on Persistent Volume]({{< relref "/managing-domains/domain-on-pv/overview" >}}). -Create the Azure Container Registry in your existing resource group. + - [Image creation prerequisites](#image-creation-prerequisites) + - [Image creation - Introduction](#image-creation---introduction) + - [Understanding your first archive](#understanding-your-first-archive) + - [Staging a ZIP file of the archive](#staging-a-zip-file-of-the-archive) + - [Staging model files](#staging-model-files) + - [Creating the image with WIT](#creating-the-image-with-wit) + - [Pushing the image to Azure Container Registry](#pushing-the-image-to-azure-container-registry) + +##### Image creation prerequisites + +- The `JAVA_HOME` environment variable must be set and must reference a valid JDK 8 or 11 installation. +- Copy the sample to a new directory; for example, use the directory `/tmp/dpv-sample`. In the directory name, `dpv` is short for "domain on pv". Domain on PV is one of three domain home source types supported by the operator. To learn more, see [Choose a domain home source type]({{< relref "/managing-domains/choosing-a-model/_index.md" >}}). + + ```shell + $ rm /tmp/dpv-sample -f -r + $ mkdir /tmp/dpv-sample + ``` + + ```shell + $ cp -r $BASE_DIR/sample-scripts/create-weblogic-domain/domain-on-pv/* /tmp/dpv-sample + ``` + + **NOTE**: We will refer to this working copy of the sample as `/tmp/dpv-sample`; however, you can use a different location. +- Copy the `wdt-artifacts` directory of the sample to a new directory; for example, use directory `/tmp/dpv-sample/wdt-artifacts` + + ```shell + $ cp -r $BASE_DIR/sample-scripts/create-weblogic-domain/wdt-artifacts/* /tmp/dpv-sample + ``` + + ```shell + $ export WDT_MODEL_FILES_PATH=/tmp/dpv-sample/wdt-model-files + ``` + +{{< readfile file="/samples/azure-kubernetes-service/includes/download-wls-tools.txt" >}} + +##### Image creation - Introduction + +The goal of image creation is to demonstrate using the WebLogic Image Tool to create an image tagged as `wdt-domain-image:WLS-v1` from files that you will stage to `${WDT_MODEL_FILES_PATH}/WLS-v1`. + + - The directory where the WebLogic Deploy Tooling software is installed (also known as WDT Home), expected in an image’s `/auxiliary/weblogic-deploy` directory, by default. + - WDT model YAML (model), WDT variable (property), and WDT archive ZIP (archive) files, expected in directory `/auxiliary/models`, by default. + +##### Understanding your first archive + +See [Understanding your first archive]({{< relref "/samples/domains/domain-home-on-pv/build-domain-creation-image#understand-your-first-archive" >}}). + +##### Staging a ZIP file of the archive + +Delete existing archive.zip in case we have an old leftover version. ```shell -az acr create --resource-group $AKS_PERS_RESOURCE_GROUP --name ${ACR_ACCOUNT_NAME} --sku Basic --admin-enabled +$ rm -f ${WDT_MODEL_FILES_PATH}/WLS-v1/archive.zip ``` -Successful output will be a JSON object that includes the property. +Create a ZIP file of the archive in the location that we will use when we run the WebLogic Image Tool. -```json -"id": "/subscriptions//resourceGroups//providers/Microsoft.ContainerRegistry/registries/" +```shell +$ cd /tmp/dpv-sample/archives/archive-v1 +$ zip -r ${WDT_MODEL_FILES_PATH}/WLS-v1/archive.zip wlsdeploy ``` -Obtain the credentials to the Azure Container Registry and perform the `docker login`. +##### Staging model files + +{{< readfile file="/samples/azure-kubernetes-service/includes/staging-model-files.txt" >}} + +An image can contain multiple properties files, archive ZIP files, and model YAML files but in this sample you use just one of each. For a complete description of WDT model file naming conventions, file loading order, and macro syntax, see [Model files]({{< relref "/managing-domains/domain-on-pv/model-files" >}}) in the user documentation. + +##### Creating the image with WIT + +At this point, you have all of the files needed for `image wdt-domain-image:WLS-v1` staged; they include: + + - `/tmp/sample/wdt-artifacts/wdt-model-files/WLS-v1/model.10.yaml` + - `/tmp/sample/wdt-artifacts/wdt-model-files/WLS-v1/model.10.properties` + - `/tmp/sample/wdt-artifacts/wdt-model-files/WLS-v1/archive.zip` + +Now, you use the Image Tool to create an image named `wdt-domain-image:WLS-v1`. You’ve already set up this tool during the prerequisite steps. + +Run the following commands to create the image and verify that it worked. Note that `amagetool.sh` is not supported on macOS with Apple Silicon. See [Troubleshooting - exec format error]({{< relref "/samples/azure-kubernetes-service/troubleshooting#exec-weblogic-operatorscriptsintrospectdomainsh-exec-format-error" >}}). ```shell -export LOGIN_SERVER=$(az acr show \ - --name ${ACR_ACCOUNT_NAME} \ - --query 'loginServer' \ - --output tsv) -export USER_NAME=$(az acr credential show \ - --name ${ACR_ACCOUNT_NAME} \ - --query 'username' \ - --output tsv) -export PASSWORD=$(az acr credential show \ - --name ${ACR_ACCOUNT_NAME} \ - --query 'passwords[0].value' \ - --output tsv) - -docker login $LOGIN_SERVER -u $USER_NAME -p $PASSWORD +$ ${WDT_MODEL_FILES_PATH}/imagetool/bin/imagetool.sh createAuxImage \ + --tag wdt-domain-image:WLS-v1 \ + --wdtModel ${WDT_MODEL_FILES_PATH}/WLS-v1/model.10.yaml \ + --wdtVariables ${WDT_MODEL_FILES_PATH}/WLS-v1/model.10.properties \ + --wdtArchive ${WDT_MODEL_FILES_PATH}/WLS-v1/archive.zip ``` -Push the `wdt-domain-image:WLS-v1` image created while satisfying the preconditions to this registry. +This command runs the WebLogic Image Tool to create the domain creation image and does the following: -```shell -docker push ${LOGIN_SERVER}/wdt-domain-image:WLS-v1 + - Builds the final container image as a layer on a small `busybox` base image. + - Copies the WDT ZIP file that's referenced in the WIT cache into the image. + - Note that you cached WDT in WIT using the keyword `latest` when you set up the cache during the sample prerequisites steps. + - This lets WIT implicitly assume it's the desired WDT version and removes the need to pass a `-wdtVersion` flag. + - Copies the specified WDT model, properties, and application archives to image location `/auxiliary/models`. + +When the command succeeds, it should end with output like the following: + +``` +[INFO ] Build successful. Build time=70s. Image tag=wdt-domain-image:WLS-v1 ``` -Set an environment variable for use in a later script. +Verify the image is available in the local Docker server with the following command. ```shell -# An example of Domain_Creation_Image_tag: xxx.azurecr.io/wdt-domain-image:WLS-v1 -export Domain_Creation_Image_tag=${LOGIN_SERVER}/wdt-domain-image:WLS-v1 +$ docker images | grep WLS-v1 +``` +``` +wdt-domain-image WLS-v1 012d3bfa3536 5 days ago 1.13GB ``` -Connect the Azure Container Registry to your existing AKS cluster. +{{% notice note %}} +You may run into a `Dockerfile` parsing error if your Docker buildkit is enabled, see [Troubleshooting - WebLogic Image Tool failure]({{< relref "/samples/azure-kubernetes-service/troubleshooting#weblogic-image-tool-failure" >}}). +{{% /notice %}} + +##### Pushing the image to Azure Container Registry + +{{< readfile file="/samples/azure-kubernetes-service/includes/create-acr.txt" >}} + +Push the `wdt-domain-image:WLS-v1` image created while satisfying the preconditions to this registry. ```shell -az aks update --name ${AKS_CLUSTER_NAME} --resource-group $AKS_PERS_RESOURCE_GROUP --attach-acr ${ACR_ACCOUNT_NAME} +$ docker tag wdt-domain-image:WLS-v1 $LOGIN_SERVER/wdt-domain-image:WLS-v1 +$ docker push ${LOGIN_SERVER}/wdt-domain-image:WLS-v1 ``` +{{< readfile file="/samples/azure-kubernetes-service/includes/aks-connect-acr.txt" >}} + +If you see an error that seems related to you not being an **Owner on this subscription**, please refer to the troubleshooting section [Cannot attach ACR due to not being Owner of subscription]({{< relref "/samples/azure-kubernetes-service/troubleshooting#cannot-attach-acr-due-to-not-being-owner-of-subscription" >}}). + #### Install WebLogic Kubernetes Operator into the AKS cluster The WebLogic Kubernetes Operator is an adapter to integrate WebLogic Server and Kubernetes, allowing Kubernetes to serve as a container infrastructure hosting WLS instances. The operator runs as a Kubernetes Pod and stands ready to perform actions related to running WLS on Kubernetes. @@ -255,6 +334,12 @@ Now, you deploy a `sample-domain1` domain resource and an associated `sample-dom - Run the following command to generate resource files. + Export `Domain_Creation_Image_tag`, which will be referred in `create-domain-on-aks-generate-yaml.sh`. + + ```shell + export Domain_Creation_Image_tag=${LOGIN_SERVER}/wdt-domain-image:WLS-v1 + ``` + ```shell cd $BASE_DIR/sample-scripts/create-weblogic-domain-on-azure-kubernetes-service @@ -313,7 +398,6 @@ The domain resource references the cluster resource, a WebLogic Server installat domain1-managed-server2 1/1 Running 0 10m weblogic-operator-7796bc7b8-qmhzw 1/1 Running 0 48m weblogic-operator-webhook-b5b586bc5-ksfg9 1/1 Running 0 48m - ``` {{% notice tip %}} If Kubernetes advertises the WebLogic pod as `Running` you can be assured the WebLogic Server actually is running because the operator ensures that the Kubernetes health checks are actually polling the WebLogic health check mechanism. @@ -352,18 +436,18 @@ The domain resource references the cluster resource, a WebLogic Server installat $ kubectl get events --sort-by='.metadata.creationTimestamp' ``` -To deploy a sample application on WLS, you may skip to the section [Deploy sample application](#deploy-sample-application). The next section includes a script that automates all of the preceding steps. +To access the sample application on WLS, you may skip to the section [Access sample application](#access-sample-application). The next section includes a script that automates all of the preceding steps. #### Automation -If you want to automate the above steps of creating AKS cluster and WLS domain, you can use the script `kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks.sh`. +If you want to automate the above steps of creating AKS cluster and WLS domain, you can use the script `${BASE_DIR}/sample-scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks.sh`. The sample script will create a WLS domain home on the AKS cluster, including: - Creating a new Azure resource group, with a new Azure Storage Account and Azure File Share to allow WebLogic to persist its configuration and data separately from the Kubernetes pods that run WLS workloads. - Creating WLS domain home. - Generating the domain resource YAML files, which can be used to restart the Kubernetes artifacts of the corresponding domain. -For input values, you can edit `kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks-inputs.sh` directly. The following values must be specified: +For input values, you can edit `${BASE_DIR}/sample-scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks-inputs.sh` directly. The following values must be specified: | Name in YAML file | Example value | Notes | |-------------------|---------------------|------------------------------------------------------------------------------------------------| @@ -372,8 +456,8 @@ For input values, you can edit `kubernetes/samples/scripts/create-weblogic-domai | `weblogicUserName` | `weblogic` | Uername for WebLogic user account. | | `weblogicAccountPassword` | `Secret123456` | Password for WebLogic user account. | -``` -cd kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service +```shell +$ cd ${BASE_DIR}/sample-scripts/create-weblogic-domain-on-azure-kubernetes-service ``` ```shell @@ -386,144 +470,50 @@ To interact with the cluster using `kubectl`, use `az aks get-credentials` as sh {{% notice info %}} You now have created an AKS cluster with Azure Files NFS share to contain the WLS domain configuration files. Using those artifacts, you have used the operator to create a WLS domain. {{% /notice %}} -#### Deploy sample application +#### Access sample application -Now that you have WLS running in AKS, you can test the cluster by deploying the simple sample application included in the repository. - -First, package the application with the following command: +Access the Administration Console using the admin load balancer IP address. ```shell -$ curl -m 120 -fL https://github.com/oracle/weblogic-kubernetes-operator/archive/refs/tags/v4.1.7.zip -o ${BASE_DIR}/v4.1.7.zip -$ unzip v4.1.7.zip "weblogic-kubernetes-operator-4.1.7/integration-tests/src/test/resources/bash-scripts/build-war-app.sh" "weblogic-kubernetes-operator-4.1.7/integration-tests/src/test/resources/apps/testwebapp/*" -$ cd $BASE_DIR/weblogic-kubernetes-operator-4.1.7/integration-tests/src/test/resources/bash-scripts -$ bash build-war-app.sh -s ../apps/testwebapp/ -d /tmp/testwebapp -``` - -Successful output will look similar to the following: - -```text -Found source at ../apps/testwebapp/ -build /tmp/testwebapp/testwebapp.war with command jar -cvf /tmp/testwebapp/testwebapp.war * -added manifest -ignoring entry META-INF/ -ignoring entry META-INF/MANIFEST.MF -adding: META-INF/maven/(in = 0) (out= 0)(stored 0%) -adding: META-INF/maven/com.oracle.weblogic/(in = 0) (out= 0)(stored 0%) -adding: META-INF/maven/com.oracle.weblogic/testwebapp/(in = 0) (out= 0)(stored 0%) -adding: META-INF/maven/com.oracle.weblogic/testwebapp/pom.properties(in = 117) (out= 113)(deflated 3%) -adding: META-INF/maven/com.oracle.weblogic/testwebapp/pom.xml(in = 1210) (out= 443)(deflated 63%) -adding: WEB-INF/(in = 0) (out= 0)(stored 0%) -adding: WEB-INF/web.xml(in = 951) (out= 428)(deflated 54%) -adding: WEB-INF/weblogic.xml(in = 1140) (out= 468)(deflated 58%) -adding: index.jsp(in = 1001) (out= 459)(deflated 54%) --rw-r--r-- 1 user user 3528 Jul 5 14:25 /tmp/testwebapp/testwebapp.war -``` - -Now, you are able to deploy the sample application in `/tmp/testwebapp/testwebapp.war` to the cluster. This sample uses WLS RESTful API [/management/weblogic/latest/edit/appDeployments](https://docs.oracle.com/en/middleware/standalone/weblogic-server/14.1.1.0/wlrer/op-management-weblogic-version-edit-appdeployments-x-operations-1.html) to deploy the sample application. -Replace `${WEBLOGIC_USERNAME}` and `${WEBLOGIC_PASSWORD}` with the values you specified in [Create secrets](#create-secrets) or [Automation](#automation): - -```bash $ ADMIN_SERVER_IP=$(kubectl get svc domain1-admin-server-external-lb -o=jsonpath='{.status.loadBalancer.ingress[0].ip}') -$ curl --user ${WEBLOGIC_USERNAME}:${WEBLOGIC_PASSWORD} -H X-Requested-By:MyClient -H Accept:application/json -s -v \ - -H Content-Type:multipart/form-data \ - -F "model={ - name: 'testwebapp', - targets: [ { identity: [ 'clusters', 'cluster-1' ] } ] - }" \ - -F "sourcePath=@/tmp/testwebapp/testwebapp.war" \ - -H "Prefer:respond-async" \ - -X POST http://${ADMIN_SERVER_IP}:7001/management/weblogic/latest/edit/appDeployments +$ echo "Administration Console Address: http://${ADMIN_SERVER_IP}:7001/console/" ``` -After the successful deployment, you will find output similar to the following: - -{{%expand "Click here to view the output." %}} -```text -* Trying 52.226.101.43:7001... -* TCP_NODELAY set -* Connected to 52.226.101.43 (52.226.101.43) port 7001 (#0) -* Server auth using Basic with user 'weblogic' -> POST /management/weblogic/latest/edit/appDeployments HTTP/1.1 -> Host: 52.226.101.43:7001 -> Authorization: Basic ...= -> User-Agent: curl/7.68.0 -> X-Requested-By:MyClient -> Accept:application/json -> Prefer:respond-async -> Content-Length: 3925 -> Content-Type: multipart/form-data; boundary=------------------------cc76a2c2d819911f -> Expect: 100-continue -> -* Mark bundle as not supporting multiuse -< HTTP/1.1 100 Continue -* We are completely uploaded and fine -* Mark bundle as not supporting multiuse -< HTTP/1.1 202 Accepted -< Date: Thu, 11 Aug 2022 08:32:56 GMT -< Location: http://domain1-admin-server:7001/management/weblogic/latest/domainRuntime/deploymentManager/deploymentProgressObjects/testwebapp -< Content-Length: 764 -< Content-Type: application/json -< X-ORACLE-DMS-ECID: 6f205c83-e172-4c34-a638-7f0c6345ce45-00000055 -< X-ORACLE-DMS-RID: 0 -< Set-Cookie: JSESSIONID=NOCMCQBO7dxyA2lUfCYp4zSYIeFB0S3V1KRRzigmmoOUfmQmlLOh!-546081476; path=/; HttpOnly -< Vary: Accept-Encoding -< -{ - "links": [{ - "rel": "job", - "href": "http:\/\/domain1-admin-server:7001\/management\/weblogic\/latest\/domainRuntime\/deploymentManager\/deploymentProgressObjects\/testwebapp" - }], - "identity": [ - "deploymentManager", - "deploymentProgressObjects", - "testwebapp" - ], - "rootExceptions": [], - "deploymentMessages": [], - "name": "testwebapp", - "operationType": 3, - "startTimeAsLong": 1660206785965, - "state": "STATE_RUNNING", - "id": "0", - "type": "DeploymentProgressObject", - "targets": ["cluster-1"], - "applicationName": "testwebapp", - "failedTargets": [], - "progress": "processing", - "completed": false, - "intervalToPoll": 1000, - "startTime": "2022-08-11T08:33:05.965Z" -* Connection #0 to host 52.226.101.43 left intact -``` -{{% /expand %}} - -Now, you can go to the application through the `domain1-cluster-1-lb` external IP. +Access the sample application using the cluster load balancer IP address. ```shell $ CLUSTER_IP=$(kubectl get svc domain1-cluster-1-lb -o=jsonpath='{.status.loadBalancer.ingress[0].ip}') +``` -$ curl http://${CLUSTER_IP}:8001/testwebapp/ + +```shell +$ curl http://${CLUSTER_IP}:8001/myapp_war/index.jsp ``` The test application will list the server host and server IP on the output, like the following: ```html - - - - +
+*****************************************************************
+
+Hello World! This is version 'v1' of the sample JSP web-app.
+
+Welcome to WebLogic Server 'managed-server1'!
+
+  domain UID  = 'domain1'
+  domain name = 'domain1'
+
+Found 1 local cluster runtime:
+  Cluster 'cluster-1'
 
-    
-    Test WebApp
-  
-  
+Found min threads constraint runtime named 'SampleMinThreads' with configured count: 1
 
+Found max threads constraint runtime named 'SampleMaxThreads' with configured count: 10
 
-    
  • InetAddress: domain1-managed-server1/10.244.1.8 -
  • InetAddress.hostname: domain1-managed-server1 +Found 0 local data sources: - - +***************************************************************** +
  • ``` #### Validate NFS volume diff --git a/documentation/site/content/samples/azure-kubernetes-service/includes/aks-connect-acr.txt b/documentation/site/content/samples/azure-kubernetes-service/includes/aks-connect-acr.txt new file mode 100644 index 00000000000..ebf6eacc499 --- /dev/null +++ b/documentation/site/content/samples/azure-kubernetes-service/includes/aks-connect-acr.txt @@ -0,0 +1,8 @@ +Finally, connect AKS to the ACR. For more details on connecting ACR to an existing AKS, see [Configure ACR integration for existing AKS clusters](https://learn.microsoft.com/en-us/azure/aks/cluster-container-registry-integration?tabs=azure-cli#configure-acr-integration-for-an-existing-aks-cluster). + +```shell +$ export ACR_ID=$(az acr show -n $ACR_NAME --resource-group $AKS_PERS_RESOURCE_GROUP --query "id" -o tsv) +$ az aks update --name $AKS_CLUSTER_NAME --resource-group $AKS_PERS_RESOURCE_GROUP --attach-acr $ACR_ID +``` + +Successful output will be a JSON object with the entry `"type": "Microsoft.ContainerService/ManagedClusters"`. diff --git a/documentation/site/content/samples/azure-kubernetes-service/includes/create-acr.txt b/documentation/site/content/samples/azure-kubernetes-service/includes/create-acr.txt new file mode 100644 index 00000000000..74085cd3308 --- /dev/null +++ b/documentation/site/content/samples/azure-kubernetes-service/includes/create-acr.txt @@ -0,0 +1,24 @@ +AKS can pull images from any container registry, but the easiest integration is to use Azure Container Registry (ACR). In addition to simplicity, using ACR simplifies high availability and disaster recovery with features such as geo-replication. For more information, see [Geo-replication in Azure Container Registry](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-geo-replication). In this section, we will create a new Azure Container Registry, connect it to our pre-existing AKS cluster and push the image built in the preceding section to it. For complete details, see [Azure Container Registry documentation](https://learn.microsoft.com/en-us/azure/container-registry/). + +Let's create an instance of ACR in the same resource group we used for AKS. We will use the environment variables used during the steps above. For simplicity, we use the resource group name as the name of the ACR instance. + +```shell +$ az acr create --resource-group $AKS_PERS_RESOURCE_GROUP --name $ACR_NAME --sku Basic --admin-enabled true +``` + +Closely examine the JSON output from this command. Save the value of the `loginServer` property aside. It will look something like the following. + +```json +"loginServer": "contosoresourcegroup1610068510.azurecr.io", +``` + +Use this value to sign in to the ACR instance. Note that because you are signing in with the `az` cli, you do not need a password because your identity is already conveyed by having done `az login` previously. + +```shell +$ export LOGIN_SERVER=$(az acr show -n $ACR_NAME --resource-group $AKS_PERS_RESOURCE_GROUP --query "loginServer" -o tsv) +``` +```shell +$ az acr login --name $LOGIN_SERVER +``` + +Successful output will include `Login Succeeded`. diff --git a/documentation/site/content/samples/azure-kubernetes-service/includes/create-aks-cluster-storage.txt b/documentation/site/content/samples/azure-kubernetes-service/includes/create-aks-cluster-storage.txt index 724c25a879d..3af942c79b9 100644 --- a/documentation/site/content/samples/azure-kubernetes-service/includes/create-aks-cluster-storage.txt +++ b/documentation/site/content/samples/azure-kubernetes-service/includes/create-aks-cluster-storage.txt @@ -34,11 +34,10 @@ You will dynamically create and use a persistent volume with Azure Files NFS sha Successful output will be a JSON object with the entry `"type": "Microsoft.Storage/storageAccounts"`. 2. Create an NFS share. - {{% notice note %}} We strongly recommend NFS instead of SMB. NFS evolved from the UNIX operating system, and other variants such as GNU/Linux. For this reason, when using NFS with container technologies such as Docker, it is less likely to have problems for concurrent reads and file locking. - Please be sure to enable NFS v4.1. Versions lower than v4.1 will have problems. + We strongly recommend NFS instead of SMB. NFS evolved from the UNIX operating system, and other variants such as GNU/Linux. For this reason, when using NFS with container technologies such as Docker, it is less likely to have problems for concurrent reads and file locking. - {{% /notice %}} + Please be sure to enable NFS v4.1. Versions lower than v4.1 will have problems. To create the file share, you must use `NoRootSquash` to allow the operator to change the ownership of the directory in the NFS share. diff --git a/documentation/site/content/samples/azure-kubernetes-service/includes/download-samples-zip.txt b/documentation/site/content/samples/azure-kubernetes-service/includes/download-samples-zip.txt index 0623bd2541b..47538eb49d7 100644 --- a/documentation/site/content/samples/azure-kubernetes-service/includes/download-samples-zip.txt +++ b/documentation/site/content/samples/azure-kubernetes-service/includes/download-samples-zip.txt @@ -1,11 +1,11 @@ ##### Download the WebLogic Kubernetes Operator sample. -Download the WebLogic Kubernetes Operator sample ZIP file. We will use several scripts in this zip file to create a WebLogic domain. This sample was tested with v4.1.7, but should work with the latest release. +Download the WebLogic Kubernetes Operator sample ZIP file. We will use several scripts in this zip file to create a WebLogic domain. This sample was tested with v4.1.8, but should work with the latest release. ```shell $ cd $BASE_DIR $ mkdir sample-scripts -$ curl -m 120 -fL https://github.com/oracle/weblogic-kubernetes-operator/releases/download/v4.1.7/sample-scripts.zip \ +$ curl -m 120 -fL https://github.com/oracle/weblogic-kubernetes-operator/releases/download/v4.1.8/sample-scripts.zip \ -o ${BASE_DIR}/sample-scripts/sample-scripts.zip $ unzip ${BASE_DIR}/sample-scripts/sample-scripts.zip -d ${BASE_DIR}/sample-scripts ``` diff --git a/documentation/site/content/samples/azure-kubernetes-service/includes/download-wls-tools.txt b/documentation/site/content/samples/azure-kubernetes-service/includes/download-wls-tools.txt new file mode 100644 index 00000000000..38f197a3124 --- /dev/null +++ b/documentation/site/content/samples/azure-kubernetes-service/includes/download-wls-tools.txt @@ -0,0 +1,28 @@ +- Download the latest WebLogic Deploying Tooling (WDT) and WebLogic Image Tool (WIT) installer ZIP files to your `${WDT_MODEL_FILES_PATH}` directory. Both WDT and WIT are required to create your Model in Image images. + + ```shell + $ curl -m 120 -fL https://github.com/oracle/weblogic-deploy-tooling/releases/latest/download/weblogic-deploy.zip \ + -o ${WDT_MODEL_FILES_PATH}/weblogic-deploy.zip + ``` + ```shell + $ curl -m 120 -fL https://github.com/oracle/weblogic-image-tool/releases/latest/download/imagetool.zip \ + -o ${WDT_MODEL_FILES_PATH}/imagetool.zip + ``` + +- Set up the WebLogic Image Tool, run the following commands: + ```shell + $ unzip ${WDT_MODEL_FILES_PATH}/imagetool.zip -d ${WDT_MODEL_FILES_PATH} + ``` + + ``` + $ ${WDT_MODEL_FILES_PATH}/imagetool/bin/imagetool.sh cache deleteEntry --key wdt_latest + ``` + + ```shell + $ ${WDT_MODEL_FILES_PATH}/imagetool/bin/imagetool.sh cache addInstaller \ + --type wdt \ + --version latest \ + --path ${WDT_MODEL_FILES_PATH}/weblogic-deploy.zip + ``` + + These steps will install WIT to the `${WDT_MODEL_FILES_PATH}/imagetool` directory, plus put a `wdt_latest` entry in the tool’s cache which points to the WDT ZIP file installer. You will use WIT later in the sample for creating model images. \ No newline at end of file diff --git a/documentation/site/content/samples/azure-kubernetes-service/includes/prerequisites-01.txt b/documentation/site/content/samples/azure-kubernetes-service/includes/prerequisites-01.txt index 9b90a5902fa..0024b3be44b 100644 --- a/documentation/site/content/samples/azure-kubernetes-service/includes/prerequisites-01.txt +++ b/documentation/site/content/samples/azure-kubernetes-service/includes/prerequisites-01.txt @@ -10,9 +10,9 @@ This sample assumes the following prerequisite environment. * Operating System: GNU/Linux, macOS or [WSL2 for Windows 10](https://docs.microsoft.com/windows/wsl/install-win10). * Note: the Docker image creation steps will not work on a Mac with Apple Silicon. * [Git](https://git-scm.com/downloads); use `git --version` to test if `git` works. This document was tested with version 2.25.1. -* [Azure CLI](https://docs.microsoft.com/cli/azure); use `az --version` to test if `az` works. This document was tested with version 2.48.1. +* [Azure CLI](https://docs.microsoft.com/cli/azure); use `az --version` to test if `az` works. This document was tested with version 2.58.0. * [Docker for Desktop](https://www.docker.com/products/docker-desktop). This document was tested with `Docker version 20.10.7` * [kubectl](https://kubernetes-io-vnext-staging.netlify.com/docs/tasks/tools/install-kubectl/); use `kubectl version` to test if `kubectl` works. This document was tested with version v1.21.2. * [Helm](https://helm.sh/docs/intro/install/), version 3.1 and later; use `helm version` to check the `helm` version. This document was tested with version v3.6.2. * A Java JDK, Version 8 or 11. Azure recommends [Microsoft Build of OpenJDK](https://docs.microsoft.com/java/openjdk/download). Ensure that your `JAVA_HOME` environment variable is set correctly in the shells in which you run the commands. -* A `domain creation image` tagged as `wdt-domain-image:WLS-v1` in your local Docker server's image cache. You can create it by following the [Build the domain creation image]({{< relref "/samples/domains/domain-home-on-pv/build-domain-creation-image#build-the-domain-creation-image" >}}) step. +* Ensure that you have the zip/unzip utility installed; use `zip/unzip -v` to test if `zip/unzip` works. diff --git a/documentation/site/content/samples/azure-kubernetes-service/includes/prerequisites-02.txt b/documentation/site/content/samples/azure-kubernetes-service/includes/prerequisites-02.txt index 7ced36c7515..880e05a783e 100644 --- a/documentation/site/content/samples/azure-kubernetes-service/includes/prerequisites-02.txt +++ b/documentation/site/content/samples/azure-kubernetes-service/includes/prerequisites-02.txt @@ -7,7 +7,7 @@ This sample assumes the following prerequisite environment. * If your identity has very limited role assignments, ensure you have [Contributor](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#contributor) role and [User Access Administrator](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#user-access-administrator) role in the resource group that runs the AKS cluster. This requires asking a privileged user to assign the roles before creating resources in the resource group. * Operating System: GNU/Linux, macOS (Intel only, Apple Silicon not supported) [WSL2 for Windows 10](https://docs.microsoft.com/windows/wsl/install-win10). * [Git](https://git-scm.com/downloads); use `git --version` to test if `git` works. This document was tested with version 2.25.1. -* [Azure CLI](https://docs.microsoft.com/cli/azure); use `az --version` to test if `az` works. This document was tested with version 2.48.1. +* [Azure CLI](https://docs.microsoft.com/cli/azure); use `az --version` to test if `az` works. This document was tested with version 2.58.0. * [Docker for Desktop](https://www.docker.com/products/docker-desktop). This document was tested with `Docker version 20.10.7` * [kubectl](https://kubernetes-io-vnext-staging.netlify.com/docs/tasks/tools/install-kubectl/); use `kubectl version` to test if `kubectl` works. This document was tested with version v1.21.2. * [Helm](https://helm.sh/docs/intro/install/), version 3.1 and later; use `helm version` to check the `helm` version. This document was tested with version v3.6.2. diff --git a/documentation/site/content/samples/azure-kubernetes-service/includes/staging-model-files.txt b/documentation/site/content/samples/azure-kubernetes-service/includes/staging-model-files.txt new file mode 100644 index 00000000000..3a65b022ed6 --- /dev/null +++ b/documentation/site/content/samples/azure-kubernetes-service/includes/staging-model-files.txt @@ -0,0 +1,59 @@ +In this step, you explore the staged WDT model YAML file and properties in the `${WDT_MODEL_FILES_PATH}/WLS-v1` directory. The model in this directory references the web application in your archive, configures a WebLogic Server Administration Server, and configures a WebLogic cluster. It consists of only two files, `model.10.properties`, a file with a single property, and, `model.10.yaml`, a YAML file with your WebLogic configuration. + +Here is the WLS `model.10.properties`: + +``` +CLUSTER_SIZE=5 +``` + +Here is the WLS `model.10.yaml`: + +```yaml +domainInfo: + AdminUserName: '@@SECRET:__weblogic-credentials__:username@@' + AdminPassword: '@@SECRET:__weblogic-credentials__:password@@' + ServerStartMode: 'prod' + +topology: + Name: '@@ENV:CUSTOM_DOMAIN_NAME@@' + AdminServerName: 'admin-server' + Cluster: + 'cluster-1': + DynamicServers: + ServerTemplate: 'cluster-1-template' + ServerNamePrefix: 'managed-server' + DynamicClusterSize: '@@PROP:CLUSTER_SIZE@@' + MaxDynamicClusterSize: '@@PROP:CLUSTER_SIZE@@' + MinDynamicClusterSize: '0' + CalculatedListenPorts: false + Server: + 'admin-server': + ListenPort: 7001 + ServerTemplate: + 'cluster-1-template': + Cluster: 'cluster-1' + ListenPort: 8001 + +appDeployments: + Application: + myapp: + SourcePath: 'wlsdeploy/applications/myapp-v1' + ModuleType: ear + Target: 'cluster-1' +``` + +The model file: + +- Defines a WebLogic domain with: + - Cluster `cluster-1` + - Administration Server `admin-server` + - An EAR application, targeted to `cluster-1`, located in the WDT archive ZIP file at `wlsdeploy/applications/myapp-v1` + +- Leverages macros to inject external values: + - The property file `CLUSTER_SIZE` property is referenced in the model YAML file `DynamicClusterSize` and `MaxDynamicClusterSize` fields using a PROP macro. + - The model file domain name is injected using a custom environment variable named `CUSTOM_DOMAIN_NAME` using an ENV macro. + - You set this environment variable later in this sample using an `env` field in its Domain. + - _This conveniently provides a simple way to deploy multiple differently named domains using the same model image_. + - The model file administrator user name and password are set using a `weblogic-credentials` secret macro reference to the WebLogic credential secret. + - This secret is in turn referenced using the `webLogicCredentialsSecret` field in the Domain. + - The `weblogic-credentials` is a reserved name that always dereferences to the owning Domain actual WebLogic credentials secret name. \ No newline at end of file diff --git a/documentation/site/content/samples/azure-kubernetes-service/model-in-image.md b/documentation/site/content/samples/azure-kubernetes-service/model-in-image.md index b9d855f3b69..3064df74ca8 100644 --- a/documentation/site/content/samples/azure-kubernetes-service/model-in-image.md +++ b/documentation/site/content/samples/azure-kubernetes-service/model-in-image.md @@ -88,18 +88,18 @@ sample-weblogic-operator-sa 1 9m5s Install the operator. The operator’s Helm chart is located in the kubernetes/charts/weblogic-operator directory. This sample installs the operator using Helm charts from Github. It may take you several minutes to install the operator. -``` -helm repo add weblogic-operator https://oracle.github.io/weblogic-kubernetes-operator/charts --force-update +```shell +$ helm repo add weblogic-operator https://oracle.github.io/weblogic-kubernetes-operator/charts --force-update ``` Update the repo to get the latest Helm charts. It is a best practice to do this every time before installing a new operator version. In this example, we are using a pinned version, but you may also find success if you use the latest version. In this case, you can omit the `--version` argument. Be warned that these instructions have only been tested with the exact version shown. -``` +```shell $ helm repo update $ helm install weblogic-operator weblogic-operator/weblogic-operator \ --namespace sample-weblogic-operator-ns \ - --version 4.1.7 \ + --version 4.1.8 \ --set serviceAccount=sample-weblogic-operator-sa \ --wait ``` @@ -115,7 +115,7 @@ REVISION: 1 TEST SUITE: None ``` -{{% notice tip %}} If you wish to use a more recent version of the operator, replace the `4.1.7` in the preceding command with the other version number. To see the list of versions, visit the [GitHub releases page](https://github.com/oracle/weblogic-kubernetes-operator/releases). +{{% notice tip %}} If you wish to use a more recent version of the operator, replace the `4.1.8` in the preceding command with the other version number. To see the list of versions, visit the [GitHub releases page](https://github.com/oracle/weblogic-kubernetes-operator/releases). {{% /notice %}} @@ -126,7 +126,7 @@ $ helm list -A ``` ``` NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION -weblogic-operator sample-weblogic-operator-ns 1 2023-05-15 10:31:05.1890341 +0800 CST deployeweblogic-operator-4.1.7 4.1.7 +weblogic-operator sample-weblogic-operator-ns 1 2023-05-15 10:31:05.1890341 +0800 CST deployeweblogic-operator-4.1.8 4.1.8 ``` ```shell $ kubectl get pods -n sample-weblogic-operator-ns @@ -156,8 +156,9 @@ If you have an image built with domain models following [Model in Image]({{< rel - [Pushing the image to Azure Container Registry](#pushing-the-image-to-azure-container-registry) ##### Image creation prerequisites -1. The `JAVA_HOME` environment variable must be set and must reference a valid JDK 8 or 11 installation. -1. Copy the sample to a new directory; for example, use the directory `/tmp/mii-sample`. In the directory name, `mii` is short for "model in image". Model in image is one of three domain home source types supported by the operator. To learn more, see [Choose a domain home source type]({{< relref "/managing-domains/choosing-a-model/_index.md" >}}). + +- The `JAVA_HOME` environment variable must be set and must reference a valid JDK 8 or 11 installation. +- Copy the sample to a new directory; for example, use the directory `/tmp/mii-sample`. In the directory name, `mii` is short for "model in image". Model in image is one of three domain home source types supported by the operator. To learn more, see [Choose a domain home source type]({{< relref "/managing-domains/choosing-a-model/_index.md" >}}). ```shell $ mkdir /tmp/mii-sample @@ -167,35 +168,16 @@ If you have an image built with domain models following [Model in Image]({{< rel $ cp -r $BASE_DIR/sample-scripts/create-weblogic-domain/wdt-artifacts/* /tmp/mii-sample ``` - **NOTE**: We will refer to this working copy of the sample as `/tmp/mii-sample`; however, you can use a different location. - -1. Download the latest WebLogic Deploying Tooling (WDT) and WebLogic Image Tool (WIT) installer ZIP files to your `/tmp/mii-sample/wdt-model-files` directory. Both WDT and WIT are required to create your Model in Image images. + Save the model file directory. ```shell - export WDT_MODEL_FILES_PATH=/tmp/mii-sample/wdt-model-files + $ export WDT_MODEL_FILES_PATH=/tmp/mii-sample/wdt-model-files ``` - ```shell - $ curl -m 120 -fL https://github.com/oracle/weblogic-deploy-tooling/releases/latest/download/weblogic-deploy.zip \ - -o ${WDT_MODEL_FILES_PATH}/weblogic-deploy.zip - ``` - ```shell - $ curl -m 120 -fL https://github.com/oracle/weblogic-image-tool/releases/latest/download/imagetool.zip \ - -o ${WDT_MODEL_FILES_PATH}/imagetool.zip - ``` - - To set up the WebLogic Image Tool, run the following commands: - ```shell - $ unzip ${WDT_MODEL_FILES_PATH}/imagetool.zip -d ${WDT_MODEL_FILES_PATH} - ``` - ```shell - $ ${WDT_MODEL_FILES_PATH}/imagetool/bin/imagetool.sh cache addInstaller \ - --type wdt \ - --version latest \ - --path ${WDT_MODEL_FILES_PATH}/weblogic-deploy.zip - ``` + **NOTE**: We will refer to this working copy of the sample as `/tmp/mii-sample`; however, you can use a different location. + +{{< readfile file="/samples/azure-kubernetes-service/includes/download-wls-tools.txt" >}} - These steps will install WIT to the `${WDT_MODEL_FILES_PATH}/imagetool` directory, plus put a `wdt_latest` entry in the tool’s cache which points to the WDT ZIP file installer. You will use WIT later in the sample for creating model images. ##### Image creation - Introduction @@ -243,65 +225,7 @@ $ zip -r ${WDT_MODEL_FILES_PATH}/WLS-v1/archive.zip wlsdeploy ##### Staging model files -In this step, you explore the staged WDT model YAML file and properties in the `/tmp/mii-sample/model-in-image__WLS-v1` directory. The model in this directory references the web application in your archive, configures a WebLogic Server Administration Server, and configures a WebLogic cluster. It consists of only two files, `model.10.properties`, a file with a single property, and, `model.10.yaml`, a YAML file with your WebLogic configuration. - -Here is the WLS `model.10.properties`: - -``` -CLUSTER_SIZE=5 -``` - -Here is the WLS `model.10.yaml`: - -```yaml -domainInfo: - AdminUserName: '@@SECRET:__weblogic-credentials__:username@@' - AdminPassword: '@@SECRET:__weblogic-credentials__:password@@' - ServerStartMode: 'prod' - -topology: - Name: '@@ENV:CUSTOM_DOMAIN_NAME@@' - AdminServerName: 'admin-server' - Cluster: - 'cluster-1': - DynamicServers: - ServerTemplate: 'cluster-1-template' - ServerNamePrefix: 'managed-server' - DynamicClusterSize: '@@PROP:CLUSTER_SIZE@@' - MaxDynamicClusterSize: '@@PROP:CLUSTER_SIZE@@' - MinDynamicClusterSize: '0' - CalculatedListenPorts: false - Server: - 'admin-server': - ListenPort: 7001 - ServerTemplate: - 'cluster-1-template': - Cluster: 'cluster-1' - ListenPort: 8001 - -appDeployments: - Application: - myapp: - SourcePath: 'wlsdeploy/applications/myapp-v1' - ModuleType: ear - Target: 'cluster-1' -``` - -The model file: - -- Defines a WebLogic domain with: - - Cluster `cluster-1` - - Administration Server `admin-server` - - An EAR application, targeted to `cluster-1`, located in the WDT archive ZIP file at `wlsdeploy/applications/myapp-v1` - -- Leverages macros to inject external values: - - The property file `CLUSTER_SIZE` property is referenced in the model YAML file `DynamicClusterSize` and `MaxDynamicClusterSize` fields using a PROP macro. - - The model file domain name is injected using a custom environment variable named `CUSTOM_DOMAIN_NAME` using an ENV macro. - - You set this environment variable later in this sample using an `env` field in its Domain. - - _This conveniently provides a simple way to deploy multiple differently named domains using the same model image_. - - The model file administrator user name and password are set using a `weblogic-credentials` secret macro reference to the WebLogic credential secret. - - This secret is in turn referenced using the `webLogicCredentialsSecret` field in the Domain. - - The `weblogic-credentials` is a reserved name that always dereferences to the owning Domain actual WebLogic credentials secret name. +{{< readfile file="/samples/azure-kubernetes-service/includes/staging-model-files.txt" >}} A Model in Image image can contain multiple properties files, archive ZIP files, and YAML files but in this sample you use just one of each. For a complete description of Model in Images model file naming conventions, file loading order, and macro syntax, see [Model files]({{< relref "/managing-domains/model-in-image/model-files.md" >}}) files in the Model in Image user documentation. @@ -363,55 +287,25 @@ You may run into a `Dockerfile` parsing error if your Docker buildkit is enabled ##### Pushing the image to Azure Container Registry -AKS can pull images from any container registry, but the easiest integration is to use Azure Container Registry (ACR). In this section, we will create a new Azure Container Registry, connect it to our pre-existing AKS cluster and push the image built in the preceding section to it. For complete details, see [Azure Container Registry documentation](https://docs.microsoft.com/en-us/azure/container-registry/). - -Let's create an instance of ACR in the same resource group we used for AKS. We will use the environment variables used during the steps above. For simplicity, we use the resource group name as the name of the ACR instance. - -```shell -$ az acr create --resource-group $AKS_PERS_RESOURCE_GROUP --name $ACR_NAME --sku Basic --admin-enabled true -``` - -Closely examine the JSON output from this command. Save the value of the `loginServer` property aside. It will look something like the following. - -```json -"loginServer": "contosoresourcegroup1610068510.azurecr.io", -``` - -Use this value to sign in to the ACR instance. Note that because you are signing in with the `az` cli, you do not need a password because your identity is already conveyed by having done `az login` previously. - -```shell -$ export AKS_PERS_ACR=$(az acr show -n $ACR_NAME --query "loginServer" -o tsv) -``` -```shell -$ az acr login --name $AKS_PERS_ACR -``` - -Successful output will include `Login Succeeded`. +{{< readfile file="/samples/azure-kubernetes-service/includes/create-acr.txt" >}} Ensure Docker is running on your local machine. Run the following commands to tag and push the image to your ACR. ```shell -$ docker tag model-in-image:WLS-v1 $AKS_PERS_ACR/model-in-image-aks:1.0 +$ docker tag model-in-image:WLS-v1 $LOGIN_SERVER/model-in-image-aks:1.0 ``` ```shell -$ docker push $AKS_PERS_ACR/model-in-image-aks:1.0 +$ docker push $LOGIN_SERVER/model-in-image-aks:1.0 ``` ``` The push refers to repository [contosorgresourcegroup1610068510.azurecr.io/model-in-image-aks] 1.0: digest: sha256:208217afe336053e4c524caeea1a415ccc9cc73b206ee58175d0acc5a3eeddd9 size: 2415 ``` -Finally, connect AKS to the ACR. For more details on connecting ACR to an existing AKS, see [Configure ACR integration for existing AKS clusters](https://docs.microsoft.com/en-us/azure/aks/cluster-container-registry-integration#configure-acr-integration-for-existing-aks-clusters). - -```shell -$ az aks update --name $AKS_CLUSTER_NAME --resource-group $AKS_PERS_RESOURCE_GROUP --attach-acr $ACR_NAME -``` +{{< readfile file="/samples/azure-kubernetes-service/includes/aks-connect-acr.txt" >}} If you see an error that seems related to you not being an **Owner on this subscription**, please refer to the troubleshooting section [Cannot attach ACR due to not being Owner of subscription]({{< relref "/samples/azure-kubernetes-service/troubleshooting#cannot-attach-acr-due-to-not-being-owner-of-subscription" >}}). -Successful output will be a JSON object with the entry `"type": "Microsoft.ContainerService/ManagedClusters"`. - - #### Create WebLogic domain In this section, you will deploy the new image to the namespace `sample-domain1-ns`, including the following steps: @@ -501,17 +395,23 @@ $ kubectl -n sample-domain1-ns label secret \ Now, you create a domain YAML file. Think of the domain YAML file as the way to configure some aspects of your WebLogic domain using Kubernetes. The operator uses the Kubernetes "custom resource" feature to define a Kubernetes resource type called `Domain`. For more on the `Domain` Kubernetes resource, see [Domain Resource]({{< relref "/managing-domains/domain-resource" >}}). For more on custom resources see [the Kubernetes documentation](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/). -We provide a sample file at `kubernetes/samples/scripts/create-weblogic-domain/model-in-image/domain-resources/WLS-LEGACY/mii-initial-d1-WLS-LEGACY-v1.yaml`, copy it to a file called `/tmp/mii-sample/mii-initial.yaml`. +We provide a sample file at `$BASE_DIR/sample-scripts/create-weblogic-domain/model-in-image/domain-resources/WLS-LEGACY/mii-initial-d1-WLS-LEGACY-v1.yaml`, copy it to a file called `/tmp/mii-sample/mii-initial.yaml`. + +```shell +$ cp $BASE_DIR/sample-scripts/create-weblogic-domain/model-in-image/domain-resources/WLS-LEGACY/mii-initial-d1-WLS-LEGACY-v1.yaml /tmp/mii-sample/mii-initial.yaml +``` + +Print the image path. Copy the output to your clipboard and paste it to value of `spec.image` in `/tmp/mii-sample/mii-initial.yaml`. ```shell -$ cp $BASE_DIR/weblogic-kubernetes-operator/kubernetes/samples/scripts/create-weblogic-domain/model-in-image/domain-resources/WLS-LEGACY/mii-initial-d1-WLS-LEGACY-v1.yaml /tmp/mii-sample/mii-initial.yaml +echo $LOGIN_SERVER/model-in-image-aks:1.0 ``` Modify the Domain YAML with your values. | Name in YAML file | Example value | Notes | |-------------------|---------------|-------| -|`spec.image`|`$AKS_PERS_ACR/model-in-image-aks:1.0`|Must be the same as the value to which you pushed the image to by running the command `docker push $AKS_PERS_ACR/model-in-image-aks:1.0`.| +|`spec.image`|`$LOGIN_SERVER/model-in-image-aks:1.0`|Must be the same as the value to which you pushed the image to by running the command `docker push $LOGIN_SERVER/model-in-image-aks:1.0`.| Run the following command to create the domain custom resource: @@ -577,7 +477,7 @@ If the system does not reach this state, troubleshoot and resolve the problem be Create the Azure public standard load balancer to access the WebLogic Server Administration Console and applications deployed in the cluster. -Use the configuration file in `kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/model-in-image/admin-lb.yaml` to create a load balancer service for the Administration Server. If you are choosing not to use the predefined YAML file and instead created a new one with customized values, then substitute the following content with you domain values. +Use the configuration file in `$BASE_DIR/sample-scripts/create-weblogic-domain-on-azure-kubernetes-service/model-in-image/admin-lb.yaml` to create a load balancer service for the Administration Server. If you are choosing not to use the predefined YAML file and instead created a new one with customized values, then substitute the following content with you domain values. {{%expand "Click here to view YAML content." %}} ```yaml @@ -600,7 +500,7 @@ spec: ``` {{% /expand %}} -Use the configuration file in `kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/model-in-image/cluster-lb.yaml` to create a load balancer service for the managed servers. If you are choosing not to use the predefined YAML file and instead created new one with customized values, then substitute the following content with you domain values. +Use the configuration file in `$BASE_DIR/sample-scripts/create-weblogic-domain-on-azure-kubernetes-service/model-in-image/cluster-lb.yaml` to create a load balancer service for the managed servers. If you are choosing not to use the predefined YAML file and instead created new one with customized values, then substitute the following content with you domain values. {{%expand "Click here to view YAML content." %}} ```yaml @@ -627,13 +527,13 @@ spec: Create the load balancer services using the following command: ```shell -$ kubectl apply -f $BASE_DIR/weblogic-kubernetes-operator/kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/model-in-image/admin-lb.yaml +$ kubectl apply -f $BASE_DIR/sample-scripts/create-weblogic-domain-on-azure-kubernetes-service/model-in-image/admin-lb.yaml ``` ``` service/sample-domain1-admin-server-external-lb created ``` ```shell -$ kubectl apply -f $BASE_DIR/weblogic-kubernetes-operator/kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/model-in-image/cluster-lb.yaml +$ kubectl apply -f $BASE_DIR/sample-scripts/create-weblogic-domain-on-azure-kubernetes-service/model-in-image/cluster-lb.yaml ``` ``` service/sample-domain1-cluster-1-external-lb created @@ -793,53 +693,41 @@ Events: ##### Access the application -Access the Administration Console using the admin load balancer IP address, `http://52.191.234.149:7001/console` +Access the Administration Console using the admin load balancer IP address. + +```shell +$ ADMIN_SERVER_IP=$(kubectl -n sample-domain1-ns get svc sample-domain1-admin-server-external-lb -o=jsonpath='{.status.loadBalancer.ingress\[0\].ip}') +$ echo "Administration Console Address: http://${ADMIN_SERVER_IP}:7001/console/" +``` Access the sample application using the cluster load balancer IP address. +```shell +## Access the sample application using the cluster load balancer IP. +$ CLUSTER_IP=$(kubectl -n sample-domain1-ns get svc sample-domain1-cluster-1-lb -o=jsonpath='{.status.loadBalancer.ingress\[0\].ip}') ``` -## Access the sample application using the cluster load balancer IP (52.191.235.71) -``` -``` -$ CLUSTER_IP=$(kubectl -n sample-domain1-ns get svc sample-domain1-cluster-1-lb -o=jsonpath='{.status.loadBalancer.ingress[0].ip}') + +```shell $ curl http://${CLUSTER_IP}:8001/myapp_war/index.jsp ``` + ```
     *****************************************************************
     
    -Hello World! This is version 'v1' of the mii-sample JSP web-app.
    +Hello World! This is version 'v1' of the sample JSP web-app.
     
     Welcome to WebLogic Server 'managed-server1'!
     
    - domain UID  = 'sample-domain1'
    - domain name = 'domain1'
    +  domain UID  = 'sample-domain1'
    +  domain name = 'domain1'
     
     Found 1 local cluster runtime:
       Cluster 'cluster-1'
     
    -Found 0 local data sources:
    -
    -*****************************************************************
    -
    - -``` -```shell -$ curl http://52.191.235.71:8001/myapp_war/index.jsp -``` -``` -
    -*****************************************************************
    -
    -Hello World! This is version 'v1' of the mii-sample JSP web-app.
    +Found min threads constraint runtime named 'SampleMinThreads' with configured count: 1
     
    -Welcome to WebLogic Server 'managed-server2'!
    -
    - domain UID  = 'sample-domain1'
    - domain name = 'domain1'
    -
    -Found 1 local cluster runtime:
    -  Cluster 'cluster-1'
    +Found max threads constraint runtime named 'SampleMaxThreads' with configured count: 10
     
     Found 0 local data sources:
     
    diff --git a/kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks-inputs.yaml b/kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks-inputs.yaml
    deleted file mode 100644
    index 6ea919ba97a..00000000000
    --- a/kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks-inputs.yaml
    +++ /dev/null
    @@ -1,100 +0,0 @@
    -# Copyright (c) 2018, 2021, Oracle and/or its affiliates.
    -# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
    -
    -# The version of this inputs file. Do not modify.
    -version: create-domain-on-aks-inputs-v1
    -
    -#
    -# Parameters that must be changed from these values!
    -#
    -
    -# Oracle Single Sign-On (SSO) account email, used to pull the WebLogic Server image.
    -dockerEmail: docker-email
    -
    -# Oracle SSO account password, used to pull the WebLogic Server image.
    -dockerPassword: docker-password
    -
    -# The same value as dockerEmail.
    -dockerUserName: docker-user-name
    -
    -# Specify where to create azure resource.
    -azureLocation: eastus
    -
    -# Specify a prefix to name resources, only allow lowercase letters and numbers, between 1 and 7 characters.
    -# Resource group is named with ${namePrefix}resourcegroup, e.g. wlsresourcegroup1592469388
    -# Kubernetes cluster is named with ${namePrefix}akscluster, e.g. wlsakscluster1592469388
    -# Storage account is named with ${namePrefix}storage, e.g. wlsstorage1592469388
    -namePrefix: wls
    -
    -#
    -# Parameters that may optionally be changed.
    -#
    -
    -# The suffix of file share secret name, the complete value is ${namePrefix}${azureFileShareSecretNameSuffix}.
    -azureFileShareSecretNameSuffix: azure-secret
    -
    -# Number of azure kubernetes nodes, used to create azure kubernetes cluster.
    -azureKubernetesNodeCount: 2
    -
    -# VM size of azure kubernetes node.
    -azureKubernetesNodeVMSize: Standard_DS2_v2
    -
    -# The suffix of azure kubernetes node pool name, the azure kubernetes node pool name will be${azureKubernetesNodepoolNamePrefix} ${namePrefix}.
    -azureKubernetesNodepoolNamePrefix: pool1
    -
    -#Java Option for WebLogic Server
    -javaOptions: -Dweblogic.StdoutDebugEnabled=false -XX:InitialRAMPercentage=25.0 -XX:MaxRAMPercentage=50.0
    -
    -# The suffix of the Kubernetes secret name, the complete value is ${namePrefix}${imagePullSecretNameSuffix}. The secret name is used to access the container registry to pull the WebLogic Server image
    -# Used to create Kubernetes secret for container registry account.
    -# Parameter "imagePullSecretName" will be overwritten with this field in kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-inputs.yaml
    -imagePullSecretNameSuffix: regcred
    -
    -# Storage class name for Azure Files using Container Storage Interface driver, see https://docs.microsoft.com/en-us/azure/aks/azure-files-csi#nfs-file-shares
    -azureFileCsiNfsClassName: azurefile-csi-nfs
    -
    -# The suffix of azure storage file share name, the complete value is ${namePrefix}-${azureStorageShareNameSuffix}-, used to create file share, and mount file share. 
    -azureStorageShareNameSuffix: weblogic
    -
    -# Resource request for each server pod (Memory and CPU). This is minimum amount of compute
    -# resources required for each server pod. Edit value(s) below as per pod sizing requirements.
    -# These are optional 
    -# Please refer to the kubernetes documentation on Managing Compute
    -# Resources for Containers for details.
    -# Parameter "serverPodMemoryRequest" and "serverPodCpuRequest" will be overwritten with this field in kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-inputs.yaml
    -serverPodMemoryRequest: "1.5Gi"
    -serverPodCpuRequest: "250m"
    -
    -# Uncomment and edit value(s) below to specify the maximum amount of compute resources allowed 
    -# for each server pod.
    -# These are optional. 
    -# Please refer to the kubernetes documentation on Managing Compute
    -# Resources for Containers for details.
    -# Parameter "serverPodMemoryLimit" and "serverPodCpuLimit" will be overwritten with this field in kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-inputs.yaml
    -serverPodMemoryLimit: "1.5Gi"
    -serverPodCpuLimit: "250m"
    -
    -# The suffix of the persistent volume claim name, the complete value is ${namePrefix}-${persistentVolumeClaimNameSuffix}-.
    -# Parameter "persistentVolumeClaimName" will be overwritten with this field in kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-inputs.yaml
    -persistentVolumeClaimNameSuffix: azurefile
    -
    -# Password for WebLogic account.
    -weblogicAccountPassword: weblogic-account-password
    -
    -# WebLogic Server image.
    -# Parameter "image" will be overwritten with this field in kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-inputs.yaml
    -# **NOTE**:
    -# This sample uses General Availability (GA) images. GA images are suitable for demonstration and
    -# development purposes only where the environments are not available from the public Internet;
    -# they are not acceptable for production use. In production, you should always use CPU (patched)
    -# images from OCR or create your images using the WebLogic Image Tool.
    -# Please refer to the `OCR` and `WebLogic Images` pages in the WebLogic Kubernetes Operator
    -# documentation for details.
    -weblogicDockerImage: container-registry.oracle.com/middleware/weblogic:12.2.1.4
    -
    -# Name of weblogic user.
    -weblogicUserName: weblogic-user-name
    -
    -
    -
    -
    diff --git a/kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks.sh b/kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks.sh
    index b6f1dd17246..b7237c0298f 100755
    --- a/kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks.sh
    +++ b/kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks.sh
    @@ -10,9 +10,9 @@
     #  artifacts of the corresponding domain.
     #
     #  The Azure resource deployment is customized by editing
    -#  create-domain-on-aks-inputs.yaml. If you also want to customize
    +#  create-domain-on-aks-inputs.sh. If you also want to customize
     #  WebLogic Server domain configuration, please edit
    -#  kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-inputs.yaml.  Or you can create a copy of this file and edit it and refer to the copy using "-d ".
    +#  kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-on-aks-inputs.sh.  Or you can create a copy of this file and edit it and refer to the copy using "-d ".
     #
     #  The following pre-requisites must be handled prior to running this script:
     #    * Environment has set up, with git, azure cli, kubectl and helm installed.
    @@ -714,11 +714,9 @@ unzip imagetool.zip
       --version latest \
       --path ${image_build_base_dir}/sample/wdt-artifacts/weblogic-deploy.zip
     
    -unzip ${image_build_base_dir}/sample/wdt-artifacts/weblogic-deploy.zip
     rm -f ${image_build_base_dir}/sample/wdt-artifacts/wdt-model-files/WLS-v1/archive.zip
     cd ${image_build_base_dir}/sample/wdt-artifacts/archives/archive-v1
    -
    -${image_build_base_dir}/sample/wdt-artifacts/weblogic-deploy/bin/archiveHelper.sh add application -archive_file=${image_build_base_dir}/sample/wdt-artifacts/wdt-model-files/WLS-v1/archive.zip -source=wlsdeploy/applications/myapp-v1
    +zip -r ${image_build_base_dir}/sample/wdt-artifacts/wdt-model-files/WLS-v1/archive.zip wlsdeploy
     
     cd ${image_build_base_dir}/sample/wdt-artifacts/wdt-model-files/WLS-v1
     ${image_build_base_dir}/sample/wdt-artifacts/imagetool/bin/imagetool.sh createAuxImage \
    @@ -743,7 +741,8 @@ docker push ${acr_account_name}.azurecr.io/wdt-domain-image:WLS-v1
     
     # allow aks to access acr
     echo allow aks to access acr
    -az aks update --name $aksClusterName --resource-group $azureResourceGroupName --attach-acr $acr_account_name
    +acr_id=$(az acr show -n $acr_account_name --resource-group $azureResourceGroupName --query "id" -o tsv)
    +az aks update --name $aksClusterName --resource-group $azureResourceGroupName --attach-acr $acr_id
     
     ## build image success
     echo "build image end----------"