Skip to content

Commit 56ec466

Browse files
authored
Develop update scaling site doc (#718)
* First pass * Cleanup mounting scalingAction.sh into the admin server pod * Fix typo * More updates, remove config map example * Complete non-WLDF, non-Prometheus updates * Fix typo, remove TODO * Fix typo * Fix typo * Fix typo * Fix more typos * Fix even more typos * fix paths to point to right branch
1 parent 69b1c33 commit 56ec466

File tree

2 files changed

+42
-89
lines changed

2 files changed

+42
-89
lines changed

site/helm-charts.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ The `helm delete` command is used to remove an operator release and its associat
103103
helm delete --purge weblogic-operator
104104
```
105105

106-
Note: if the operator's namespace did not exist before the Helm chart was installed, then Helm will create it, however, `helm delete` will not remove it.
106+
**NOTE**: if the operator's namespace did not exist before the Helm chart was installed, then Helm will create it, however, `helm delete` will not remove it.
107107

108108
## Useful Helm operations
109109

@@ -232,9 +232,9 @@ Example 2: In the configuration below, the Helm installation will manage `namesp
232232
domainNamespaces: [ "namespace1", "namespace2" ]
233233
```
234234

235-
NOTE: one must include the `default` namespace in the list if you want the operator to monitor both the `default` namespace and some other namespaces.
235+
**NOTE**: one must include the `default` namespace in the list if you want the operator to monitor both the `default` namespace and some other namespaces.
236236

237-
NOTE: these examples show two valid YAML syntax options for arrays.
237+
**NOTE**: these examples show two valid YAML syntax options for arrays.
238238

239239
### ELK integration
240240

@@ -417,7 +417,7 @@ Error: release op2 failed: rolebindings.rbac.authorization.k8s.io "weblogic-oper
417417

418418
To recover:
419419
- `helm delete --purge` the failed release
420-
- note: this deletes the role binding in the domain namespace that was created by the first operator release to give the operator access to the domain namespace
420+
- **NOTE**: this deletes the role binding in the domain namespace that was created by the first operator release to give the operator access to the domain namespace
421421
- `helm upgrade <old op release> kubernetes/charts/weblogic-operator --values <old op custom-values.yaml>`
422422
- this recreates the role binding
423423
- there might be intermittent failures in the operator for the period of time when the role binding was deleted

site/scaling.md

Lines changed: 38 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,19 @@ $ kubectl edit domain domain1 -n [namespace]
2121
Here we are editing a domain resource named 'domain1'. The `kubectl edit` command will open the domain resource definition in an editor and allow you to modify the `replicas` value directly. Once committed, the operator will be notified of the change and will immediately attempt to scale the corresponding dynamic cluster by reconciling the number of running pods/Managed Server instances with the `replicas` value specification.
2222
```
2323
spec:
24-
adminSecret:
25-
name: domain1-weblogic-credentials
26-
asName: admin-server
27-
asPort: 7001
28-
clusterStartup:
29-
- clusterName: cluster-1
30-
desiredState: RUNNING
31-
env:
32-
- name: JAVA_OPTIONS
33-
value: -Dweblogic.StdoutDebugEnabled=false
34-
- name: USER_MEM_ARGS
35-
value: '-Xms64m -Xmx256m '
36-
replicas: 1
37-
...
24+
...
25+
clusters:
26+
- clusterName: cluster-1
27+
replicas: 1
28+
...
29+
```
30+
31+
Alternatively, you can specify a default `replicas` value for all the clusters. If you do this, then you don't need to list the cluster in the domain resource (unless you want to customize another property of the cluster).
32+
```
33+
spec:
34+
...
35+
replicas: 1
36+
...
3837
```
3938

4039
## Calling the operator's REST scale API
@@ -88,55 +87,8 @@ The WebLogic Kubernetes Operator can expose both an internal and external REST H
8887
The internal REST endpoint is only accessible from within the Kubernetes cluster. The external REST endpoint
8988
is accessible from outside the Kubernetes cluster.
9089
The internal REST endpoint is enabled by default and thus always available, whereas the external REST endpoint
91-
is disabled by default and only exposed if explicitly configured. The following values, defined in the `create-weblogic-operator-inputs.yaml`,
92-
are used to enable and configure the external REST endpoint:
93-
94-
```
95-
# Options for externally exposing the operator REST HTTPS interface
96-
# (i.e. outside of the Kubernetes cluster). Valid values are:
97-
#
98-
# "NONE"
99-
# The REST interface is not exposed outside the Kubernetes cluster.
100-
#
101-
# "SELF_SIGNED_CERT"
102-
# The REST interface is exposed outside of the Kubernetes cluster on the
103-
# port specified by the 'externalRestHttpsPort' property.
104-
# A self-signed certificate and private key are generated for the REST interface.
105-
# The certificate's subject alternative names are specified by the 'externalSans'
106-
# property.
107-
#
108-
# "CUSTOM_CERT"
109-
# The REST interface is exposed outside of the Kubernetes cluster on the
110-
# port specified by the 'externalRestHttpsPort' property.
111-
# The customer supplied certificate and private key are used for the REST
112-
# interface. They are specified by the 'externalOperatorCert' and
113-
# 'eternalOperatorKey' properties.
114-
externalRestOption: NONE
115-
116-
# The node port that should be allocated for the external operator REST https interface.
117-
# This parameter is required if 'externalRestOption' is not 'NONE'.
118-
# Otherwise, it is ignored.
119-
externalRestHttpsPort: 31001
120-
121-
# The subject alternative names to put into the generated self-signed certificate
122-
# for the external WebLogic Operator REST https interface, for example:
123-
# DNS:myhost,DNS:localhost,IP:127.0.0.1
124-
# This parameter is required if 'externalRestOption' is 'SELF_SIGNED_CERT'.
125-
# Otherwise, it is ignored.
126-
externalSans:
127-
128-
# The customer supplied certificate to use for the external operator REST
129-
# https interface. The value must be a string containing a base64 encoded PEM certificate.
130-
# This parameter is required if 'externalRestOption' is 'CUSTOM_CERT'.
131-
# Otherwise, it is ignored.
132-
externalOperatorCert:
133-
134-
# The customer supplied private key to use for the external operator REST
135-
# https interface. The value must be a string containing a base64 encoded PEM key.
136-
# This parameter is required if 'externalRestOption' is 'CUSTOM_CERT'.
137-
# Otherwise, it is ignored.
138-
externalOperatorKey:
139-
```
90+
is disabled by default and only exposed if explicitly configured.
91+
Detailed instructions for configuring the external REST endpoint are available [here](helm-charts.md).
14092

14193
**NOTE**: Regardless of which endpoint is being invoked, the URL format for scaling is the same.
14294

@@ -149,21 +101,21 @@ When the operator receives a scaling request, it will:
149101
* Validate that the WebLogic cluster, identified by `clusterName`, exists.
150102
* Verify that the specified WebLogic cluster has a sufficient number of configured servers to satisfy the scaling request.
151103
* Initiate scaling by setting the `replicas` property within the corresponding domain resource, which can be done in either:
152-
* A `clusterStartup` entry, if defined within its cluster list.
153-
* At the domain level, if not defined in a `clusterStartup` entry and the `startupControl` property is set to `AUTO`.
104+
* A `cluster` entry, if defined within its cluster list.
105+
* At the domain level, if not defined in a `cluster` entry.
154106

155107
In response to a change to either `replicas` property, in the domain resource, the operator will increase or decrease the number of pods (Managed Servers) to match the desired replica count.
156108

157109
## Using a WLDF policy rule and script action to call the operator's REST scale API
158110
The WebLogic Diagnostics Framework (WLDF) is a suite of services and APIs that collect and surface metrics that provide visibility into server and application performance.
159111
To support automatic scaling of WebLogic clusters in Kubernetes, WLDF provides the Policies and Actions component, which lets you write policy expressions for automatically executing scaling
160112
operations on a cluster. These policies monitor one or more types of WebLogic Server metrics, such as memory, idle threads, and CPU load. When the configured threshold
161-
in a policy is met, the policy is triggered, and the corresponding scaling action is executed. The WebLogic Kubernetes Operator project provides a shell script, [`scalingAction.sh`](https://github.com/oracle/weblogic-kubernetes-operator/blob/master/src/scripts/scaling/scalingAction.sh),
113+
in a policy is met, the policy is triggered, and the corresponding scaling action is executed. The WebLogic Kubernetes Operator project provides a shell script, [`scalingAction.sh`](/src/scripts/scaling/scalingAction.sh),
162114
for use as a Script Action, which illustrates how to issue a request to the operator’s REST endpoint.
163115

164116
### Configure automatic scaling of WebLogic clusters in Kubernetes with WLDF
165117
The following steps are provided as a guideline on how to configure a WLDF Policy and Script Action component for issuing scaling requests to the operator's REST endpoint:
166-
1. Copy the [`scalingAction.sh`](https://github.com/oracle/weblogic-kubernetes-operator/blob/master/src/scripts/scaling/scalingAction.sh) script to a directory (such as `$DOMAIN_HOME/bin/scripts`) so that it's accessible within the Administration Server pod.
118+
1. Copy the [`scalingAction.sh`](/src/scripts/scaling/scalingAction.sh) script to a directory (such as `$DOMAIN_HOME/bin/scripts`) so that it's accessible within the Administration Server pod.
167119
2. Configure a WLDF policy and action as part of a diagnostic module targeted to the Administration Server. For information about configuring the WLDF Policies and Actions component,
168120
see [Configuring Policies and Actions](https://docs.oracle.com/middleware/1221/wls/WLDFC/config_watch_notif.htm#WLDFC188) in _Configuring and Using the Diagnostics Framework for Oracle WebLogic Server_.
169121

@@ -173,22 +125,19 @@ see [Configuring Policies and Actions](https://docs.oracle.com/middleware/1221/w
173125

174126
Important notes about the configuration properties for the Script Action:
175127

176-
`Working Directory` and `Path to Script` configuration entries specify the volume mount path (`/shared`) to access the WebLogic domain home.
177128
The `scalingAction.sh` script requires access to the SSL certificate of the operator’s endpoint and this is provided through the environment variable `INTERNAL_OPERATOR_CERT`.
178129
The operator’s SSL certificate can be found in the `internalOperatorCert` entry of the operator’s ConfigMap `weblogic-operator-cm`:
179130

180131
For example:
181132
```
182133
#> kubectl describe configmap weblogic-operator-cm -n weblogic-operator
183-
Name: `weblogic-operator-cm`
184-
Namespace: `weblogic-operator`
185-
Labels: `weblogic.operatorName=weblogic-operator`
186-
Annotations: `kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","data":{"externalOperatorCert":"","internalOperatorCert":"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0t...`
134+
...
187135
Data
188136
====
189137
internalOperatorCert:
190138
----
191139
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUR3akNDQXFxZ0F3SUJBZ0lFRzhYT1N6QU...
140+
...
192141
```
193142

194143
The scalingAction.sh script accepts a number of customizable parameters:
@@ -199,7 +148,7 @@ see [Configuring Policies and Actions](https://docs.oracle.com/middleware/1221/w
199148

200149
* `cluster_name` - WebLogic cluster name (Required)
201150

202-
* `kubernetes_master` - Kubernetes master URL, default=https://kubernetes
151+
* `kubernetes_master` - Kubernetes master URL, default=https://kubernetes. **NOTE**: Set this to https://kubernetes.default.svc when invoking `scalingAction.sh` from the Administration Server pod.
203152

204153
* `access_token` - Service Account Bearer token for authentication and authorization for access to REST Resources
205154

@@ -285,19 +234,23 @@ you can use a third party monitoring application like Prometheus. Please read t
285234
details about [Using Prometheus to Automatically Scale WebLogic Clusters on Kubernetes](https://blogs.oracle.com/weblogicserver/using-prometheus-to-automatically-scale-weblogic-clusters-on-kubernetes-v5).
286235

287236
## Helpful Tips
288-
### Debugging scriptAction.sh
289-
The [`scalingAction.sh`](https://github.com/oracle/weblogic-kubernetes-operator/blob/master/src/scripts/scaling/scalingAction.sh) script was designed to be executed within the
290-
Administration Server pod because the associated diagnostic module is targed to the Administration Server. The easiest way to verify and debug the `scriptAction.sh` script is
291-
to open a shell on the running Administration Server pod and execute the script on the command line. The following example illustrates how to open a bash shell on a running
292-
Administration Server pod named `domain1-admin-server` and execute the `scriptAction.sh` script:
237+
### Debugging scalingAction.sh
238+
The [`scalingAction.sh`](/src/scripts/scaling/scalingAction.sh) script was designed to be executed within the
239+
Administration Server pod because the associated diagnostic module is targed to the Administration Server.
240+
241+
The easiest way to verify and debug the `scalingAction.sh` script is to open a shell on the running Administration Server pod and execute the script on the command line.
242+
243+
The following example illustrates how to open a bash shell on a running Administration Server pod named `domain1-admin-server` and execute the `scriptAction.sh` script. It assumes that:
244+
* the domain home is in `/u01/oracle/user-projects/domains/domain1` (i.e. the domain home is inside a docker image).
245+
* the Dockerfile copied [`scalingAction.sh`](/src/scripts/scaling/scalingAction.sh) to `/u01/oracle/user-projects/domains/domain1/bin/scripts/scalingAction.sh`.
293246

294247
```
295248
> kubectl exec -it domain1-admin-server /bin/bash
296-
# bash> cd /shared/domain/base_domain/bin/scripts
297-
# bash> ./scriptAction.sh
249+
# bash> cd /u01/oracle/user-projects/domains/domain1/bin/scripts
250+
# bash> ./scalingAction.sh
298251
```
299252

300-
A log, `scriptAction.log`, will be generated in the same directory as the script was executed in and can be examined for errors.
253+
A log, `scalingAction.log`, will be generated in the same directory as the script was executed in and can be examined for errors.
301254

302255
### Example on accessing the external REST endpoint
303256
The easiest way to test scaling using the external REST endpoint is to use a command-line tool like `curl`. Using `curl` to issue
@@ -309,7 +262,7 @@ an HTTPS scale request requires these mandatory header properties:
309262
The following shell script is an example of how to issue a scaling request, with the necessary HTTP request header values, using `curl`.
310263
This example assumes the operator and domain resource are configured with the following properties in Kubernetes:
311264
* Operator properties:
312-
* externalRestOption: `SELF_SIGNED_CERT`
265+
* externalRestEnabled: `true`
313266
* externalRestHttpsPort: `31001`
314267
* operator's namespace: `weblogic-operator`
315268
* operator's hostname is the same as the host shell script is executed on.
@@ -323,14 +276,14 @@ This example assumes the operator and domain resource are configured with the fo
323276
# Setup properties
324277
ophost=`uname -n`
325278
opport=31001 #externalRestHttpsPort
326-
cluster=DockerCluster
279+
cluster=cluster-1
327280
size=3 #New cluster size
328-
domdir=${PWD}
329281
ns=weblogic-operator # Operator NameSpace
282+
sa=weblogic-operator # Operator ServiceAccount
330283
domainuid=domain1
331284
332285
# Retrieve service account name for given namespace
333-
sec=`kubectl get serviceaccount ${ns} -n ${ns} -o jsonpath='{.secrets[0].name}'`
286+
sec=`kubectl get serviceaccount ${sa} -n ${ns} -o jsonpath='{.secrets[0].name}'`
334287
#echo "Secret [${sec}]"
335288
336289
# Retrieve base64 encoded secret for the given service account

0 commit comments

Comments
 (0)