Skip to content

Commit 6d22ac8

Browse files
authored
Merge pull request #250 from oracle/voyager-doc
add Voyager doc
2 parents 4862226 + d483a6d commit 6d22ac8

File tree

4 files changed

+180
-32
lines changed

4 files changed

+180
-32
lines changed

kubernetes/internal/create-weblogic-domain.sh

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ function createYamlFiles {
593593
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${voyagerOutput}
594594
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${voyagerOutput}
595595
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${voyagerOutput}
596+
sed -i -e "s:%CLUSTER_NAME_LC%:${clusterNameLC}:g" ${voyagerOutput}
596597
sed -i -e "s:%MANAGED_SERVER_PORT%:${managedServerPort}:g" ${voyagerOutput}
597598
sed -i -e "s:%LOAD_BALANCER_WEB_PORT%:$loadBalancerWebPort:g" ${voyagerOutput}
598599
sed -i -e "s:%LOAD_BALANCER_DASHBOARD_PORT%:$loadBalancerDashboardPort:g" ${voyagerOutput}
@@ -710,38 +711,55 @@ function setupVoyagerLoadBalancer {
710711
# deploy Voyager Ingress resource
711712
kubectl apply -f ${voyagerOutput}
712713

713-
echo Checking Voyager Ingress resource
714-
local maxwaitsecs=100
715-
local mstart=`date +%s`
716-
while : ; do
717-
local mnow=`date +%s`
718-
local vdep=`kubectl get ingresses.voyager.appscode.com -n ${namespace} | grep ${domainUID}-voyager | wc | awk ' { print $1; } '`
719-
if [ "$vdep" = "1" ]; then
720-
echo 'The Voyager Ingress resource ${domainUID}-voyager is created successfully.'
721-
break
722-
fi
723-
if [ $((mnow - mstart)) -gt $((maxwaitsecs)) ]; then
724-
fail "The Voyager Ingress resource ${domainUID}-voyager was not created."
725-
fi
726-
sleep 5
727-
done
728-
729-
echo Checking Voyager service
730-
local maxwaitsecs=100
731-
local mstart=`date +%s`
732-
while : ; do
733-
local mnow=`date +%s`
734-
local vscv=`kubectl get service ${domainUID}-voyager-stats -n ${namespace} | grep ${domainUID}-voyager-stats | wc | awk ' { print $1; } '`
735-
if [ "$vscv" = "1" ]; then
736-
echo 'The service ${domainUID}-voyager-stats is created successfully.'
737-
break
738-
fi
739-
if [ $((mnow - mstart)) -gt $((maxwaitsecs)) ]; then
740-
fail "The service ${domainUID}-voyager-stats was not created."
741-
fi
742-
sleep 5
743-
done
714+
echo Checking Voyager Ingress resource
715+
local maxwaitsecs=100
716+
local mstart=`date +%s`
717+
while : ; do
718+
local mnow=`date +%s`
719+
local vdep=`kubectl get ingresses.voyager.appscode.com -n ${namespace} | grep ${domainUID}-voyager | wc | awk ' { print $1; } '`
720+
if [ "$vdep" = "1" ]; then
721+
echo 'The Voyager Ingress resource ${domainUID}-voyager is created successfully.'
722+
break
723+
fi
724+
if [ $((mnow - mstart)) -gt $((maxwaitsecs)) ]; then
725+
fail "The Voyager Ingress resource ${domainUID}-voyager was not created."
726+
fi
727+
sleep 5
728+
done
729+
730+
echo Checking HAProxy pod is running
731+
local maxwaitsecs=100
732+
local mstart=`date +%s`
733+
while : ; do
734+
local mnow=`date +%s`
735+
local st=`kubectl get pod -n ${namespace} | grep ^voyager-${domainUID}-voyager- | awk ' { print $3; } '`
736+
if [ "$st" = "Running" ]; then
737+
echo 'The HAProxy pod for Voyaer Ingress ${domainUID}-voyager is created successfully.'
738+
break
739+
fi
740+
if [ $((mnow - mstart)) -gt $((maxwaitsecs)) ]; then
741+
fail "The HAProxy pod for Voyaer Ingress ${domainUID}-voyager was not created or running."
742+
fi
743+
sleep 5
744+
done
745+
746+
echo Checking Voyager service
747+
local maxwaitsecs=100
748+
local mstart=`date +%s`
749+
while : ; do
750+
local mnow=`date +%s`
751+
local vscv=`kubectl get service ${domainUID}-voyager-stats -n ${namespace} | grep ${domainUID}-voyager-stats | wc | awk ' { print $1; } '`
752+
if [ "$vscv" = "1" ]; then
753+
echo 'The service ${domainUID}-voyager-stats is created successfully.'
754+
break
755+
fi
756+
if [ $((mnow - mstart)) -gt $((maxwaitsecs)) ]; then
757+
fail "The service ${domainUID}-voyager-stats was not created."
758+
fi
759+
sleep 5
760+
done
744761
}
762+
745763
#
746764
# Deploy traefik load balancer
747765
#

kubernetes/internal/voyager-ingress-template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
nodePort: '%LOAD_BALANCER_WEB_PORT%'
1818
paths:
1919
- backend:
20-
serviceName: %DOMAIN_UID%-cluster-%CLUSTER_NAME%
20+
serviceName: %DOMAIN_UID%-cluster-%CLUSTER_NAME_LC%
2121
servicePort: '%MANAGED_SERVER_PORT%'
2222

2323
---

site/images/haproxy-stats.png

375 KB
Loading

site/voyager.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Load balancing with Voyager/HAProxy
2+
3+
This document explains how to set up Voyager to use HAProxy as load balancer to WebLogic domain(s) running in Kubernetes.
4+
5+
Voyager is a HAProxy backed ingress controller for Kubernetes. More information about Voyager ingress controller can be found at: https://appscode.com/products/voyager/6.0.0/concepts/.
6+
7+
## Set up Voyager/HAProxy automatically
8+
To set up Voyager/HAProxy automatically you can run the create-weblogic-domain.sh script to create a WebLogic domain in Kubernetes. You need to change the domain inputs YAML file first. There are three related properties.
9+
10+
```
11+
...
12+
# Load balancer to deploy. Supported values are: APACHE, TRAEFIK, VOYAGER, NONE
13+
loadBalancer: VOYAGER
14+
...
15+
# Load balancer web port
16+
loadBalancerWebPort: 30305
17+
18+
# Load balancer dashboard port
19+
loadBalancerDashboardPort: 30315
20+
```
21+
22+
* The `loadBalancer` property needs to be changed to `VOYAGER`.
23+
* The `loadBalancerWebPort` property is to specify the `NodePort` number to access the HAProxy load balancer itself.
24+
* The `loadBalancerDashboardPort` property is to specify the `NodePort` number to access the HAPRoxy stats webpage.
25+
26+
Then after running create-weblogic-domain.sh script, the WebLogic domain is created and the Voyager/HAProxy is also installed and configured properly.
27+
You can access the HAProxy stats webpage via `http://<hostIP>:30315/` and you'll get a webpage like below.
28+
29+
![HAProxy stats](images/haproxy-stats.png)
30+
31+
After you deploy some application to the WebLogic cluster, you can send requests to the application via `http://<hostIP>:30305/<ctx>/`. The requests are sent to the HAProxy load balancer and the HAProxy will distribute the requests to managed servers of the WebLogic cluster.
32+
33+
### What happens underground?
34+
#### 1. Install the Voyager operator
35+
The Voyager operator is installed in `voyager` namespace if it hasn't been done before.
36+
37+
You should have a voyager-operator-*** pod running in the `voyager` namespace.
38+
```
39+
$ kubectl get pod -n voyager
40+
NAME READY STATUS RESTARTS AGE
41+
voyager-operator-86bcd6f656-jj2t6 1/1 Running 1 8d
42+
```
43+
And new CRD groups are registered by the Voyager operator.
44+
```
45+
$ kubectl get crd -l app=voyager
46+
NAME AGE
47+
certificates.voyager.appscode.com 8d
48+
ingresses.voyager.appscode.com 8d
49+
```
50+
Now the Voyager operator watches Ingress resources in any namespace.
51+
52+
#### 2. Create an Voyager Ingress resource
53+
An Ingress resource is generated based on the WebLogic domain configuration and deployed to Kubernetes. Here is an example of what the Voyager Ingress resource might look like for a WebLogic cluster named `cluster-1`, in a domain named `base_domain` with domainUID `domain1`.
54+
55+
```yaml
56+
apiVersion: voyager.appscode.com/v1beta1
57+
kind: Ingress
58+
metadata:
59+
name: domain1-voyager
60+
namespace: default
61+
labels:
62+
weblogic.domainUID: domain1
63+
weblogic.domainName: base_domain
64+
annotations:
65+
ingress.appscode.com/type: 'NodePort'
66+
ingress.appscode.com/stats: 'true'
67+
spec:
68+
rules:
69+
- host: domain1.cluster-1
70+
http:
71+
nodePort: '30305'
72+
paths:
73+
- backend:
74+
serviceName: domain1-cluster-cluster-1
75+
servicePort: '8001'
76+
```
77+
78+
The Kubernetes service named `domain1-cluster-cluster-1` referred by the Ingress resource is also created by create-weblogic-domain.sh which dynamically includes all the managed servers in the cluster.
79+
80+
```bash
81+
$ kubectl get endpoints domain1-cluster-cluster-1
82+
NAME ENDPOINTS AGE
83+
domain1-cluster-cluster-1 10.244.0.170:8001,10.244.0.171:8001,10.244.0.172:8001 2d
84+
```
85+
When the Ingress resource is deployed, following Kubernetes resources are created by the Voyager operator:
86+
```bash
87+
$ kubectl get deploy,pod,svc | awk '/voyager/ || /NAME/'
88+
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
89+
deploy/voyager-domain1-voyager 1 1 1 1 1d
90+
91+
NAME READY STATUS RESTARTS AGE
92+
po/voyager-domain1-voyager-577bcfb4b-kbnhp 1/1 Running 0 1d
93+
94+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
95+
svc/voyager-domain1-voyager NodePort 10.109.137.41 <none> 80:30305/TCP 1d
96+
svc/voyager-domain1-voyager-stats ClusterIP 10.105.160.124 <none> 56789/TCP 1d
97+
```
98+
#### 3. Create a NodePort service
99+
A NodePort service is created to expose the HAProxy stats. Following are the example yaml file for the service.
100+
```yaml
101+
apiVersion: v1
102+
kind: Service
103+
metadata:
104+
name: domain1-voyager-stats
105+
namespace: default
106+
labels:
107+
app: domain1-voyager-stats
108+
weblogic.domainUID: domain1
109+
weblogic.domainName: base_domain
110+
spec:
111+
type: NodePort
112+
ports:
113+
- name: client
114+
protocol: TCP
115+
port: 56789
116+
targetPort: 56789
117+
nodePort: 30315
118+
selector:
119+
origin: voyager
120+
origin-name: domain1-voyager
121+
```
122+
123+
## Set up Voyager manually to WebLogic domain running in Kubernetes
124+
You may want to manually set up Voyager to WebLogic domain running in Kubernetes, in cases when some of the default settings of the automatic steps don't meet your requirements, or your WebLogic domain is not created by the WebLogic Operator.
125+
You need to refer to Voyager documents to do the setup: https://appscode.com/products/voyager/6.0.0/setup/.
126+
### 1. Install the Voyager operator
127+
Refer to install guide of Voyager here: install guide: https://appscode.com/products/voyager/6.0.0/setup/install/.
128+
### 2. Create an Voyager Ingress resource
129+
Refer to the detail here: https://appscode.com/products/voyager/6.0.0/concepts/overview/. You can choose different types for your Ingress: LoadBalancer, NodePort, HostPort and Internal.
130+

0 commit comments

Comments
 (0)