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:
- Run the following kubectl command to start additional OHS
servers:
wherekubectl -n <namespace> patch deployment ohs-domain -p '{"spec": {"replicas": <replica count>}}'
<replica count>
is the number of OHS servers to start.In the example below, two additional OHS servers are started, by increasingreplicas
to3
:
The output will look similar to the following:kubectl -n ohsns patch deployment ohs-domain -p '{"spec": {"replicas": 3}}'
deployment.apps/ohs-domain patched
- While the new OHS containers are being started, you can run the following
command to monitor the
progress:
For example:kubectl get pods -n <namespace> -w
The output will look similar to the following:kubectl get pods -n ohsns -w
Two new OHS pods have been created, in this exampleNAME 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
ohs-domain-d5b648bc5-2q8bw
andohs-domain-d5b648bc5-qvdjn
. - To check what is happening while the pods are in ContainerCreating status,
you can
run:
kubectl describe pod <podname> -n <namespace>
- To check what is happening while the pods are in
0/1 Running
status, you can run:kubectl logs -f <pod> -n <namespace>
- 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:
- Run the following kubectl command to scale down OHS
servers:
wherekubectl -n <namespace> patch deployment ohs-domain -p '{"spec": {"replicas": <replica count>}}'
<replica count>
is the number of OHS servers to run.In the example below,replicas
is reduced to1
, so only one OHS is running:
The output will look similar to the following:kubectl -n ohsns patch deployment ohs-domain -p '{"spec": {"replicas": 1}}'
deployment.apps/ohs-domain patched
- Run the following kubectl command to view the
pods:
For example:kubectl get pods -n <namespace>
The output will look similar to the following:kubectl get pods -n ohsns
Two pods now have aNAME 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
STATUS
ofTerminating
. 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