For use in the following steps:
Create a Kubernetes Secret for the WebLogic domain administrator credentials containing the username
and password
for the domain, using the create-weblogic-credentials script:
$ kubernetes/samples/scripts/create-weblogic-domain-credentials/create-weblogic-credentials.sh \
-u <username> -p <password> -n sample-domain1-ns -d sample-domain1
The sample will create a secret named domainUID-weblogic-credentials
where the domainUID
is replaced
with the value specified by the -d
flag. For example, the command above would create a secret named
sample-domain1-weblogic-credentials
.
Create a new image with a domain home, plus create a domain resource that the operator will use to deploy the image, by running the create-domain script.
The script’s behavior is controlled by an inputs file plus command-line options. The script downloads the WebLogic Image Tool and WebLogic Deploy Tool and uses these tools to create a new image with a domain home. The script also creates a domain resource YAML file that references the image, and, if the -e
option is specified, deploys the domain resource to Kubernetes. For a detailed understanding of the steps that the create-domain.sh
script performs for you, see the bulleted items under Use the script to create a domain
The create-domain.sh
script and its inputs file are for demonstration purposes only; its contents and the domain resource file that it generates for you might change without notice. In production, we strongly recommend that you use the WebLogic Image Tool and WebLogic Deploy Tooling (when applicable), and directly work with domain resource files instead.
First, copy the sample create-domain-inputs.yaml file and update your copy with:
domainUID
: sample-domain1
image
: Leave empty unless you need to tag the new image that the script builds to a different name.
For example if you are using a remote cluster that will need to pull the image from a container registry,
then you should set this value to the fully qualified image name. Note that you will need to
push the image manually.weblogicCredentialsSecretName
: sample-domain1-weblogic-credentials
namespace
: sample-domain1-ns
domainHomeImageBase
: container-registry.oracle.com/middleware/weblogic:12.2.1.4
For example, assuming you named your copy my-inputs.yaml
:
$ cd kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image
$ ./create-domain.sh -i my-inputs.yaml -o /<your output directory> -u <username> -p <password> -e
You need to provide the same WebLogic domain administrator user name and password in the -u
and -p
options
respectively, as you provided when creating the Kubernetes Secret in Step 2.
For the detailed steps that the create-domain.sh
script performs, see Domain Home In Image.
Confirm that the operator started the servers for the domain:
a. Use kubectl
to show that the Domain was created:
$ kubectl describe domain sample-domain1 -n sample-domain1-ns
b. After a short time, you will see the Administration Server and Managed Servers running.
$ kubectl get pods -n sample-domain1-ns
c. You should also see all the Kubernetes Services for the domain.
$ kubectl get services -n sample-domain1-ns
Create an ingress for the domain, in the domain namespace, by using the sample Helm chart:
$ helm install sample-domain1-ingress kubernetes/samples/charts/ingress-per-domain \
--namespace sample-domain1-ns \
--set wlsDomain.domainUID=sample-domain1 \
--set traefik.hostname=sample-domain1.org
To confirm that the ingress controller noticed the new ingress and is successfully routing to the domain’s server pods, you can send a request to the URL for the “WebLogic ReadyApp framework”, as shown in the example below, which will return an HTTP 200 status code.
$ curl -v -H 'host: sample-domain1.org' http://localhost:30305/weblogic/ready
About to connect() to localhost port 30305 (#0)
Trying 10.196.1.64...
Connected to localhost (10.196.1.64) port 30305 (#0)
> GET /weblogic/ HTTP/1.1
> User-Agent: curl/7.29.0
> Accept: */*
> host: domain1.org
>
< HTTP/1.1 200 OK
< Content-Length: 0
< Date: Thu, 20 Dec 2018 14:52:22 GMT
< Vary: Accept-Encoding
< Connection #0 to host localhost left intact
Depending on where your Kubernetes cluster is running, you may need to open firewall ports or update security lists to allow ingress to this port.
To access the WebLogic Server Administration Console:
a. Edit the my-inputs.yaml
file (assuming that you named your copy my-inputs.yaml
) to set exposedAdminNodePort: true
.
b. Open a browser to http://localhost:30701
.
Do not use the WebLogic Server Administration Console to start or stop servers. See Starting and stopping servers.