Skip to content

Commit

Permalink
Merge branch 'sampele-ingress-doc-update' into 'main'
Browse files Browse the repository at this point in the history
Sample ingress doc update

See merge request weblogic-cloud/weblogic-kubernetes-operator!4179
  • Loading branch information
rjeberhard committed Apr 26, 2023
2 parents e680a0d + 5a105c1 commit 68cfcd5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
20 changes: 19 additions & 1 deletion kubernetes/samples/charts/nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ $ kubectl exec -it $POD_NAME -n nginx -- /nginx-ingress-controller --version
```
> **NOTE**: All the generated Kubernetes resources of the NGINX operator have names controlled by the NGINX Helm chart. In our case, we use `releaseName` of `nginx-operator`.
After the installation is complete, you can check the NGINX ingress status:

```shell
$ kubectl -n nginx get services
```

```
pod/nginx-operator-ingress-nginx-controller-84fbd64787-v4p4c 1/1 Running 0 11m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/nginx-operator-ingress-nginx-controller LoadBalancer 10.107.159.96 <pending> 80:31470/TCP,443:32465/TCP 11m
service/nginx-operator-ingress-nginx-controller-admission ClusterIP 10.109.12.133 <none> 443/TCP 11m
```

If the `EXTERNAL-IP` column shows `<pending>`, you can access the NGINX ingress through your Kubernetes cluster address and nodeports `31470/32465`. For example, `http://<k8s cluster address>:31470/myappurl` or `https://<k8s cluster address>:32465/myappurl`. If the `EXTERNAL-IP` column shows a real IP address, then you can also access the ingress through the IP address that is the external load balancer address without specifying the port value. For example, `http://<ip address>/myappurl` or `https://<ip address>/myappurl`.


## Configure NGINX as a load balancer for WebLogic domains
We'll demonstrate how to use NGINX to handle traffic to backend WebLogic domains.

Expand All @@ -69,7 +85,9 @@ ingress.networking.k8s.io/domain2-ingress-host created
```
Now you can send requests to different WebLogic domains with the unique NGINX entry point of different host names as defined in the route section of the `host-routing.yaml` file.
```shell
# Get the ingress controller web port
# Get the ingress controller service nodeport values
# HOSTNAME is your Kubernetes cluster address
# See installation section for how to access the ingress
$ export LB_PORT=$(kubectl -n nginx get service nginx-operator-ingress-nginx-controller -o jsonpath='{.spec.ports[?(@.name=="http")].nodePort}')
$ curl -H 'host: domain1.org' http://${HOSTNAME}:${LB_PORT}/testwebapp/
$ curl -H 'host: domain2.org' http://${HOSTNAME}:${LB_PORT}/testwebapp/
Expand Down
18 changes: 17 additions & 1 deletion kubernetes/samples/charts/traefik/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ You can also install the Traefik operator with a custom `values.yaml` file. For
$ helm install traefik-operator traefik/traefik --namespace traefik --values values.yaml
```

After the installation is complete, you can check the Traefik ingress status:

```shell
$ kubectl -n traefik get services
```

```
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
traefik-operator LoadBalancer 10.96.x.y 129.x.y.z 80:30518/TCP,443:30144/TCP 4m49s
```

If the `EXTERNAL-IP` column shows `<pending>`, you can access the Traefik ingress through your Kubernetes cluster address and nodeports `30518/30144`. For example, `http://<k8s cluster address>:30518/myappurl` or `https://<k8s cluster address>:30144/myappurl`. If the `EXTERNAL-IP` column shows a real IP address, then you can also access the ingress through the IP address that is the external load balancer address without specifying the port value. For example, `http://129.x.y.z/myappurl` or `https://129.x.y.z/myappurl`.

## Configure Traefik as a load balancer for WebLogic domains
This section describes how to use Traefik to handle traffic to backend WebLogic domains.

Expand All @@ -42,7 +55,10 @@ ingressroute.traefik.containo.us/traefik-hostrouting-2 created
```
Now you can send requests to different WebLogic domains with the unique Traefik entry point of different host names as defined in the route section of the `host-routing.yaml` file.
```shell
# Get the ingress controller web port
# Get the ingress controller service nodeport values
# HOSTNAME is your Kubernetes cluster address
# See installation section for how to access the ingress

$ export LB_PORT=$(kubectl -n traefik get service traefik-operator -o jsonpath='{.spec.ports[?(@.name=="web")].nodePort}')
$ curl -H 'host: domain1.org' http://${HOSTNAME}:${LB_PORT}/testwebapp/
$ curl -H 'host: domain2.org' http://${HOSTNAME}:${LB_PORT}/testwebapp/
Expand Down

0 comments on commit 68cfcd5

Please sign in to comment.