You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/blog/exposing-an-application-using-ingress-and-tls-termination-on-kubernetes-in-hpe-greenlake-for-private-cloud-enterprise.md
+27-39Lines changed: 27 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -360,77 +360,65 @@ Events:
360
360
Normal Sync 20s nginx-ingress-controller Scheduled for sync
361
361
Normal CreateCertificate 20s cert-manager-ingress-shim Successfully created Certificate "cfe-tls-key-pair"
362
362
```
363
+
### Access deployed Nginx apps
364
+
365
+
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 assigned to the *Nginx Ingress controller**’10.12.15.251’*.
366
+
367
+
Type the following commands to check this is done correctly:
363
368
364
369
```shell
365
370
$ host nginx.example.com
366
371
nginx.example.com has address 10.6.115.251
367
372
368
-
369
373
$ host green.nginx.example.com
370
374
green.nginx.example.com has address 10.6.115.251
371
375
372
-
373
376
$ host blue.nginx.example.com
374
377
blue.nginx.example.com has address 10.6.115.251
375
378
```
376
379
377
-
\#### Configure Ingress
378
380
379
-
```shell
380
-
$ cat ingress-simple-selfsigned.yaml
381
-
apiVersion: networking.k8s.io/v1
382
-
kind: Ingress
383
-
metadata:
384
-
name: nginx-ingress-selfsigned
385
-
annotations:
386
-
ingress.kubernetes.io/ssl-redirect: "true"
387
-
#kubernetes.io/ingress.class: "nginx"
388
-
cert-manager.io/issuer: "cfe-selfsinged-issuer"
389
-
spec:
390
-
ingressClassName: nginx
391
-
tls:
392
-
- hosts:
393
-
- nginx.example.com
394
-
secretName: cfe-tls-key-pair
395
-
rules:
396
-
- host: nginx.example.com
397
-
http:
398
-
paths:
399
-
- path: /
400
-
pathType: Prefix
401
-
backend:
402
-
service:
403
-
name: nginx-main
404
-
port:
405
-
number: 80
406
-
```
407
381
408
-
```shell
409
-
$ k apply -f ingress-simple-selfsigned.yaml -n cfe-apps
410
-
ingress.networking.k8s.io/nginx-ingress-selfsigned created
411
-
```
412
382
413
383
```shell
414
384
$ k apply -f ingress-simple-selfsigned.yaml -n cfe-apps
415
385
ingress.networking.k8s.io/nginx-ingress-selfsigned created
416
386
```
417
387
418
-
```shell
419
-
$ host nginx.example.com
420
-
nginx.example.com has address 10.6.115.251
421
-
```
388
+
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'*:
422
389
423
390

424
391
392
+
This is due to the fact the self-signed certifcate is generated in cert-manager and configured in the K8s Ingress resource.
393
+
394
+
Click *Not secure* and start Certificate Viewer to check the certificate:
395
+
425
396

426
397
398
+
Click *Proceed to nginx.example.com (unsafe)*, you then go to the Nginx *MAIN* page:
399
+
427
400

428
401
402
+
Type the URL *green.nginx.example.com* to the browser, it will be rediected over HTTPS with the same warning message *'Your connection is not private'*:
403
+
429
404

430
405
406
+
Click *Proceed to green.nginx.example.com (unsafe)*, you then go to the Nginx *GREEN* page:
407
+
431
408

432
409
410
+
The same thing occurs when type the URL *blue.nginx.example.com* to the browser. The access will be rediected over HTTPS with the same warning message *'Your connection is not private'*:
411
+
433
412

434
413
414
+
Click *Proceed to blue.nginx.example.com (unsafe)*, you then go to the Nginx *BLEU* page:
415
+
435
416

436
417
418
+
### Conclusion
419
+
420
+
421
+
422
+
This blog post described the steps to generate a self-signed certificate using cert-manager for K8s in HPE GreenLake for Private Cloud Enterprise. Self-signed certificates provide an easy way to prove your own identity for the applications deployed in K8s cluster. They are a good option for development and testing environments. However, self-signed certificates should not be used for production applications. For production use cases, you can try out cert-manager with [Lets Encrypt](https://letsencrypt.org/). Please refer to [cert-manager documentation](https://cert-manager.io/docs/) on how to use it with the type of *Let’s Encrypt* challenges, as well as other sources than *Let’s Encrypt*.
423
+
424
+
Please keep coming back to the [HPE Developer Community blog](https://developer.hpe.com/blog/) to learn more about HPE GreenLake for Private Cloud Enterprise.
0 commit comments