New Oracle WebLogic 14.1.1 on Oracle Kubernetes Engine

New Oracle WebLogic 14.1.1 on Oracle Kubernetes Engine

Published on: Category: Oracle

At the end of March, Oracle Product Director Will Lyons announced the long expected release of Oracle WebLogic 14.1.1. I won't go into detail about every nice, new feature. You can find all the details about this release here and on my blog.

Rather, I wanted to test if this version was ready to run on a Kubernetes platform. In this case, the obvious choice was the Oracle Kubernetes Engine (OKE), although RedHat OpenShift and Microsoft Azure Kubernetes Service are also good options.

Ingredients for running WebLogic 14.1.1 domain

To build this new version, my toolset consisted of the following components:

  • An Oracle Kubernetes Engine Cluster (already created)
  • A client to run this cluster
  • The Oracle WebLogic 14.1.1 package
  • Oracle WebLogic docker files
  • Podman, Buildah, Skopeo. For this blog, I only used Podman. I will use the other tools later.
  • The WebLogic Kubernetes Operator 2.5
  • Helm
  • Oracle Container Registry (OCIR)
  • Some GitHub repo's with build scripts: here and here

WebLogic 14 docker image

To build my private image and push it to my private registry, I first need to build my local image.

There is a shell script provided, but let's look into the dockerfiles. I chose the generic file and the downloaded WebLogic package.

Using the shell script, I build my docker image. I did have to change the docker into the podman command in the script:

  1. # ################## #
  2. # BUILDING THE IMAGE #
  3. # ################## #
  4. echo "Building image '$IMAGE_NAME' ..."
  5.  
  6. # BUILD THE IMAGE (replace all environment variables)
  7. BUILD_START=$(date '+%s')
  8. podman build --force-rm=$NOCACHE --no-cache=$NOCACHE $PROXY_SETTINGS -t $IMAGE_NAME -f Dockerfile.$DISTRIBUTION . || {
  9. echo "There was an error building the image."
  10. exit 1
  11. }
  12. BUILD_END=$(date '+%s')
  13. BUILD_ELAPSED=`expr $BUILD_END - $BUILD_START`

Run the script:

  1. ./buildDockerImage.sh -v 14.1.1.0 -g

After the build is done, I used podman to inspect the image:

Push to OCIR

I wanted to have this image in my OCI container registry, so I set up a push to OCIR. But first, you need to set up an auth token in your OCI:

  • Go to User Settings
  • Under resource, you can find how to generate.

  • Be aware to save the passphrase, because you won’t see it anymore
  • Use the passphrase to login and use double quotes!
  1. podman login fra.ocir.io
  2. Username: frce4kd4ndqf/oracleidentitycloudservice/mschildmeijer@qualogy.com
  3. Password:********
  4. Login Succeeded!
  1. podman images

I tagged my WebLogic 14 container image for pushing:

  1. podman tag oracle/weblogic:14.1.1.0-generic fra.ocir.io/frce4kd4ndqf/oracle/weblogic:14.1.1.0-generic
  2. podman push fra.ocir.io/frce4kd4ndqf/oracle/weblogic:14.1.1.0-generic

The result:

WebLogic 14 on Kubernetes

To install WebLogic on Kubernetes, the following actions need to be done:

1. Configure Helm for installing the WebLogic Kubernetes Operator 2.5 and pushing it to my OCIR. I used the Helm 2 version, OKE v3 is also supported

  1. cat << EOF | kubectl apply -f -
  2. > apiVersion: rbac.authorization.k8s.io/v1
  3. > kind: ClusterRoleBinding
  4. > metadata:
  5. > name: helm-user-cluster-admin-role
  6. > roleRef:
  7. > apiGroup: rbac.authorization.k8s.io
  8. > kind: ClusterRole
  9. > name: cluster-admin
  10. > subjects:
  11. > - kind: ServiceAccount
  12. > name: default
  13. > namespace: kube-system
  14. > EOF

2. Get the Helm client and configure it with:

  1. helm init

3. Pull the WebLogic Kunernetes Operator Image 

  1. podman pull oracle/weblogic-kubernetes-operator:2.5.0

4. Tag and push it to OCIR 

  1. podman tag oracle/weblogic-kubernetes-operator:2.5.0 fra.ocir.io/frce4kd4ndqf/oracle/weblogic-kubernetes-operator:2.5.0
  2. podman push fra.ocir.io/frce4kd4ndqf/oracle/weblogic-kubernetes-operator:2.5.0

5. Add the GitHub repo to Helm 

  1. helm repo add weblogic-operator https://oracle.github.io/weblogic-kubernetes-operator/cha
  2. rt
  1. helm repo list
  1. s
  1. helm install weblogic-operator/weblogic-operator --name weblogic-operator

etc. 

  1. helm status weblogic-operator

gives you the current status of your deployment.

WebLogic Domain

With the provided scripts from GitHub, a lot is taken care of. However, be aware of some extra actions:

  • Creation of NFS on your OKE nodes; there is no solid instruction in the Oracle GitHub docs
  • Permissions to execute stuff within your containers
  • Adjust parameters in the yamls to suit your own needs

NFS on OKE

