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
+20-18Lines changed: 20 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,13 +24,15 @@ tags:
24
24
25
25
[HPE GreenLake for Private Cloud Enterprise: Containers](https://www.hpe.com/us/en/greenlake/containers.html), one of the HPE GreenLake cloud services available on the HPE GreenLake for Private Cloud Enterprise, allows customers to create a K8s cluster and deploy containerized applications to the cluster. It provides an enterprise-grade container management service using open source K8s.
26
26
27
-
Once applications are deployed in a K8s cluster, the next step is to create services that expose these applications. By default, K8s services are created with the *ClusterIP* type, which supports internal connectivity among different components of the applications. However, these services are not directly accessible from outside the cluster. The challenge arises with a requirement to securely expose the deployed applications over HTTPS. This involves generating and managing SSL/TLS certificates for multiple applications deployed in the cluster. These certificates are crucial for secure communication between services, and their correct installation and management are essential to avoid access issues and security risks. To address exposing applications over HTTPS, K8s provides the concept of *Ingress*. An Ingress acts as an entry point for external traffic into the cluster. It can be configured with TLS termination. However, setting up K8s Ingress with TLS termination is intricate. It involves creating a K8s Secret to host the certificate and referencing the Secret in the Ingress resource. It also requires an additional load balancer configuration in the cluster.
27
+
Once applications are deployed in a K8s cluster, the next step is to create services that expose these applications. By default, K8s services are created with the *ClusterIP* type, which supports internal connectivity among different components of the applications. However, these services are not directly accessible from outside the cluster. It can be challenging to securely expose the deployed applications over HTTPS. This involves generating and managing SSL/TLS certificates for multiple applications deployed in the cluster. These certificates are crucial for secure communication between services. Installing them and managing them correctly is essential to avoid access issues and security risks.
28
28
29
-
This blog post outlines the comprehensive steps for exposing applications using Ingress and TLS termination on K8s in HPE GreenLake for Private Cloud Enterprise. [MetalLB](https://developer.hpe.com/blog/set-up-load-balancer-with-metallb-in-hpe-greenlake-for-private-cloud-enterprise/) is deployed to the cluster to set up the load balancer. It enables external access to services within the cluster. [Cert-manager](https://developer.hpe.com/blog/generating-self-signed-certificates-using-cert-manager-for-kubernetes-in-hpe-greenlake-for-private-cloud-entreprise/) is utilized for creating and managing SSL/TLS certificates. The generated certificate is stored as a K8s *Secret* object. This Secret can be mounted by application Pods or used by an Ingress controller. The [Nginx Ingress controller](https://www.nginx.com/products/nginx-ingress-controller/) is deployed and configured in the cluster. It handles SSL certificates and facilitates secure access to applications in the backend.
29
+
To address exposing applications over HTTPS, K8s provides the concept of *Ingress*. An Ingress acts as an entry point for external traffic into the cluster. It can be configured with TLS termination. However, setting up K8s Ingress with TLS termination is intricate. It involves creating a K8s *Secret* to host the certificate and referencing the secret in the Ingress resource. It also requires an additional load balancer configuration in the cluster.
30
+
31
+
This blog post outlines the comprehensive steps used to expose applications using Ingress and TLS termination on K8s in HPE GreenLake for Private Cloud Enterprise. [MetalLB](https://developer.hpe.com/blog/set-up-load-balancer-with-metallb-in-hpe-greenlake-for-private-cloud-enterprise/) is deployed to the cluster to set up the load balancer. It enables external access to services within the cluster. [Cert-manager](https://developer.hpe.com/blog/generating-self-signed-certificates-using-cert-manager-for-kubernetes-in-hpe-greenlake-for-private-cloud-entreprise/) is used for creating and managing SSL/TLS certificates. The generated certificate is stored as a K8s *Secret* object. This secret can be mounted by application Pods or used by an Ingress controller. The [Nginx Ingress controller](https://www.nginx.com/products/nginx-ingress-controller/) is deployed and configured in the cluster. It handles SSL certificates and facilitates secure access to applications in the backend.
30
32
31
33

32
34
33
-
Despite the complexities, securely exposing applications in a K8s cluster over HTTPS is attainable. This can be achieved by leveraging Ingress and TLS termination, along with a suite of suitable tools and utilities deployed within the K8s cluster in HPE GreenLake for Private Cloud Enterprise.
35
+
Despite the complexities, securely exposing applications in a K8s cluster over HTTPS is attainable. It can be achieved by leveraging Ingress and TLS termination, along with a suite of suitable tools and utilities deployed within the K8s cluster in HPE GreenLake for Private Cloud Enterprise.
34
36
35
37
### Prerequisites
36
38
@@ -43,7 +45,7 @@ Before starting, make sure you have the following:
43
45
44
46
### Set up the load balancer with MetalLB
45
47
46
-
You can install MetalLB and set up the load balancer in the K8s cluster by following up the blog post [Setting up the load balancer with MetalLB](https://developer.hpe.com/blog/set-up-load-balancer-with-metallb-in-hpe-greenlake-for-private-cloud-enterprise/).
48
+
You can install MetalLB and set up the load balancer in the K8s cluster by following the instructions found in the blog post [Setting up the load balancer with MetalLB](https://developer.hpe.com/blog/set-up-load-balancer-with-metallb-in-hpe-greenlake-for-private-cloud-enterprise/).
47
49
48
50
Here is the deployed MetalLB to the namespace *metallb-system* in the cluster:
49
51
@@ -87,7 +89,7 @@ cfe-l2advert ["cfe-pool"]
87
89
88
90
In order for an Ingress to work in the cluster, there must be an Ingress controller being deployed and running. It's the Ingress controller that accesses the certificate and the routing rules defined on the Ingress resource and makes them part of its configuration.
89
91
90
-
A variety of Ingress controllers are available for deployment in the cluster, including [Traefik](https://doc.traefik.io/traefik/providers/kubernetes-ingress/), [HAProxy](https://github.com/haproxytech/kubernetes-ingress#readme) and [Nginx Ingress controller](https://www.nginx.com/products/nginx-ingress-controller/). Execute the command below to install the Nginx Ingress controller to the cluster using helm:
92
+
A variety of Ingress controllers are available for deployment in the cluster, including [Traefik](https://doc.traefik.io/traefik/providers/kubernetes-ingress/), [HAProxy](https://github.com/haproxytech/kubernetes-ingress#readme) and [Nginx Ingress controller](https://www.nginx.com/products/nginx-ingress-controller/). Execute the command below to install the Nginx Ingress controller to the cluster using *Helm*:
@@ -165,9 +167,9 @@ The service *ingress-nginx-controller* gets deployed as the service type of *
165
167
166
168
### Generate a self-signed certificate using cert-manager
167
169
168
-
You can deploy cert-manager to the K8s cluster and generate a self-signed certificate by following up the blog post [Generating self-signed certificates using cert-manager](https://developer.hpe.com/blog/generating-self-signed-certificates-using-cert-manager-for-kubernetes-in-hpe-greenlake-for-private-cloud-entreprise/).
170
+
You can deploy cert-manager to the K8s cluster and generate a self-signed certificate by following the instructions found in the blog post [Generating self-signed certificates using cert-manager](https://developer.hpe.com/blog/generating-self-signed-certificates-using-cert-manager-for-kubernetes-in-hpe-greenlake-for-private-cloud-entreprise/).
169
171
170
-
Here is the deployed cert-manager to the namespace *cert-manager* in the cluster:
172
+
Here is the cert-manager deployed to the namespace *cert-manager* in the cluster:
Below is the deployed self-signed custom resource definition (CRD) *Issuer* in the namespace *nginx-apps* in which you want to generate certificate:
196
+
Below is the deployed self-signed custom resource definition (CRD) *Issuer* in the namespace *nginx-apps* in which you want to generate the certificate:
195
197
196
198
```shell
197
199
$ kubectl get issuer -n nginx-apps
@@ -207,7 +209,7 @@ NAME READY SECRET AGE
207
209
cfe-selfsigned-tls True cfe-tls-key-pair 2m23s
208
210
```
209
211
210
-
The K8s Secret*cfe-tls-key-pair* is created automatically in the same namespace as part of certificate deployment:
212
+
The K8s *Secret**'cfe-tls-key-pair'* is created automatically in the same namespace as part of certificate deployment:
211
213
212
214
```shell
213
215
$ kubectl get secrets -n nginx-apps cfe-tls-key-pair
@@ -342,7 +344,7 @@ service/nginx-blue created
342
344
deployment.apps/nginx-blue created
343
345
```
344
346
345
-
Type the command shown below to check the details of application deployment:
347
+
Type the command shown below to check the details of each application deployment:
Three Nginx services, *nginx-main*, *nginx-blue* and *nginx-green*, are deployed as the *ClusterIP* type. They provide internal connectivity and can solely be accessed from within the cluster.
371
373
372
-
Type the following commend to check that all the application service endpoints have been populated:
374
+
Type the following command to check that all the application service endpoints have been populated:
@@ -489,7 +491,7 @@ blue.nginx.example.com has address 10.6.115.251
489
491
490
492
You can then validate the Ingres TLS configuration of the deployed Nginx applications using the browser.
491
493
492
-
Start the browser and type the URL *nginx.example.com*, it will be redirected over HTTPS with the warning message *'Your connection is not private'*:
494
+
Start the browser and type the URL *nginx.example.com*. It will be redirected over HTTPS with the warning message *'Your connection is not private'*:
493
495
494
496

495
497
@@ -499,30 +501,30 @@ Click *Not secure* and start the Certificate Viewer to check the certificate:
499
501
500
502

501
503
502
-
Click *Proceed to nginx.example.com (unsafe)*, you then go to the Nginx *MAIN* page:
504
+
Click *Proceed to nginx.example.com (unsafe)*. You will then go to the Nginx *MAIN* page:
503
505
504
506

505
507
506
-
Type the URL *green.nginx.example.com* to the browser, it will be redirected over HTTPS with the same warning message *'Your connection is not private'*:
508
+
Type the URL *green.nginx.example.com* to the browser. It will be redirected over HTTPS with the same warning message *'Your connection is not private'*:
507
509
508
510

509
511
510
-
Click *Proceed to green.nginx.example.com (unsafe)*, you then go to the Nginx *GREEN* page:
512
+
Click *Proceed to green.nginx.example.com (unsafe)*. You will then go to the Nginx *GREEN* page:
511
513
512
514

513
515
514
516
The same thing occurs when you type the URL *blue.nginx.example.com* to the browser. The access will be redirected over HTTPS with the same warning message *'Your connection is not private'*:
515
517
516
518

517
519
518
-
Click *Proceed to blue.nginx.example.com (unsafe)*, you then go to the Nginx *BLUE* page:
520
+
Click *Proceed to blue.nginx.example.com (unsafe)*. You will then go to the Nginx *BLUE* page:
519
521
520
522

521
523
522
524
You have successfully configured the Ingress with the generated TLS certificate and exposed the deployed applications with TLS termination.
523
525
524
526
### Conclusion
525
527
526
-
This blog post provided a comprehensive guide on how to expose applications and make them accessible securely via HTTPS in a K8 cluster in HPE GreenLake for Private Cloud Enterprise. It detailed the process of configuring TLS termination on an Ingress controller, utilizing a K8s Ingress resource and a self-signed TLS certificate generated with cert-manager. While the blog post emphasized on self-signed certificates, the outlined procedure is equally applicable to any type of certificates. This flexibility allows customers to follow the steps using their own CA certificates or any commercially issued certificates for Ingress TLS termination, ensuring secure exposure of their applications in the K8s cluster over HTTPS.
528
+
This blog post provided a comprehensive guide on how to expose applications and make them accessible securely via HTTPS in a K8 cluster in HPE GreenLake for Private Cloud Enterprise. It detailed the process of configuring TLS termination on an Ingress controller, utilizing a K8s Ingress resource and a self-signed TLS certificate generated with cert-manager. While the emphasis of this post was on self-signed certificates, the outlined procedure is equally applicable to any type of certificates. This flexibility allows customers to follow the steps using their own CA certificates or any commercially issued certificates for Ingress TLS termination, ensuring secure exposure of their applications in the K8s cluster over HTTPS.
527
529
528
530
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