Here’s some insight into what’s happening under the covers during the Quick Start tutorial.
The Quick Start guide first installs the WebLogic Kubernetes Operator, then creates a domain using the Model in Image domain home source type.
The WebLogic domain configuration is specified using the WebLogic Deployment Tool (WDT) model YAML file in a separate auxiliary image.
The operator detects the domain and cluster resources, and deploys their WebLogic Server Administration Server and Managed Server pods.
The following instructions guide you, step-by-step, through the process of creating the Quick Start auxiliary image using the WebLogic Image Tool (WIT). These steps help you understand and customize auxiliary image creation. Then you’ll see how to use that image in the domain creation.
The JAVA_HOME
environment variable must be set and must reference a valid JDK 8 or 11 installation.
Download the latest WebLogic Deploy Tooling (WDT) and WebLogic Image Tool (WIT) installer ZIP files to a new directory; for example, use directory /tmp/quickstart/tools
. Both WDT and WIT are required to create your Model in Image auxiliary images.
For example:
$ mkdir -p /tmp/quickstart/tools
$ cd /tmp/quickstart/tools
$ curl -m 120 -fL https://github.com/oracle/weblogic-deploy-tooling/releases/latest/download/weblogic-deploy.zip \
-o /tmp/quickstart/tools/weblogic-deploy.zip
$ curl -m 120 -fL https://github.com/oracle/weblogic-image-tool/releases/latest/download/imagetool.zip \
-o /tmp/quickstart/tools/imagetool.zip
To set up the WebLogic Image Tool, run the following commands.
$ unzip imagetool.zip
$ ./imagetool/bin/imagetool.sh cache deleteEntry --key wdt_latest
$ ./imagetool/bin/imagetool.sh cache addInstaller \
--type wdt \
--version latest \
--path /tmp/quickstart/tools/weblogic-deploy.zip
Note that the WebLogic Image Tool cache deleteEntry
command does nothing
if the wdt_latest
key doesn’t have a corresponding cache entry. It is included
because the WIT cache lookup information is stored in the $HOME/cache/.metadata
file by default, and if the cache already
has a version of WDT in its --type wdt --version latest
location, then the
cache addInstaller
command will fail.
For more information about the WIT cache, see the
cache documentation.
These steps install WIT to the /tmp/quickstart/tools/imagetool
directory
and put a wdt_latest
entry in the tool’s cache, which points to the WDT ZIP file installer.
You will use WIT and its cached reference to the WDT installer later in the sample for creating model images.
Download the sample WDT model, web application, and properties files to be included in the auxiliary image and put them in your /tmp/quickstart/models
directory.
Then use the jar
command to put the web application files into a model archive ZIP file.
For example:
$ mkdir -p /tmp/quickstart/models/archive/wlsdeploy/applications/quickstart/WEB-INF
$ curl -m 120 -fL https://raw.githubusercontent.com/oracle/weblogic-kubernetes-operator/release/4.1/kubernetes/samples/quick-start/model.yaml -o /tmp/quickstart/models/model.yaml
$ curl -m 120 -fL https://raw.githubusercontent.com/oracle/weblogic-kubernetes-operator/release/4.1/kubernetes/samples/quick-start/model.properties -o /tmp/quickstart/models/model.properties
$ curl -m 120 -fL https://raw.githubusercontent.com/oracle/weblogic-kubernetes-operator/release/4.1/kubernetes/samples/quick-start/archive/wlsdeploy/applications/quickstart/index.jsp -o /tmp/quickstart/models/archive/wlsdeploy/applications/quickstart/index.jsp
$ curl -m 120 -fL https://raw.githubusercontent.com/oracle/weblogic-kubernetes-operator/release/4.1/kubernetes/samples/quick-start/archive/wlsdeploy/applications/quickstart/WEB-INF/web.xml -o /tmp/quickstart/models/archive/wlsdeploy/applications/quickstart/WEB-INF/web.xml
$ jar cvf /tmp/quickstart/models/archive.zip -C /tmp/quickstart/models/archive/ wlsdeploy
Follow these steps to create the auxiliary image containing WDT model YAML files, application archives, and the WDT installation files.
Use the createAuxImage
option of the WebLogic Image Tool (WIT) to create the auxiliary image.
$ /tmp/quickstart/tools/imagetool/bin/imagetool.sh createAuxImage \
--tag quick-start-aux-image:v1 \
--wdtModel /tmp/quickstart/models/model.yaml \
--wdtVariables /tmp/quickstart/models/model.properties \
--wdtArchive /tmp/quickstart/models/archive.zip
When you run this command, the Image Tool will create an auxiliary image with the specified model, variables, and archive files in the
image’s /auxiliary/models
directory. It will also add the latest version of the WDT installation in its /auxiliary/weblogic-deploy
directory.
See Create Auxiliary Image for additional Image Tool options.
If you have successfully created the image, then it should now be in your local machine’s Docker repository. For example:
$ docker images quick-start-aux-image:v1
REPOSITORY TAG IMAGE ID CREATED SIZE
quick-start-aux-image v1 eac9030a1f41 1 minute ago 4.04MB
After the image is created, it will have the WDT executables in
/auxiliary/weblogic-deploy
, and WDT model, property, and archive
files in /auxiliary/models
. You can run ls
in the Docker
image to verify this.
$ docker run -it --rm quick-start-aux-image:v1 ls -l /auxiliary
total 8
drwxr-xr-x 1 oracle root 4096 Jun 1 21:53 models
drwxr-xr-x 1 oracle root 4096 May 26 22:29 weblogic-deploy
$ docker run -it --rm quick-start-aux-image:v1 ls -l /auxiliary/models
total 16
-rw-rw-r-- 1 oracle root 1663 Jun 1 21:52 archive.zip
-rw-rw-r-- 1 oracle root 173 Jun 1 21:59 model.10.properties
-rw-rw-r-- 1 oracle root 1515 Jun 1 21:59 model.10.yaml
$ docker run -it --rm quick-start-aux-image:v1 ls -l /auxiliary/weblogic-deploy
total 28
-rw-r----- 1 oracle root 4673 Oct 22 2019 LICENSE.txt
-rw-r----- 1 oracle root 30 May 25 11:40 VERSION.txt
drwxr-x--- 1 oracle root 4096 May 26 22:29 bin
drwxr-x--- 1 oracle root 4096 May 25 11:40 etc
drwxr-x--- 1 oracle root 4096 May 25 11:40 lib
drwxr-x--- 1 oracle root 4096 Jan 22 2019 samples
Copy the image to all the nodes in your cluster or put it in a container registry that your cluster can access.
If you followed the previous steps to create an auxiliary image, then use these steps to create the domain.
Prepare the domain resource.
a. Download the domain and cluster resource sample YAML file to a file called /tmp/quickstart/domain-resource.yaml
or similar.
b. If you chose a different name and tag for the auxiliary image you created, then update the image field under the spec.configuration.model.auxiliaryImages
section to use that name and tag. For example, if you named the auxiliary image my-aux-image:v1
, then update the spec.configuration.model.auxiliaryImages
section as shown.
auxiliaryImages:
- image: "my-aux-image:v1"
c. If you chose non-default values for any other fields, such as spec.image
, spec.imagePullSecrets
, spec.webLogicCredentialsSecret
, and spec.configuration.model.runtimeEncryptionSecret
, then update those fields accordingly.
Create the domain by applying the domain resource.
$ kubectl apply -f /tmp/quickstart/domain-resource.yaml
Use following commands to delete the generated image and directories for tools and models.
Delete the generated image by using the docker rmi
command. Use the following command to delete an image tagged with quick-start-aux-image:v1
.
$ docker rmi quick-start-aux-image:v1
Delete the directory where WebLogic Deploy Tooling and WebLogic Image Tool are installed.
$ rm -rf /tmp/quickstart/tools/
Delete the directory where the WDT model file, archive, and variable files are copied.
$ rm -rf /tmp/quickstart/models/