Domain Life Cycle

As OAM domains use the WebLogic Kubernetes Operator, domain lifecyle operations are managed using the WebLogic Kubernetes Operator itself.

This document shows the basic operations for starting, stopping and scaling servers in the OAM domain.

For more detailed information refer to Domain Life Cycle in the WebLogic Kubernetes Operator documentation.

Do not use the WebLogic Server Administration Console or Oracle Enterprise Manager Console to start or stop servers.

View existing OAM servers

The default OAM deployment starts the AdminServer (AdminServer), two OAM Managed Servers (oam_server1 and oam_server2) and one OAM Policy Manager server (oam_policy_mgr1).

The deployment also creates, but doesn’t start, three extra OAM Managed Servers (oam-server3 to oam-server5) and four more OAM Policy Manager servers (oam_policy_mgr2 to oam_policy_mgr5).

All these servers are visible in the WebLogic Server Console https://${MASTERNODE-HOSTNAME}:${MASTERNODE-PORT}/console by navigating to Domain Structure > oamcluster > Environment > Servers.

To view the running servers using kubectl, run the following command:

$ kubectl get pods -n <domain_namespace>

For example:

$ kubectl get pods -n oamns

The output should look similar to the following:

NAME                                            READY   STATUS             RESTARTS   AGE
accessdomain-adminserver                         1/1     Running     0          18h
accessdomain-create-oam-infra-domain-job-vj69h   0/1     Completed   0          23h
accessdomain-oam-policy-mgr1                     1/1     Running     0          18h
accessdomain-oam-server1                         1/1     Running     0          18h
accessdomain-oam-server2                         1/1     Running     0          18h
helper                                           1/1     Running     0          40h

Starting/Scaling up OAM Managed Servers

The number of OAM Managed Servers running is dependent on the replicas parameter configured for the cluster. To start more OAM Managed Servers perform the following steps:

  1. Run the following kubectl command to edit the domain:

    $ kubectl edit domain <domain_uid> -n <domain_namespace>
    

    For example:

    $ kubectl edit domain accessdomain -n oamns
    

    Note: This opens an edit session for the domain where parameters can be changed using standard vi commands.

  2. In the edit session search for clusterName: oam_cluster and look for the replicas parameter. By default the replicas parameter is set to “2” hence two OAM Managed Servers are started (oam_server1 and oam_server2):

      clusters:
      - clusterName: oam_cluster
        replicas: 2
        serverPod:
          affinity:
            podAntiAffinity:
              preferredDuringSchedulingIgnoredDuringExecution:
              - podAffinityTerm:
                  labelSelector:
                    matchExpressions:
                    - key: weblogic.clusterName
                      operator: In
                      values:
                      - $(CLUSTER_NAME)
    
  3. To start more OAM Managed Servers, increase the replicas value as desired. In the example below, two more managed servers will be started by setting replicas to “4”:

      clusters:
      - clusterName: oam_cluster
        replicas: 4
        serverPod:
          affinity:
            podAntiAffinity:
              preferredDuringSchedulingIgnoredDuringExecution:
              - podAffinityTerm:
                  labelSelector:
                    matchExpressions:
                    - key: weblogic.clusterName
                      operator: In
                      values:
                      - $(CLUSTER_NAME)
    
  4. Save the file and exit (:wq!)

    The output will look similar to the following:

    domain.weblogic.oracle/accessdomain edited
    
  5. Run the following kubectl command to view the pods:

    $ kubectl get pods -n <domain_namespace>
    

    For example:

    $ kubectl get pods -n oamns
    

    The output will look similar to the following:

    NAME                                            READY   STATUS      RESTARTS   AGE
    accessdomain-adminserver                         1/1     Running     0          18h
    accessdomain-create-oam-infra-domain-job-vj69h   0/1     Completed   0          23h
    accessdomain-oam-policy-mgr1                     1/1     Running     0          18h
    accessdomain-oam-server1                         1/1     Running     0          18h
    accessdomain-oam-server2                         1/1     Running     0          18h
    accessdomain-oam-server3                         0/1     Running     0          6s
    accessdomain-oam-server4                         0/1     Running     0          6s
    helper                                           1/1     Running     0          40h
    

    Two new pods (accessdomain-oam-server3 and accessdomain-oam-server4) are started, but currently have a READY status of 0/1. This means oam_server3 and oam_server4 are not currently running but are in the process of starting. The servers will take several minutes to start so keep executing the command until READY shows 1/1:

    NAME                                            READY   STATUS      RESTARTS   AGE
    accessdomain-adminserver                         1/1     Running     0          18h
    accessdomain-create-oam-infra-domain-job-vj69h   0/1     Completed   0          24h
    accessdomain-oam-policy-mgr1                     1/1     Running     0          18h
    accessdomain-oam-server1                         1/1     Running     0          18h
    accessdomain-oam-server2                         1/1     Running     0          18h
    accessdomain-oam-server3                         1/1     Running     0          5m5s
    accessdomain-oam-server4                         1/1     Running     0          5m5s
    helper                                           1/1     Running     0          41h
    

    Note: To check what is happening during server startup when READY is 0/1, run the following command to view the log of the pod that is starting:

    $ kubectl logs <pod> -n <domain_namespace>
    

    For example:

    $ kubectl logs accessdomain-oam-server3 -n oamns
    
  6. To start more OAM Policy Manager servers, repeat the previous commands but change the replicas parameter for the policy_cluster. In the example below replicas has been increased to “2”:

      - clusterName: policy_cluster
        replicas: 2
        serverPod:
          affinity:
            podAntiAffinity:
              preferredDuringSchedulingIgnoredDuringExecution:
              - podAffinityTerm:
                  labelSelector:
                    matchExpressions:
                    - key: weblogic.clusterName
                      operator: In
                      values:
                      - $(CLUSTER_NAME)
    

    After saving the changes a new pod will be started. After a few minutes it will have a READY status of 1/1. In the example below accessdomain-oam-policy-mgr2 is started:

    NAME                                            READY   STATUS      RESTARTS   AGE
    accessdomain-adminserver                         1/1     Running     0          18h
    accessdomain-create-oam-infra-domain-job-vj69h   0/1     Completed   0          24h
    accessdomain-oam-policy-mgr1                     1/1     Running     0          18h
    accessdomain-oam-policy-mgr2                     1/1     Running     0          4m3s
    accessdomain-oam-server1                         1/1     Running     0          18h
    accessdomain-oam-server2                         1/1     Running     0          18h
    accessdomain-oam-server3                         1/1     Running     0          10m
    accessdomain-oam-server4                         1/1     Running     0          10m
    helper                                           1/1     Running     0          41h
    

