-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into deps/use-nginx-ubi
- Loading branch information
Showing
41 changed files
with
1,240 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
examples/custom-resources/externalname-services/transport-server/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Support for Type ExternalName Services in Transport Server | ||
|
||
The Ingress Controller supports routing requests to services of the type [ExternalName](https://kubernetes.io/docs/concepts/services-networking/service/#externalname). | ||
|
||
An ExternalName service is defined by an external DNS name that is resolved into the IP addresses, typically external to the cluster. This enables to use the Ingress Controller to route requests to the destinations outside of the cluster. | ||
|
||
**Note:** This feature is only available in NGINX Plus. | ||
|
||
# Prerequisites | ||
|
||
For the illustration purpose we will run NGINX Ingress Controller (refered as NIC in the examples) with the ```-watch-namespace=nginx-ingress,default``` option. The option enables NIC to watch selected namespaces. | ||
|
||
Any application deployed in other namespaces will be treated as an external service. | ||
|
||
We will use the ```examples/custom-resources/tls-passthrough``` application example as our backend app that will be responding to requests. | ||
|
||
# Example | ||
|
||
## 1. Deploy the tls-passthrough application | ||
|
||
1. Deploy the backend application as described in the ```examples/custom-resources/tls-passthrough``` example, and make sure it is working as described. | ||
|
||
## 2. Deploy external service to external namespace | ||
|
||
1. Deploy backend application to external namespace (```external-ns```). Note that the namespace is not being watched by ```NIC```. | ||
```bash | ||
$ kubectl apply -f secure-app-external.yaml | ||
``` | ||
|
||
## 3. Setup ExternalName service | ||
|
||
1. Create the service of type ```ExternalName``` | ||
``` | ||
$ kubectl apply -f externalname-svc.yaml | ||
``` | ||
|
||
2. Apply the config map | ||
```bash | ||
$ kubectl apply -f nginx-config.yaml | ||
``` | ||
|
||
## 4. Change the Transport Server to point to the ExternalName and verify if it is working correctly | ||
|
||
1. Navigate to the tls-passthrough example ```examples/custom-resources/tls-passthrough``` and open the ```transport-server-passthrough.yaml``` file. | ||
|
||
2. Replace the service name ```secure-app``` with ```externalname-service``` and apply the change. | ||
```yaml | ||
apiVersion: k8s.nginx.org/v1alpha1 | ||
kind: TransportServer | ||
metadata: | ||
name: secure-app | ||
spec: | ||
listener: | ||
name: tls-passthrough | ||
protocol: TLS_PASSTHROUGH | ||
host: app.example.com | ||
upstreams: | ||
- name: secure-app | ||
service: externalname-service | ||
port: 8443 | ||
action: | ||
pass: secure-app | ||
``` | ||
|
||
``` | ||
$ kubectl apply -f transport-server-passthrough.yaml | ||
``` | ||
|
||
3. Verify if the application is working by sending a request and check if the response is coming from the "external backend pod" (refer to to the tls-passthrough example) | ||
```bash | ||
$ curl --resolve app.example.com:$IC_HTTPS_PORT:$IC_IP https://app.example.com:$IC_HTTPS_PORT --insecure | ||
``` | ||
Response | ||
``` | ||
hello from pod secure-app-external-backend-5fbf4fb494-x7bkl | ||
``` |
7 changes: 7 additions & 0 deletions
7
examples/custom-resources/externalname-services/transport-server/externalname-svc.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: externalname-service | ||
spec: | ||
type: ExternalName | ||
externalName: secure-app-external-backend-svc.external-ns.svc.cluster.local |
7 changes: 7 additions & 0 deletions
7
examples/custom-resources/externalname-services/transport-server/nginx-config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: nginx-config | ||
namespace: nginx-ingress | ||
data: | ||
resolver-addresses: "kube-dns.kube-system.svc.cluster.local" |
Oops, something went wrong.