|
| 1 | +# Restarting Oracle WebLogic Server in Kubernetes |
| 2 | + |
| 3 | +This document describes when to restart servers in the Oracle WebLogic Server in Kubernetes environment. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +There are many situations where changes to the Oracle WebLogic Server in Kubernetes environment require that all the servers in |
| 8 | +a domain or cluster be restarted, for example, when applying a WebLogic Server patch or when upgrading an application. |
| 9 | + |
| 10 | +One of the operator's most important jobs is to start and stop WebLogic Servers by creating and deleting their corresponding Kubernetes pods. Sometimes, you need to make changes that make the pods obsolete, therefore the pods need to be deleted and recreated. Depending on the change, sometimes the pods can be gradually recreated, without taking the entire domain out of service |
| 11 | +(for example, `rolling restarts`) and sometimes all the pods need to be deleted then recreated, taking the entire domain out of |
| 12 | +service for a while (for example, `full restarts`). |
| 13 | + |
| 14 | +The following types of server restarts are supported in Oracle WebLogic Server in Kubernetes: |
| 15 | + |
| 16 | +* Rolling restarts - a coordinated and controlled shut down of all of the servers in a domain or cluster while ensuring that service to the end user is not interrupted. |
| 17 | + |
| 18 | + * Operator initiated - where the WebLogic Kubernetes Operator can detect some types of changes and will automatically initiate rolling restarts of server pods in a WebLogic domain. |
| 19 | + |
| 20 | + * Manually initiated - required when certain changes in the Oracle WebLogic Server in Kubernetes environment cannot be detected by the operator, so a rolling restart must be manually initiated. |
| 21 | + |
| 22 | +* Full domain restarts - the Administration Server and all the Managed Servers in a domain are shutdown, impacting service availability to the end user, and then restarted. Unlike a rolling restart, the operator cannot detect and initiate a full domain restart; it must always be manually initiated. |
| 23 | + |
| 24 | +For detailed information on how to restart servers in a Oracle WebLogic Server in Kubernetes environment, see [Starting, stopping, and restarting servers](server-lifecycle.md). |
| 25 | + |
| 26 | +## Common restart scenarios |
| 27 | + |
| 28 | +This document describes what actions you need to take to properly restart your servers for a number of common scenarios: |
| 29 | + |
| 30 | +* Modifying the WebLogic configuration |
| 31 | +* Changing the custom domain configuration overrides (also called situational configuration) |
| 32 | +* Changing the WebLogic Server credentials (the user name and password) |
| 33 | +* Changing properties on the domain resource that affect server pods (such as `image`, `volumes`, and `env`) |
| 34 | +* Applying WebLogic Server patches |
| 35 | +* Updating deployed applications for domain home in image |
| 36 | + |
| 37 | +### Use cases |
| 38 | + |
| 39 | +#### Modifying the WebLogic configuration |
| 40 | + |
| 41 | +Changes to the Oracle WebLogic Server configuration may require either a rolling or full domain restart depending on the domain home location and the type of configuration change. |
| 42 | + |
| 43 | +* **Domain home in image:** |
| 44 | +For domain home in image, any changes (dynamic or non-dynamic) to the WebLogic configuration requires a full domain restart. |
| 45 | + * If you create a new image with a new name, then you must avoid a rolling restart, which can cause unexpected behavior for the running domain due to configuration inconsistencies as seen by the various servers, by following the steps in [Avoiding a rolling restart when changing image property on a domain resource](restart.md#avoiding-a-rolling-restart-when-changing-image-property-on-a-domain-resource). |
| 46 | + * If you create a new image with the same name, then you must manually initiate a full domain restart. See [Full domain restarts](server-lifecycle.md#full-domain-restarts) in Starting, stopping, and restarting servers. |
| 47 | + |
| 48 | + |
| 49 | +* **Domain home on PV:** |
| 50 | +For domain home on PV, the type of restart needed to apply the changes, depends on the nature of the WebLogic configuration change: |
| 51 | + * Changes to parts of the WebLogic configuration that the operator introspects, require a full restart, even if the changes are dynamic. |
| 52 | + The following are the types of changes to the WebLogic Server configuration that the operator introspects: |
| 53 | + * Adding or removing a cluster, server, dynamic server, or network access point |
| 54 | + * Changing a cluster, server, dynamic server, or network access point name |
| 55 | + * Enabling or disabling the listen port, SSL port, or admin port |
| 56 | + * Changing any port numbers |
| 57 | + * Changing a network access point's public address |
| 58 | + * Other dynamic WebLogic configuration changes do not require a restart. For example, a change to a server's connection timeout property |
| 59 | +is dynamic and does not require a restart. |
| 60 | + * Other non-dynamic WebLogic configuration changes require either a manually initiated rolling restart or a full domain restart, depending on the nature of the change. |
| 61 | + For example, a rolling restart is applicable when changing a WebLogic Server's `stuck thread timer interval` property. See [Restart all the servers in the domain](server-lifecycle.md#restart-all-the-servers-in-the-domain) in Starting, stopping, and restarting servers. |
| 62 | + |
| 63 | + |
| 64 | +#### Changing the custom domain configuration overrides |
| 65 | + |
| 66 | +Any change to domain configuration overrides requires a full domain restart. This includes: |
| 67 | + * Changing the domain resource's `configOverides` to point to a different configuration map |
| 68 | + * Changing the domain resource's `configOverridesSecrets` to point to a different list of secrets |
| 69 | + * Changing the contents of the configuration map referenced by `configOverrides` |
| 70 | + * Changing the contents to any of the secrets referenced by `configOverridesSecrets` |
| 71 | + |
| 72 | +#### Changing the WebLogic Server credentials |
| 73 | + |
| 74 | +A change to the WebLogic Server credentials (the user name and password), contained in the Kubernetes secret for the domain, requires a |
| 75 | +_full domain restart_. The Kubernetes secret can be updated directly or a new secret can be created and then referenced by the `webLogicCredentialsSecret` |
| 76 | +property in the domain resource. |
| 77 | + |
| 78 | +#### Changing properties on the domain resource that affect server pods |
| 79 | + |
| 80 | +The operator will initiate a rolling restart of the domain when you modify any of the domain resource properties that affect the server pods configuration, |
| 81 | +such as `image`, `volumes`, and `env`. For a complete list, see [Properties that cause servers to be restarted](server-lifecycle.md#properties-that-cause-servers-to-be-restarted) in Starting, stopping, and restarting servers. |
| 82 | + |
| 83 | +You can modify these properties using the `kubectl` command-line tool's `edit` and `patch` commands or through the Kubernetes REST API. |
| 84 | + |
| 85 | +For example, to edit the domain resource directly using the `kubectl` command-line tool: |
| 86 | + |
| 87 | +``` |
| 88 | +kubectl edit domain <domain name> -n <domain namespace> |
| 89 | +``` |
| 90 | + |
| 91 | +The `edit` command opens a text editor which lets you edit the domain resource in place. |
| 92 | + |
| 93 | +**Note**: Typically, it's better to edit the domain resource directly; otherwise, if you scaled the domain, and you just edit the original `domain.yaml` file and reapply it, you could go back to your old replicas count. |
| 94 | + |
| 95 | +#### Applying WebLogic Server patches |
| 96 | + |
| 97 | +Oracle provides different types of patches for WebLogic Server, such as Patch Set Updates, Security Patch Updates, and One-Off patches. |
| 98 | +Information on whether a patch is rolling compatible or requires a manual full domain restart usually can be found in the patch's documentation, such as the README file. |
| 99 | + |
| 100 | +WebLogic Server patches can be applied to either a domain home in image or a domain home on PV: |
| 101 | + |
| 102 | +With rolling compatible patches: |
| 103 | +* If you update the `image` property with a new image name, then the operator will initiate a rolling restart. |
| 104 | +* If you keep the same image name, then you must manually initiate a rolling restart. See [Restart all the servers in the domain](server-lifecycle.md#restart-all-the-servers-in-the-domain) in Starting, stopping, and restarting servers. |
| 105 | + |
| 106 | +With patches that are not rolling compatible: |
| 107 | +* If you keep the same image name, then you must manually initiate a full domain restart. See [Full domain restarts](server-lifecycle.md#full-domain-restarts) in Starting, stopping, and restarting servers. |
| 108 | +* If you update the `image` property with a new image name, then you must avoid the rolling restart by following the steps in [Avoiding a rolling restart when changing image property on a domain resource](restart.md#Avoiding-a-rolling-restart-when-changing-image-property-on-a-domain-resource). |
| 109 | + |
| 110 | +#### Updating deployed applications for domain home in image |
| 111 | + |
| 112 | +Frequent updates of deployed applications using a continuous integration/continuous delivery (CI/CD) process is a very common use case. |
| 113 | +The process for applying an updated application is different for domain home in image than it is for domain home on PV. |
| 114 | +A rolling compatible application update is where some servers are running the old version and some are running the new version |
| 115 | +of the application during the rolling restart process. On the other hand, an application update that is not rolling compatible requires that all the servers |
| 116 | +in the domain be shutdown and restarted. |
| 117 | + |
| 118 | +If the application update is rolling compatible: |
| 119 | +* If you update the `image` property with a new image name, then the operator will initiate a rolling restart. |
| 120 | +* If you keep the same image name, then you must manually initiate a rolling restart. See [Restart all the servers in the domain](server-lifecycle.md#restart-all-the-servers-in-the-domain) in Starting, stopping, and restarting servers. |
| 121 | + |
| 122 | +If the application update is not rolling compatible: |
| 123 | +* If you keep the same image name, then you must manually initiate a full domain restart. See [Full domain restarts](server-lifecycle.md#full-domain-restarts) in Starting, stopping, and restarting servers. |
| 124 | +* If you update the `image` property with a new image name, then you must avoid the rolling restart by following the steps in [Avoiding a rolling restart when changing image property on a domain resource](restart.md#Avoiding-a-rolling-restart-when-changing-image-property-on-a-domain-resource). |
| 125 | + |
| 126 | +## Rolling out an updated domain home in image |
| 127 | + |
| 128 | +Follow these steps to create new rolling compatible image if you only need to patch your WebLogic Server domain or update application deployment files: |
| 129 | + |
| 130 | +1. Select a different name for the new image. |
| 131 | + |
| 132 | +2. Using the same domain home-in-image Docker image as a base, create a new Docker image by copying (`COPY` |
| 133 | +command in a Dockerfile) the updated application deployment files or WebLogic Server patches into the Docker image during the Docker image build. |
| 134 | + |
| 135 | + **NOTE**: The key here is to make sure that you do not re-run WLST or WDT to create a new domain home even though it will |
| 136 | + have the same configuration. Creating a new domain will change the domain secret and you won't be able to do a |
| 137 | + rolling restart. |
| 138 | + |
| 139 | +3. Deploy the new Docker image to your Docker repository with the new name. |
| 140 | +4. Update the `image` property of the domain resource specifying the new image name. |
| 141 | + |
| 142 | + For example: |
| 143 | + |
| 144 | + ``` |
| 145 | + domain: |
| 146 | + spec: |
| 147 | + image: oracle/weblogic-updated:2.0 |
| 148 | + ``` |
| 149 | +5. The operator will now initiate a rolling restart, which will apply the updated image, for all the server pods in the domain. |
| 150 | +
|
| 151 | +## Avoiding a rolling restart when changing `image` property on a domain resource |
| 152 | +If you've created a new image that is not rolling compatible, and you've changed the image name, then: |
| 153 | +
|
| 154 | +1. Bring the domain down (stopping all the server pods) by setting the `serverStartPolicy` to `NEVER`. See [Shut down all the servers](server-lifecycle.md#shut-down-all-the-servers) in Starting, stopping, and restarting servers. |
| 155 | +
|
| 156 | +2. Update the `image` property with a new image name. |
| 157 | +
|
| 158 | +3. Start up the domain (starting all the server pods) by setting the `serverStartPolicy` to `IF_NEEDED`. |
| 159 | +
|
| 160 | +## Other considerations for restarting a domain |
| 161 | +
|
| 162 | +* **Consider the order of changes**: |
| 163 | +
|
| 164 | + If you need to make multiple changes to your domain at the same time, you'll want to be careful |
| 165 | + about the order in which you do your changes, so that servers aren't restarted prematurely or restarted needlessly. |
| 166 | + For example, if you want to change the readiness probe's tuning parameters and the Java options (both of which are rolling compatible), then you should update the domain resource once, changing both values, |
| 167 | + so that the operator rolling restarts the servers once. Or, if you want to change the readiness probe's tuning parameters (which is rolling compatible) |
| 168 | + and change the domain customizations (which require a full restart), then you should do a full shutdown first, |
| 169 | + then make the changes, and then restart the servers. |
| 170 | +
|
| 171 | + Alternatively, if you know that your set of changes are not rolling compatible, then you must avoiding a rolling restart by: |
| 172 | +
|
| 173 | + 1. Bringing the domain down (stopping all the server pods) by setting the `serverStartPolicy` to `NEVER`. See [Shut down all the servers](server-lifecycle.md#shut-down-all-the-servers) in Starting, stopping, and restarting servers. |
| 174 | +
|
| 175 | + 2. Make all your changes to the Oracle WebLogic Server in Kubernetes environment. |
| 176 | +
|
| 177 | + 3. Starting up the domain (starting all the server pods) by setting the `serverStartPolicy` to `IF_NEEDED`. |
| 178 | +
|
| 179 | +* **Changes that require domain knowledge**. |
| 180 | +
|
| 181 | + Sometimes you need to make changes that require server restarts, yet the changes are not to the WebLogic configuration, |
| 182 | + the image, or the Kubernetes resources that register your domain with the operator. For example, your servers are caching information from an external database and you've modified the contents of the database. |
| 183 | +
|
| 184 | + In these cases, you must manually initiate a restart. |
0 commit comments