Stopping/Scaling down OAM Managed Servers

As mentioned in the previous section, the number of OAM Managed Servers running is dependent on the replicas parameter configured for the cluster. To stop one or more OAM Managed Servers, perform the following:

  1. Run the following kubectl command to edit the domain:

    $ kubectl edit domain <domain_uid> -n <domain_namespace>
    

    For example:

    $ kubectl edit domain accessdomain -n oamns
    
  2. In the edit session search for “clusterName: oam_cluster” and look for the replicas parameter. In the example below replicas is set to “4”, hence four OAM Managed Servers are started (oam_server1 - oam_server4):

      clusters:
      - clusterName: oam_cluster
        replicas: 4
        serverPod:
          affinity:
            podAntiAffinity:
              preferredDuringSchedulingIgnoredDuringExecution:
              - podAffinityTerm:
                  labelSelector:
                    matchExpressions:
                    - key: weblogic.clusterName
                      operator: In
                      values:
                      - $(CLUSTER_NAME)
    
  3. To stop OAM Managed Servers, decrease the replicas value as desired. In the example below, we will stop two managed servers by setting replicas to “2”:

      clusters:
      - clusterName: oam_cluster
        replicas: 2
        serverPod:
          affinity:
            podAntiAffinity:
              preferredDuringSchedulingIgnoredDuringExecution:
              - podAffinityTerm:
                  labelSelector:
                    matchExpressions:
                    - key: weblogic.clusterName
                      operator: In
                      values:
                      - $(CLUSTER_NAME)
    
  4. Save the file and exit (:wq!)

  5. Run the following kubectl command to view the pods:

    $ kubectl get pods -n <domain_namespace>
    

    For example:

    $ kubectl get pods -n oamns
    

    The output will look similar to the following:

    NAME                                            READY   STATUS        RESTARTS   AGE
    accessdomain-adminserver                         1/1     Running       0          18h
    accessdomain-create-oam-infra-domain-job-vj69h   0/1     Completed     0          24h
    accessdomain-oam-policy-mgr1                     1/1     Running       0          18h
    accessdomain-oam-policy-mgr2                     1/1     Running       0          5m21s
    accessdomain-oam-server1                         1/1     Running       0          18h
    accessdomain-oam-server2                         1/1     Running       0          18h
    accessdomain-oam-server3                         1/1     Terminating   0          12m
    accessdomain-oam-server4                         1/1     Terminating   0          12m
    helper                                           1/1     Running       0          41h
    

    Two pods now have a STATUS of Terminating (accessdomain-oam-server3 and accessdomain-oam-server4). The servers will take a minute or two to stop, so keep executing the command until the pods have disappeared:

    NAME                                            READY   STATUS      RESTARTS   AGE
    accessdomain-adminserver                         1/1     Running     0          18h
    accessdomain-create-oam-infra-domain-job-vj69h   0/1     Completed   0          24h
    accessdomain-oam-policy-mgr1                     1/1     Running     0          18h
    accessdomain-oam-policy-mgr2                     1/1     Running     0          6m3s
    accessdomain-oam-server1                         1/1     Running     0          18h
    accessdomain-oam-server2                         1/1     Running     0          18h
    helper                                           1/1     Running     0          41h
    
  6. To stop OAM Policy Manager servers, repeat the previous commands but change the replicas parameter for the policy_cluster. In the example below replicas has been decreased from “2” to “1”:

      - clusterName: policy_cluster
        replicas: 1
        serverPod:
          affinity:
            podAntiAffinity:
              preferredDuringSchedulingIgnoredDuringExecution:
              - podAffinityTerm:
                  labelSelector:
                    matchExpressions:
                    - key: weblogic.clusterName
                      operator: In
                      values:
                      - $(CLUSTER_NAME)
    

    After saving the changes one pod will move to a STATUS of Terminating (accessdomain-oam-policy-mgr2).

    NAME                                            READY   STATUS        RESTARTS   AGE
    accessdomain-adminserver                         1/1     Running       0          18h
    accessdomain-create-oam-infra-domain-job-vj69h   0/1     Completed     0          24h
    accessdomain-oam-policy-mgr1                     1/1     Running       0          18h
    accessdomain-oam-policy-mgr2                     1/1     Terminating   0          7m12s
    accessdomain-oam-server1                         1/1     Running       0          18h
    accessdomain-oam-server2                         1/1     Running       0          18h
    helper                                           1/1     Running       0          41h
    

    The server will take a minute or two to stop, so keep executing the command until the pod has disappeared:

    NAME                                            READY   STATUS      RESTARTS   AGE
    accessdomain-adminserver                         1/1     Running     0          18h
    accessdomain-create-oam-infra-domain-job-vj69h   0/1     Completed   0          24h
    accessdomain-oam-policy-mgr1                     1/1     Running     0          18h
    accessdomain-oam-server1                         1/1     Running     0          18h
    accessdomain-oam-server2                         1/1     Running     0          18h
    helper                                           1/1     Running     0          41h
    