If you want to make use of persistent volumes on OKE, you need to create an NFS share. You can find a good instruction here. However, you do need to set up console connections for your nodes. Don’t worry, this is pretty easy. Click on all your compute instances; you can find the link under resources.

This gives you the detailed command on how to connect, however: I got a log-in prompt, and for the standard OPC user there is no password known. You can find how to reset your OPC user here. After this, you can log in. 

Once logged in you can setup NFS

WebLogic Domain provisioning

Now, after doing all of the above, it's time to provision your WebLogic domain. You can find them in the cloned repository in: weblogic-kubernetes-operator/kubernetes/samples/scripts

Domain on Persistent Volume

First, I created a persistent volume and claimed to store WebLogic Artefacts out, using the yaml files:

  1. # The version of this inputs file. Do not modify.
  2. version: create-weblogic-sample-domain-pv-pvc-inputs-v1
  3.  
  4. # The base name of the pv and pvc
  5. baseName: weblogic-fourteen
  6.  
  7. # Unique ID identifying a domain.
  8. # If left empty, the generated pv can be shared by multiple domains
  9. # This ID must not contain an underscope ("_"), and must be lowercase and unique across all domains in a Kubernetes cluster.
  10. domainUID:
  11.  
  12. # Name of the namespace for the persistent volume claim
  13. namespace: default
  14.  
  15. # Persistent volume type for the persistent storage.
  16. # The value must be 'HOST_PATH' or 'NFS'.
  17. # If using 'NFS', weblogicDomainStorageNFSServer must be specified.
  18. weblogicDomainStorageType: HOST_PATH
  19.  
  20. # The server name or ip address of the NFS server to use for the persistent storage.
  21. # The following line must be uncomment and customized if weblogicDomainStorateType is NFS:
  22. #weblogicDomainStorageNFSServer: 10.0.10.2
  23.  
  24. # Physical path of the persistent storage.
  25. # When weblogicDomainStorageType is set to HOST_PATH, this value should be set the to path to the
  26. # domain storage on the Kubernetes host.
  27. # When weblogicDomainStorageType is set to NFS, then weblogicDomainStorageNFSServer should be set
  28. # to the IP address or name of the DNS server, and this value should be set to the exported path
  29. # on that server.
  30. # Note that the path where the domain is mounted in the WebLogic containers is not affected by this
  31. # setting, that is determined when you create your domain.
  32. # The following line must be uncomment and customized:
  33. weblogicDomainStoragePath: /scratch
  34.  
  35. # Reclaim policy of the persistent storage
  36. # The valid values are: 'Retain', 'Delete', and 'Recycle'
  37. weblogicDomainStorageReclaimPolicy: Retain
  38.  
  39. # Total storage allocated to the persistent storage.
  40. weblogicDomainStorageSize: 10Gi
  1. ./create-pv-pvc.sh -i create-pv-pvc-inputs.yaml -o pvc -e

Which creates the pv and pvc yaml files, plus the objects in your K8S cluster.

Now, create the jobs which are going to be used by the operator. You will find the necessary scripts to create the AdminServer and Managed Server Pods in create-weblogic-domain/domain-home-on-pv directory. You can also amend them for your own needs.

I changed the name of the domain and the location of my WebLogic image:

First you need to create 2 secrets:

- For pulling the image:

- WebLogic credentials, script can be found in

- create the domain job:

After this the pods we're created, however they remained in status Init:Error.

kubectl logs <pod> didn't give much information. A way to figure out why the pods were failing, is to do this: 

  1. kubectl get pods
  2. kubectl describe po < name of the pod>

Look at the part of the Container ID that is in init status:

  1. kubectl logs <pod-name> -c <init-containerid>

There, I found that the NFS share was not writable for the scripts to build up the domain. To resolve this, I changed the values in the create-domain-job-template.yaml. The spec / initContainer had value 0, which I changed in the opc userid (1000).

After doing this, my WebLogic domain was successfully created!

Leftovers

This proves that WebLogic 14.1.1 runs equal to the 12 versions. I also proved that Podman can be used instead of the docker-cli. The commands are more or less the same.
 

Now, this is an empty domain, so I had a few leftovers:

  • Deploying applications
  • Using Istio with JMS
  • Use GraalVM instead of Oracle Java
  • Deploy polyglot applications
  • Configure ELK
  • Configure Prometheus and Grafana
Michel Schildmeijer
About the author Michel Schildmeijer

Having made his start in the pharmacy sector, Michel transitioned to IT in 1996, working on a UNIX TTY terminal-based system and the MUMPS language. He currently works as a solutions architect at Qualogy, with a focus on middleware, application integration and service-oriented architecture. His passion for middleware started in 2000 when working as a support analyst for a financial institute with BEA WebLogic and Tuxedo. Michel is an expert on the WebLogic platform. He serves customers in his role as architect and advises them in all aspects of their IT landscape. He became an Oracle ACE in 2012 and wrote two books about WebLogic: Oracle WebLogic Server 11gR1 PS2: Administration Essentials and Oracle WebLogic Server 12c: First Look. He is a well-known speaker at national and international conferences and is recognised as an official Oracle Speaker. Read his blog: https://community.oracle.com/blogs/mnemonic

More posts by Michel Schildmeijer
Comments
Reply