1- # Cross-Namespace Configuration
1+ # Basic, single-namespace VirtualServerRoute Selector
22
33In this example we use the [ VirtualServer and
44VirtualServerRoute] ( https://docs.nginx.com/nginx-ingress-controller/configuration/virtualserver-and-virtualserverroute-resources/ )
55resources to configure load balancing for the modified cafe application from the [ Basic
66Configuration] ( ../basic-configuration/ ) example. We have put the load balancing configuration as well as the deployments
7- and services into multiple namespaces. Instead of one namespace, we now use three: ` tea ` , ` coffee ` , and ` cafe ` .
7+ and services into one default namespace.
88
9- - In the tea namespace, we create the tea deployment, service, and the corresponding load-balancing configuration.
10- - In the coffee namespace, we create the coffee deployment, service, and the corresponding load-balancing configuration.
11- - In the cafe namespace, we create the cafe secret with the TLS certificate and key and the load-balancing configuration
12- for the cafe application. That configuration references the coffee and tea configurations.
9+ - In the default namespace, we create the tea deployment, service, and the corresponding load-balancing configuration.
10+ - In the same namespace, we create the cafe secret with the TLS certificate and key and the load-balancing configuration
11+ for the cafe application. That configuration references the tea configuration.
1312
1413## Prerequisites
1514
15+
16+ ## Step 1 - Install NGINX Ingress COntroller
17+
16181 . Follow the [ installation] ( https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/ )
1719 instructions to deploy the Ingress Controller with custom resources enabled.
20+
18211 . Save the public IP address of the Ingress Controller into a shell variable:
1922
2023 ``` console
@@ -27,13 +30,6 @@ and services into multiple namespaces. Instead of one namespace, we now use thre
2730 IC_HTTPS_PORT=<port number>
2831 ```
2932
30- ## Step 1 - Create Namespaces
31-
32- Create the required tea, coffee, and cafe namespaces:
33-
34- ```console
35- kubectl create -f namespaces.yaml
36- ```
3733
3834## Step 2 - Deploy the Cafe Application
3935
@@ -43,33 +39,33 @@ kubectl create -f namespaces.yaml
4339 kubectl create -f tea.yaml
4440 ```
4541
46- 1. Create the coffee deployment and service in the coffee namespace:
42+ 1. Create the coffee deployment and service in the default namespace:
4743
4844 ```console
4945 kubectl create -f coffee.yaml
5046 ```
5147
5248## Step 3 - Configure Load Balancing and TLS Termination
5349
54- 1. Create the VirtualServerRoute resource for tea in the tea namespace :
50+ 1. Create the VirtualServerRoute resource for tea:
5551
5652 ```console
5753 kubectl create -f tea-virtual-server-route.yaml
5854 ```
5955
60- 1. Create the VirtualServerRoute resource for coffee in the coffee namespace :
56+ 1. Create the VirtualServerRoute resource for coffee:
6157
6258 ```console
6359 kubectl create -f coffee-virtual-server-route.yaml
6460 ```
6561
66- 1. Create the secret with the TLS certificate and key in the cafe namespace :
62+ 1. Create the secret with the TLS certificate and key:
6763
6864 ```console
6965 kubectl create -f cafe-secret.yaml
7066 ```
7167
72- 1. Create the VirtualServer resource for the cafe app in the cafe namespace :
68+ 1. Create the VirtualServer resource for the cafe app:
7369
7470 ```console
7571 kubectl create -f cafe-virtual-server.yaml
@@ -85,37 +81,23 @@ kubectl create -f namespaces.yaml
8581 ```
8682
8783 ```text
88- . . .
89- Events:
90- Type Reason Age From Message
91- ---- ------ ---- ---- -------
92- Warning NoVirtualServersFound 2m nginx-ingress-controller No VirtualServer references VirtualServerRoute tea/tea
93- Normal AddedOrUpdated 1m nginx-ingress-controller Configuration for tea/tea was added or updated
84+ WIP - add an example
9485 ```
9586
9687 ```console
97- kubectl describe virtualserverroute coffee -n coffee
88+ kubectl describe virtualserverroute coffee
9889 ```
9990
10091 ```text
101- . . .
102- Events:
103- Type Reason Age From Message
104- ---- ------ ---- ---- -------
105- Warning NoVirtualServersFound 2m nginx-ingress-controller No VirtualServer references VirtualServerRoute coffee/coffee
106- Normal AddedOrUpdated 1m nginx-ingress-controller Configuration for coffee/coffee was added or updated
92+ WIP - add an example
10793 ```
10894
10995 ```console
110- kubectl describe virtualserver cafe -n cafe
96+ kubectl describe virtualserver cafe
11197 ```
11298
11399 ```text
114- . . .
115- Events:
116- Type Reason Age From Message
117- ---- ------ ---- ---- -------
118- Normal AddedOrUpdated 1m nginx-ingress-controller Configuration for cafe/cafe was added or updated
100+ WIP - add example
119101 ```
120102
1211031. Access the application using curl. We'll use curl's `--insecure` option to turn off certificate verification of our
@@ -144,3 +126,4 @@ kubectl create -f namespaces.yaml
144126 Server address: 10.16.0.157:80
145127 Server name: tea-7d57856c44-674b8
146128 ...
129+
0 commit comments