Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
87 lines (69 sloc) 4.6 KB

Oracle WebLogic Operator Tutorial

Assigning WebLogic Pods to Licensed Node

This use case similar to described in Assigning WebLogic Pods to Nodes lab where individual servers/pods were asssigned to specific node(s). However the focus in this use case on the license coverage.

At v1.13, Kubernetes supports clusters with up to 5000(!) nodes. However certain software like WebLogic requires license. Using nodeSelector feature Kubernetes ensure that WebLogic pods end up on licenced worker node(s).

In this lab you will learn how to assign all WebLogic pods (WebLogic domain) to particular node(s).

Assign WebLogic servers/pods to licensed nodes

To assign pod(s) to node(s) you need to label the desired node with custom tag. Then define the nodeSelector property in the domain resource definition and set the value of the label you applied on the node. Finally apply the domain configuration changes.

First get the node names using kubectl get node:

$ kubectl get node
NAME             STATUS    ROLES     AGE       VERSION   Ready     node      11d       v1.11.5    Ready     node      11d       v1.11.5     Ready     node      11d       v1.11.5

In case of OKE the node name can be the Public IP address of the node or the subnet's CIDR Block's first IP address. But obviously a unique string which identifies the node.

Now check the current pod allocation using the detailed pod information kubectl get pod -n sample-domain1-ns -o wide:

$ kubectl get pod -n sample-domain1-ns -o wide
NAME                             READY     STATUS    RESTARTS   AGE       IP            NODE             NOMINATED NODE
sample-domain1-admin-server      1/1       Running   0          2m     <none>
sample-domain1-managed-server1   1/1       Running   0          1m    <none>
sample-domain1-managed-server2   1/1       Running   0          1m   <none>
sample-domain1-managed-server3   1/1       Running   0          1m     <none>

As you can see from the result Kubernetes evenly deployed the 3 managed servers to the 3 worker nodes. In this scenario choose one of the node where you want to move all pods.


In this example the licensed node will be:

Label this node. The label can be any string, but now use licensed-for-weblogic. Execute kubectl label nodes <nodename> <labelname>=true command but replace your node name and label properly:

$ kubectl label nodes licensed-for-weblogic=true
node/ labeled
Modify domain resource definition

Open your domain.yaml in text editor and find the serverPod: entry and insert a new property inside:

    licensed-for-weblogic: true

Be careful with the indentation. You can double check the syntax in the sample domain.yaml where this part turned into comment.

Save the changes and apply the new domain resource definition.

$ kubectl apply -f ~/git.repos/@nagypeter/weblogic-operator-tutorial/k8s/domain.yaml configured

The operator according to the changes will start to relocate servers. Poll the pod information and wait until the expected result:

$ kubectl get po -n sample-domain1-ns -o wide
NAME                             READY     STATUS    RESTARTS   AGE       IP            NODE           NOMINATED NODE
sample-domain1-admin-server      1/1       Running   0          4h   <none>
sample-domain1-managed-server1   1/1       Running   0          4h   <none>
sample-domain1-managed-server2   1/1       Running   0          4h   <none>
sample-domain1-managed-server3   1/1       Running   0          4h   <none>
Delete label and nodeSelector entries in domain.yaml

To delete the node assignment delete the node's label using kubectl label node <nodename> <labelname>- command but replace the node name properly:

$ kubectl label nodes licensed-for-weblogic-
node/ labeled

Delete or turn into comment the entries you added for node assignment in your domain.yaml and apply:

$ kubectl apply -f /u01/domain.yaml configured

The pod reallocation/restart can happen based on the scheduler decision.

You can’t perform that action at this time.