Stopping and Starting the AdminServer and Managed Servers

To stop all the OAM Managed Servers and the AdminServer in one operation:

  1. Run the following kubectl command to edit the domain:

    $ kubectl edit domain <domain_uid> -n <domain_namespace>
    

    For example:

    $ kubectl edit domain accessdomain -n oamns
    
  2. In the edit session search for serverStartPolicy: IF_NEEDED:

        volumes:
        - name: weblogic-domain-storage-volume
          persistentVolumeClaim:
            claimName: accessdomain-domain-pvc
      serverStartPolicy: IF_NEEDED
      webLogicCredentialsSecret:
        name: accessdomain-domain-credentials
    
  3. Change serverStartPolicy: IF_NEEDED to NEVER as follows:

        volumes:
        - name: weblogic-domain-storage-volume
          persistentVolumeClaim:
            claimName: accessdomain-domain-pvc
      serverStartPolicy: NEVER
      webLogicCredentialsSecret:
        name: accessdomain-domain-credentials
    
  4. Save the file and exit (:wq!).

  5. Run the following kubectl command to view the pods:

    $ kubectl get pods -n <domain_namespace>
    

    For example:

    $ kubectl get pods -n oamns
    

    The output will look similar to the following:

    NAME                                            READY   STATUS        RESTARTS   AGE
    accessdomain-adminserver                         1/1     Terminating   0          18h
    accessdomain-create-oam-infra-domain-job-vj69h   0/1     Completed     0          24h
    accessdomain-oam-policy-mgr1                     1/1     Terminating   0          18h
    accessdomain-oam-server1                         1/1     Terminating   0          18h
    accessdomain-oam-server2                         1/1     Terminating   0          18h
    helper                                           1/1     Running       0          41h
    

    The AdminServer pods and Managed Server pods will move to a STATUS of Terminating. After a few minutes, run the command again and the pods should have disappeared:

    NAME                                            READY   STATUS      RESTARTS   AGE
    accessdomain-create-oam-infra-domain-job-vj69h   0/1     Completed   0          24h
    helper                                           1/1     Running     0          41h
    
  6. To start the AdminServer and Managed Servers up again, repeat the previous steps but change serverStartPolicy: NEVER to IF_NEEDED as follows:

        volumes:
        - name: weblogic-domain-storage-volume
          persistentVolumeClaim:
            claimName: accessdomain-domain-pvc
      serverStartPolicy: IF_NEEDED
      webLogicCredentialsSecret:
        name: accessdomain-domain-credentials
    
  7. Run the following kubectl command to view the pods:

    $ kubectl get pods -n <domain_namespace>
    

    For example:

    $ kubectl get pods -n oamns
    

    The output will look similar to the following:

    NAME                                            READY   STATUS      RESTARTS   AGE
    accessdomain-create-oam-infra-domain-job-vj69h   0/1     Completed   0          24h
    accessdomain-introspect-domain-job-7qx29         1/1     Running     0          8s
    helper                                           1/1     Running     0          41h
    

    The AdminServer pod will start followed by the OAM Managed Servers pods. This process will take several minutes, so keep executing the command until all the pods are running with READY status 1/1 :

    NAME                                            READY   STATUS      RESTARTS   AGE  
    accessdomain-adminserver                         1/1     Running     0          6m4s
    accessdomain-create-oam-infra-domain-job-vj69h   0/1     Completed   0          24h
    accessdomain-oam-policy-mgr1                     1/1     Running     0          3m5s
    accessdomain-oam-server1                         1/1     Running     0          3m5s
    accessdomain-oam-server2                         1/1     Running     0          3m5s
    helper                                           1/1     Running     0          41h