Skip to content

Commit

Permalink
Merge branch 'edburns-msft-em-6234-reza-fixes' into 'main'
Browse files Browse the repository at this point in the history
Fixes from m_reza_rahman

See merge request weblogic-cloud/weblogic-kubernetes-operator!4854

(cherry picked from commit 591f2b1)

1678873 Bug fixes, simplifications, and updates
c7349d9 improve scripts
e97b9d0 update content of domain on PV sample automation.
951ed56 clarify editing create-domain-on-aks-inputs.sh is optional
eb5599f Merge remote-tracking branch 'oracle/main' into edburns-msft-em-6234-reza-fixes
c805927 improve script comments
49d2a7a increase the max wait time
  • Loading branch information
rjeberhard committed Oct 29, 2024
1 parent a713b0a commit 14ce38e
Show file tree
Hide file tree
Showing 17 changed files with 480 additions and 341 deletions.
38 changes: 20 additions & 18 deletions documentation/site/content/managing-domains/aks/_index.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ description: "Sample for using the operator to set up a WLS cluster on the Azure

This sample demonstrates how to use the [WebLogic Kubernetes Operator]({{< relref "/_index.md" >}}) (hereafter "the operator") to set up a WebLogic Server (WLS) cluster on the Azure Kubernetes Service (AKS). After going through the steps, your WLS domain runs on an AKS cluster. You have several options for managing the cluster, depending on which [domain home source type]({{< relref "/managing-domains/choosing-a-model/_index.md" >}}) you choose. With Domain on PV, you can manage your WLS domain by accessing the WebLogic Server Administration Console or WLST. With Model in Image, you use the operator to perform WLS administrative operations.

**NOTE**: For an alternative approach to this sample,
see the [Oracle WebLogic Server on AKS from the Azure Marketplace]({{<relref "/managing-domains/aks/_index.md">}})
offering which automates the provisioning of
AKS cluster, AKS resources, the Azure Container Registry (ACR),
WebLogic Kubernetes Operator, and WebLogic Server images.
{{% notice note %}}
For an alternative approach to this sample, see the [Oracle WebLogic Server on AKS Azure Marketplace offering]({{<relref "/managing-domains/aks/_index.md">}}), which automates the provisioning of
the AKS cluster, AKS resources, Azure Container Registry (ACR), load-balancer, WebLogic Kubernetes Operator, and WebLogic Server images.
{{% /notice %}}

#### Azure Kubernetes Service cluster

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ weight: 2
description: "Sample for creating a WebLogic domain home on an existing PV or PVC on the Azure Kubernetes Service."
---

