6 Scaling OHS Containers

Learn the basic operations to scale OHS containers in Kubernetes.

6.1 Viewing Existing OHS Servers

The default OHS deployment starts one OHS server, assuming replicas: 1 in the ohs.yaml.

To view the running OHS servers, run the following command:
kubectl get pods -n <namespace>
For example:
kubectl get pods -n ohsns
The output should look similar to the following:
NAME                         READY   STATUS    RESTARTS   AGE
ohs-domain-d5b648bc5-vkp4s   1/1     Running   0          5h17m

6.2 Scaling Up OHS Servers

The number of Oracle HTTP Server (OHS) servers running is dependent on the replicas parameter configured for OHS. To add additional OHS servers:
  1. Run the following kubectl command to start additional OHS servers:
    kubectl -n <namespace> patch deployment ohs-domain -p '{"spec": {"replicas": <replica count>}}' 
    where <replica count> is the number of OHS servers to start.
    In the example below, two additional OHS servers are started, by increasing replicas to 3:
    kubectl -n ohsns patch deployment  ohs-domain -p '{"spec": {"replicas": 3}}'
    The output will look similar to the following:
    deployment.apps/ohs-domain patched
  2. While the new OHS containers are being started, you can run the following command to monitor the progress:
    kubectl get pods -n <namespace> -w
    For example:
    kubectl get pods -n ohsns -w
    The output will look similar to the following:
    NAME                         READY   STATUS              RESTARTS   AGE
    ohs-domain-d5b648bc5-2q8bw   0/1     ContainerCreating   0          26s
    ohs-domain-d5b648bc5-qvdjn   0/1     Running             0          26s
    ohs-domain-d5b648bc5-vkp4s   1/1     Running             0          5h21m
    Two new OHS pods have been created, in this example ohs-domain-d5b648bc5-2q8bw and ohs-domain-d5b648bc5-qvdjn.
  3. To check what is happening while the pods are in ContainerCreating status, you can run:
    kubectl describe pod <podname> -n <namespace>
  4. To check what is happening while the pods are in 0/1 Running status, you can run:
    kubectl logs -f <pod> -n <namespace>
  5. Once everything is started you should see all the additional OHS containers are running (READY 1/1):
    NAME                         READY   STATUS    RESTARTS      AGE
    ohs-domain-d5b648bc5-2q8bw   1/1     Running   0             9m34s
    ohs-domain-d5b648bc5-qvdjn   1/1     Running   0             9m34s
    ohs-domain-d5b648bc5-vkp4s   1/1     Running   0             5h30m

6.3 Scaling Down OHS Servers

As previously referenced, the number of Oracle HTTP Server (OHS) servers running is dependent on the replicas parameter configured for OHS. To stop one or more OHS servers:
  1. Run the following kubectl command to scale down OHS servers:
    kubectl -n <namespace> patch deployment ohs-domain -p '{"spec": {"replicas": <replica count>}}'
    where <replica count> is the number of OHS servers to run.
    In the example below, replicas is reduced to 1, so only one OHS is running:
    kubectl -n ohsns patch deployment  ohs-domain -p '{"spec": {"replicas": 1}}'
    The output will look similar to the following:
    deployment.apps/ohs-domain patched
  2. Run the following kubectl command to view the pods:
     kubectl get pods -n <namespace>
    For example:
    kubectl get pods -n ohsns
    The output will look similar to the following:
    NAME                         READY   STATUS        RESTARTS   AGE 
    ohs-domain-d5b648bc5-2q8bw   0/1     Terminating   0          12m
    ohs-domain-d5b648bc5-qvdjn   0/1     Terminating   0          12m
    ohs-domain-d5b648bc5-vkp4s   1/1     Running       0          5h31m
    Two pods now have a STATUS of Terminating. Keep executing the command until the pods have disappeared and you are left with the one OHS pod:
    NAME                         READY   STATUS    RESTARTS   AGE 
    ohs-domain-d5b648bc5-vkp4s   1/1     Running   0          5h32m