Skip to content

Commit 9fd2118

Browse files
committed
Update Blog “exposing-an-application-using-ingress-and-tls-termination-on-kubernetes-in-hpe-greenlake-for-private-cloud-enterprise”
1 parent b46df20 commit 9fd2118

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

content/blog/exposing-an-application-using-ingress-and-tls-termination-on-kubernetes-in-hpe-greenlake-for-private-cloud-enterprise.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ cfe-tls-key-pair kubernetes.io/tls 3 2m25s
240240

241241
### Install Nginx applications
242242

243+
Three Nginx applicaitons from the GitHub repo [ingress-demo](https://github.com/GuopingJia/ingress-demo.git) will be deployed as sample applications to the cluster.
244+
245+
The repo's *apps* folder contains the Nginx applications' YAML manifest files:
246+
243247
```shell
244248
$ tree ingress-demo/
245249
ingress-demo/
@@ -252,6 +256,8 @@ ingress-demo/
252256
└── README.md
253257
```
254258

259+
Type the following commands to deploy those Nginx applications to the namespace *nginx-apps*:
260+
255261
```shell
256262
$ cd ingress-demo/
257263
$ kubectl apply -f apps/nginx-main.yaml -n nginx-apps
@@ -265,6 +271,8 @@ service/nginx-blue created
265271
deployment.apps/nginx-blue created
266272
```
267273

274+
Check with below command to see that all the Nginx Pods are in Running state:
275+
268276
```shell
269277
$ kubectl get all -n nginx-apps
270278
NAME READY STATUS RESTARTS AGE
@@ -288,7 +296,7 @@ replicaset.apps/nginx-green-8956bbd9f 1 1 1 24s
288296
replicaset.apps/nginx-main-64bfd77895 1 1 1 32s
289297
```
290298

291-
Type the following commend to check that all the service endpoints have been populated:
299+
Type the following commend to check that all the application service endpoints have been populated:
292300

293301
```shell
294302
$ kubectl get endpoints -n nginx-apps
@@ -298,7 +306,9 @@ nginx-green 10.192.4.45:80 1m
298306
nginx-main 10.192.4.44:80 1m
299307
```
300308

301-
### Deploy Ingress
309+
### Set up Ingress TLS
310+
311+
The Ingress resource with TLS has to be created. Here is the sample Ingress TLS resource:
302312

303313
```shell
304314
$ cat ingress-host-based-selfsigned.yaml
@@ -348,10 +358,19 @@ spec:
348358
port:
349359
number: 80
350360
```
361+
362+
In the above sample YAML manifest file, there is the *tls block* that contains the hostname *'nginx.example.com'* and the tls secret *cfe-tls-key-pair* created in the certification steps. There is also the *rules block* in which a list of routing rules is defined per host, e.g., host *nginx.example.com* will be routed to the application service *nginx-main* in the backend.
363+
364+
Type the following command to deploy the Ingress resource to the namespace *nginx-apps*:
351365

352366
```shell
353367
$ kubectl apply -f ingress-host-based-selfsigned.yaml -n nginx-apps
354368
ingress.networking.k8s.io/ingress-host-based-selfsigned created
369+
```
370+
371+
Type below command to check the details of the *TLS* and *Rules* settings:
372+
373+
```shell
355374
$ kubectl get ingress -n nginx-apps
356375
NAME CLASS HOSTS ADDRESS PORTS AGE
357376
ingress-host-based-selfsigned nginx nginx.example.com,blue.nginx.example.com,green.nginx.example.com 80, 443 9s
@@ -382,9 +401,9 @@ Events:
382401
Normal CreateCertificate 20s cert-manager-ingress-shim Successfully created Certificate "cfe-tls-key-pair"
383402
```
384403

385-
### Access deployed Nginx apps
404+
### Access deployed Nginx applications
386405

387-
With all Nginx apps, together with the K8s Ingress resource, being deployed to the cluster, all I have to do is to make sure the domain and the subdomain names, i.e., *example.com* & **.nginx.example.com*, point to the the external IP address *'10.6.115.251'* assigned to the *Nginx ingress controller*.
406+
With all Nginx applications, together with the K8s Ingress resource, being deployed to the cluster, you need set up and make sure the domain and the subdomain names, i.e., *example.com* & **.nginx.example.com*, point to the the external IP address *'10.6.115.251'* which is assigned to the *Nginx ingress controller*.
388407

389408
Type the following commands to check this is done correctly:
390409

@@ -399,13 +418,15 @@ $ host blue.nginx.example.com
399418
blue.nginx.example.com has address 10.6.115.251
400419
```
401420

421+
You can then validate the Ingres TLS configuration of the deployed Nginx applications to the cluster using the browser.
422+
402423
Start the browser and type the URL *nginx.example.com*, it will be rediected over HTTPS with the warning message *'Your connection is not private'*:
403424

404425
![](/img/nginx-main-warning.png)
405426

406427
This is due to the fact the self-signed certifcate is generated in cert-manager and configured in the K8s Ingress resource.
407428

408-
Click *Not secure* and start Certificate Viewer to check the certificate:
429+
Click *Not secure* and start the Certificate Viewer to check the certificate:
409430

410431
![](/img/nginx-main-cert.png)
411432

@@ -429,6 +450,8 @@ Click *Proceed to blue.nginx.example.com (unsafe)*, you then go to the Nginx
429450

430451
![](/img/nginx-blue.png)
431452

453+
You have successfully configured the Ingress with the generated TLS certificate and exposed the deployed applications with TLS termination.
454+
432455
### Conclusion
433456

434457

0 commit comments

Comments
 (0)