github.com/nginxinc/kubernetes-ingress@v1.12.5/examples-of-custom-resources/basic-configuration/README.md (about) 1 # Basic Configuration 2 3 In this example we configure load balancing with TLS termination for a simple web application using the [VirtualServer](https://docs.nginx.com/nginx-ingress-controller/configuration/virtualserver-and-virtualserverroute-resources/) resource. The application, called cafe, lets you get either tea via the tea service or coffee via the coffee service. You indicate your drink preference with the URI of your HTTP request: URIs ending with `/tea` get you tea and URIs ending with `/coffee` get you coffee. 4 5 The example is similar to the [complete example](../../examples/complete-example/README.md). However, instead of the Ingress resource, we use the VirtualServer. 6 7 ## Prerequisites 8 9 1. Follow the [installation](https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/) instructions to deploy the Ingress Controller with custom resources enabled. 10 1. Save the public IP address of the Ingress Controller into a shell variable: 11 ``` 12 $ IC_IP=XXX.YYY.ZZZ.III 13 ``` 14 1. Save the HTTPS port of the Ingress Controller into a shell variable: 15 ``` 16 $ IC_HTTPS_PORT=<port number> 17 ``` 18 19 ## Step 1 - Deploy the Cafe Application 20 21 Create the coffee and the tea deployments and services: 22 ``` 23 $ kubectl create -f cafe.yaml 24 ``` 25 26 ## Step 2 - Configure Load Balancing and TLS Termination 27 28 1. Create the secret with the TLS certificate and key: 29 ``` 30 $ kubectl create -f cafe-secret.yaml 31 ``` 32 33 2. Create the VirtualServer resource: 34 ``` 35 $ kubectl create -f cafe-virtual-server.yaml 36 ``` 37 38 ## Step 3 - Test the Configuration 39 40 1. Check that the configuration has been successfully applied by inspecting the events of the VirtualServer: 41 ``` 42 $ kubectl describe virtualserver cafe 43 . . . 44 Events: 45 Type Reason Age From Message 46 ---- ------ ---- ---- ------- 47 Normal AddedOrUpdated 7s nginx-ingress-controller Configuration for default/cafe was added or updated 48 ``` 49 1. Access the application using curl. We'll use curl's `--insecure` option to turn off certificate verification of our self-signed certificate and `--resolve` option to set the IP address and HTTPS port of the Ingress Controller to the domain name of the cafe application: 50 51 To get coffee: 52 ``` 53 $ curl --resolve cafe.example.com:$IC_HTTPS_PORT:$IC_IP https://cafe.example.com:$IC_HTTPS_PORT/coffee --insecure 54 Server address: 10.16.1.182:80 55 Server name: coffee-7dbb5795f6-tnbtq 56 ... 57 ``` 58 If your prefer tea: 59 ``` 60 $ curl --resolve cafe.example.com:$IC_HTTPS_PORT:$IC_IP https://cafe.example.com:$IC_HTTPS_PORT/tea --insecure 61 Server address: 10.16.0.149:80 62 Server name: tea-7d57856c44-zlftd 63 ...