This sample demonstrates how to use the [WebLogic Kubernetes Operator](https://oracle.github.io/weblogic-kubernetes-operator) (hereafter "the operator") to set up a WebLogic Server (WLS) cluster on the Azure Kubernetes Service (AKS) using the domain on PV approach. After going through the steps, your WLS domain runs on an AKS cluster instance and you can manage your WLS domain by accessing the WebLogic Server Administration Console.
This sample demonstrates how to use the [WebLogic Kubernetes Operator](https://oracle.github.io/weblogic-kubernetes-operator) (hereafter "the operator") to set up a WebLogic Server (WLS) cluster on the Azure Kubernetes Service (AKS) using the domain on PV approach. After going through the steps, your WLS domain runs on an AKS cluster and you can manage your WLS domain by accessing the WebLogic Server Administration Console.

#### Contents

Expand All @@ -32,6 +32,8 @@ This sample demonstrates how to use the [WebLogic Kubernetes Operator](https://o

##### Prepare parameters

Set required parameters by running the following commands.

```shell
# Change these parameters as needed for your own environment
export ORACLE_SSO_EMAIL=<replace with your oracle account email>
Expand Down Expand Up @@ -59,11 +61,11 @@ export ACR_NAME="${NAME_PREFIX}acr${TIMESTAMP}"

{{< readfile file="/samples/azure-kubernetes-service/includes/sign-in-azure.txt" >}}

{{< readfile file="/samples/azure-kubernetes-service/includes/download-samples-zip.txt" >}}

{{% notice info %}} The following sections of the sample instructions will guide you, step-by-step, through the process of setting up a WebLogic cluster on AKS - remaining as close as possible to a native Kubernetes experience. This lets you understand and customize each step. If you wish to have a more automated experience that abstracts some lower level details, you can skip to the [Automation](#automation) section.
{{% /notice %}}

{{< readfile file="/samples/azure-kubernetes-service/includes/download-samples-zip.txt" >}}

{{< readfile file="/samples/azure-kubernetes-service/includes/create-resource-group.txt" >}}

{{< readfile file="/samples/azure-kubernetes-service/includes/create-aks-cluster-body-02.txt" >}}
Expand Down Expand Up @@ -121,7 +123,7 @@ See [Understanding your first archive]({{< relref "/samples/domains/domain-home-

##### Staging a ZIP file of the archive

Delete existing archive.zip in case we have an old leftover version.
Delete any possible existing archive.zip in case we have an old leftover version.

```shell
$ rm -f ${WDT_MODEL_FILES_PATH}/WLS-v1/archive.zip
Expand Down Expand Up @@ -215,27 +217,32 @@ Now that you have created the AKS cluster, installed the operator, and verified

##### Create secrets

You will use the `$BASE_DIR/sample-scripts/create-weblogic-domain-credentials/create-weblogic-credentials.sh` script to create the domain WebLogic administrator credentials as a Kubernetes secret. Please run:
You will use the `$BASE_DIR/sample-scripts/create-weblogic-domain-credentials/create-weblogic-credentials.sh` script to create the domain WebLogic administrator credentials as a Kubernetes secret. Please run the following commands:

```
cd $BASE_DIR/sample-scripts/create-weblogic-domain-credentials
```
```shell
$ ./create-weblogic-credentials.sh -u ${WEBLOGIC_USERNAME} -p ${WEBLOGIC_PASSWORD} -d domain1
```

The output will show something similar to the following:

```
secret/domain1-weblogic-credentials created
secret/domain1-weblogic-credentials labeled
The secret domain1-weblogic-credentials has been successfully created in the default namespace.
```


You will use the `kubernetes/samples/scripts/create-kubernetes-secrets/create-docker-credentials-secret.sh` script to create the Docker credentials as a Kubernetes secret. Please run:
You will use the `kubernetes/samples/scripts/create-kubernetes-secrets/create-docker-credentials-secret.sh` script to create the Docker credentials as a Kubernetes secret. Please run the following commands:

``` shell
$ cd $BASE_DIR/sample-scripts/create-kubernetes-secrets
$ ./create-docker-credentials-secret.sh -s ${SECRET_NAME_DOCKER} -e ${ORACLE_SSO_EMAIL} -p ${ORACLE_SSO_PASSWORD} -u ${ORACLE_SSO_EMAIL}
```

The output will show something similar to the following:

```
secret/wlsregcred created
The secret wlsregcred has been successfully created in the default namespace.
Expand All @@ -246,6 +253,9 @@ Verify secrets with the following command:
```shell
$ kubectl get secret
```

The output will show something similar to the following:

```
NAME TYPE DATA AGE
domain1-weblogic-credentials Opaque 2 2m32s
Expand All @@ -268,7 +278,7 @@ kubectl label namespace default weblogic-operator=enabled
##### Create WebLogic Domain
Now, you deploy a `sample-domain1` domain resource and an associated `sample-domain1-cluster-1` cluster resource using a single YAML resource file which defines both resources. The domain resource and cluster resource tells the operator how to deploy a WebLogic domain. They do not replace the traditional WebLogic configuration files, but instead cooperate with those files to describe the Kubernetes artifacts of the corresponding domain.

- Run the following command to generate resource files.
- Run the following commands to generate resource files.

Export `Domain_Creation_Image_tag`, which will be referred in `create-domain-on-aks-generate-yaml.sh`.

Expand Down Expand Up @@ -296,12 +306,19 @@ The domain resource references the cluster resource, a WebLogic Server installat
```shell
$ kubectl apply -f admin-lb.yaml
```

The output will show something similar to the following:

```
service/domain1-admin-server-external-lb created
```

```shell
$ kubectl apply -f cluster-lb.yaml
```

The output will show something similar to the following:

```
service/domain1-cluster-1-external-lb created
```
Expand Down Expand Up @@ -363,7 +380,7 @@ The domain resource references the cluster resource, a WebLogic Server installat
```

In the example, the URL to access the Administration Server is: `http://4.157.147.131/console`.
In the example, the URL to access the Administration Server is: `http://4.157.147.131:7001/console`.
The user name and password that you enter for the Administration Console must match the ones you specified for the `domain1-weblogic-credentials` secret in the [Create secrets](#create-secrets) step.

If the WLS Administration Console is still not available, use `kubectl get events --sort-by='.metadata.creationTimestamp' ` to troubleshoot.
Expand All @@ -372,25 +389,20 @@ The domain resource references the cluster resource, a WebLogic Server installat
$ kubectl get events --sort-by='.metadata.creationTimestamp'
```

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.
To access the sample application on WLS, 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 `${BASE_DIR}/sample-scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks.sh`.
If you want to automate the above steps of creating the 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 `${BASE_DIR}/sample-scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks-inputs.sh` directly. The following values must be specified:
To customize the WLS domain, you can optionally edit `${BASE_DIR}/sample-scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks-inputs.sh`.

| Name in YAML file | Example value | Notes |
|-------------------|---------------------|------------------------------------------------------------------------------------------------|
| `dockerEmail` | `yourDockerEmail` | Oracle Single Sign-On (SSO) account email, used to pull the WebLogic Server Docker image. |
| `dockerPassword` | `yourDockerPassword` | Password for Oracle SSO account, used to pull the WebLogic Server Docker image, in clear text. |
| `weblogicUserName` | `weblogic` | Uername for WebLogic user account. |
| `weblogicAccountPassword` | `Secret123456` | Password for WebLogic user account. |
You can now run the script.

```shell
$ cd ${BASE_DIR}/sample-scripts/create-weblogic-domain-on-azure-kubernetes-service
Expand All @@ -400,7 +412,7 @@ $ cd ${BASE_DIR}/sample-scripts/create-weblogic-domain-on-azure-kubernetes-servi
$ ./create-domain-on-aks.sh
```

The script will print the Administration Server address after a successful deployment.
The script will take some time to run. The script will print the Administration Server address after a successful deployment.
To interact with the cluster using `kubectl`, use `az aks get-credentials` as shown in the script output.

{{% 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.
Expand All @@ -421,12 +433,11 @@ Access the sample application using the cluster load balancer IP address.
$ CLUSTER_IP=$(kubectl get svc domain1-cluster-1-lb -o=jsonpath='{.status.loadBalancer.ingress[0].ip}')
```


```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:
The test application will list the server host on the output, like the following:

```html
<html><body><pre>
Expand Down Expand Up @@ -478,7 +489,7 @@ wlsstorage1612795811.file.core.windows.net:/wlsstorage1612795811/wls-weblogic-16

{{< readfile file="/samples/azure-kubernetes-service/includes/clean-up-resources-body-01.txt" >}}

If you created the AKS cluster step by step, run the following commands to clean up resources.
If you created the AKS cluster step by step, run the following command to clean up resources.

{{< readfile file="/samples/azure-kubernetes-service/includes/clean-up-resources-body-02.txt" >}}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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).
Finally, connect the AKS cluster 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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The output from the `create-domain-on-aks.sh` script includes a statement about the Azure resources created by the script. To delete the cluster and free all related resources, simply delete the resource groups. The output will list the resource groups, such as.
If you used the automation script, the output from the `create-domain-on-aks.sh` script includes a statement about the Azure resources created by the script. To delete the cluster and free all related resources, simply delete the resource groups. The output will list the resource groups, such as:

```shell
The following Azure Resouces have been created:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Closely examine the JSON output from this command. Save the value of the `loginS
"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.
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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
##### Oracle Container Registry

You will need an Oracle account. The following steps will direct you to accept the license agreement for WebLogic Server. Make note of your Oracle Account password and email. This sample pertains to 12.2.1.4, but other versions may work as well.
The following steps will direct you to accept the license agreement for WebLogic Server. Make note of your Oracle Account password and email. This sample pertains to 12.2.1.4, but other versions may work as well.

- In a web browser, navigate to https://container-registry.oracle.com and log in using the Oracle Single Sign-On authentication service. If you do not already have SSO credentials, at the top of the page, click the **Sign In** link to create them.
- The Oracle Container Registry provides a WebLogic 12.2.1.4 General Availability (GA) installation image that is used in this sample.
- In the Oracle Container Registry, navigate to **Middleware**, then **weblogic**.
- On the left, choose a language and accept the license agreement. You will then see a message such as: "You last accepted the Oracle Standard Terms and Restrictions on 08/10/2020 at 06:12 AM Coordinated Universal Time (UTC)."
- **NOTE**: General Availability (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 the OCR
or create your images using the [WebLogic Image Tool](https://oracle.github.io/weblogic-image-tool/userguide/tools/create-image/)
(WIT) with the `--recommendedPatches` option. For more guidance,
see [Apply the Latest Patches and Updates](https://www.oracle.com/pls/topic/lookup?ctx=en/middleware/standalone/weblogic-server/14.1.1.0&id=LOCKD-GUID-2DA84185-46BA-4D7A-80D2-9D577A4E8DE2)
in _Securing a Production Environment for Oracle WebLogic Server_.
- Ensure that Docker is running. Find and then pull the WebLogic 12.2.1.4 installation image:
- Ensure that Docker is running. Find and pull the WebLogic 12.2.1.4 installation image:
```shell
$ docker login container-registry.oracle.com -u ${ORACLE_SSO_EMAIL} -p ${ORACLE_SSO_PASSWORD}
$ docker pull container-registry.oracle.com/middleware/weblogic:12.2.1.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

This sample doesn't enable application routing. If you want to enable application routing, follow [Managed nginx Ingress with the application routing add-on in AKS](https://learn.microsoft.com/azure/aks/app-routing?tabs=default%2Cdeploy-app-default).

Run the following commands to create the AKS cluster instance.
Run the following command to create the AKS cluster.

```shell
$ az aks create \
Expand Down
Loading

0 comments on commit 14ce38e

Please sign in to comment.