Skip to content

Commit b762c30

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

File tree

1 file changed

+110
-45
lines changed

1 file changed

+110
-45
lines changed

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

Lines changed: 110 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ NAME IPADDRESSPOOLS IPADDRESSPOOL SELECTORS INTERFACES
8585
cfe-l2advert ["cfe-pool"]
8686
```
8787

88-
### Deploy Ngnix Ingress controller
88+
### Deploy Nginx Ingress controller
89+
90+
The Nginx Ingress controller can be installed using helm by typing the following command:
8991

9092
```shell
9193
$ helm upgrade --install ingress-nginx ingress-nginx \
@@ -141,6 +143,8 @@ If TLS is enabled for the Ingress, a Secret containing the certificate and key m
141143
type: kubernetes.io/tls
142144
```
143145

146+
The Nginx Ingress controller is deployed to the namespace *ingress-nginx* in the cluster. Type the following command to check the deployment details:
147+
144148
```shell
145149
$ kubectl get all -n ingress-nginx
146150
NAME READY STATUS RESTARTS AGE
@@ -157,12 +161,14 @@ NAME DESIRED CURRENT READY
157161
replicaset.apps/ingress-nginx-controller-548768956f 1 1 1 15m
158162
```
159163

160-
The service *ingress-nginx-controller* gets deployed as the service type of *LoadBalancer* with the *EXTERNAL-IP* assigned as *10.6.115.251*.
164+
The service *ingress-nginx-controller* gets deployed as the service type of *LoadBalancer* with the *EXTERNAL-IP* assigned as *10.6.115.251*.
161165

162166
### Generate a self-signed certificate using cert-manager
163167

164168
You can deploy cert-manager 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/).
165169

170+
Here is the deployed cert-manager to the namespace *cert-manager* in the cluster:
171+
166172
```shell
167173
$ kubectl get all -n cert-manager
168174
NAME READY STATUS RESTARTS AGE
@@ -185,63 +191,123 @@ replicaset.apps/cert-manager-cainjector-69548575fb 1 1 1
185191
replicaset.apps/cert-manager-webhook-57b78f476d 1 1 1 18s
186192
```
187193

188-
```shell
189-
$ kubectl create ns nginx-apps
190-
namespace/nginx-apps created
191-
192-
$ cat issuer-selfsigned.yaml
193-
apiVersion: cert-manager.io/v1
194-
kind: Issuer
195-
metadata:
196-
name: cfe-selfsigned-issuer
197-
spec:
198-
selfSigned: {}
199-
200-
$ kubectl apply -f issuer-selfsigned.yaml -n nginx-apps
201-
issuer.cert-manager.io/cfe-selfsigned-issuer created
194+
Here is the deployed self-signed custom resource definition (CRD) *Issuer* in the namespace *nginx-apps* in which you want to generate certificates:
202195

196+
```shell
203197
$ kubectl get issuer -n nginx-apps
204198
NAME READY AGE
205199
cfe-selfsigned-issuer True 115s
206200
```
207201

208-
```shell
209-
$ cat certificate.yaml
210-
apiVersion: cert-manager.io/v1
211-
kind: Certificate
212-
metadata:
213-
name: cfe-selfsigned-tls
214-
spec:
215-
# name of the tls secret to store
216-
# the automatically generated certificate/key pair
217-
secretName: cfe-tls-key-pair
218-
isCA: true
219-
issuerRef:
220-
name: cfe-selfsigned-issuer
221-
kind: Issuer
222-
commonName: "example.com"
223-
dnsNames:
224-
# one or more fully-qualified domain name
225-
# can be defined here
226-
- green.nginx.example.com
227-
- blue.nginx.example.com
228-
- nginx.example.com
229-
- example.com
230-
```
202+
Below is the generated self-signed certificate in the namespace *nginx-apps*:
231203

232204
```shell
233205
$ kubectl apply -f certificate.yaml -n nginx-apps
234206
certificate.cert-manager.io/cfe-selfsigned-tls created
207+
```
235208

236-
$ kubectl get certificate -n nginx-apps
237-
NAME READY SECRET AGE
238-
cfe-selfsigned-tls True cfe-tls-key-pair 17s
209+
The following K8s secret *cfe-tls-key-pair* is created automatically in the same namespace as part of certificate deployment:
239210

211+
```shell
240212
$ kubectl get secrets -n nginx-apps cfe-tls-key-pair
241213
NAME TYPE DATA AGE
242214
cfe-tls-key-pair kubernetes.io/tls 3 2m25s
243215
```
244216

217+
Type the following command to check the *commonName* and the *dnsNames* that are used to generate the certificate:
218+
219+
```shell
220+
$ k describe certificate cfe-selfsigned-tls -n nginx-apps
221+
Name: cfe-selfsigned-tls
222+
Namespace: nginx-apps
223+
Labels: <none>
224+
Annotations: <none>
225+
API Version: cert-manager.io/v1
226+
Kind: Certificate
227+
Metadata:
228+
Creation Timestamp: 2024-03-06T17:58:51Z
229+
Generation: 1
230+
Managed Fields:
231+
API Version: cert-manager.io/v1
232+
Fields Type: FieldsV1
233+
fieldsV1:
234+
f:metadata:
235+
f:annotations:
236+
.:
237+
f:kubectl.kubernetes.io/last-applied-configuration:
238+
f:spec:
239+
.:
240+
f:commonName:
241+
f:dnsNames:
242+
f:isCA:
243+
f:issuerRef:
244+
.:
245+
f:kind:
246+
f:name:
247+
f:secretName:
248+
Manager: kubectl-client-side-apply
249+
Operation: Update
250+
Time: 2024-03-06T17:58:51Z
251+
API Version: cert-manager.io/v1
252+
Fields Type: FieldsV1
253+
fieldsV1:
254+
f:status:
255+
f:revision:
256+
Manager: cert-manager-certificates-issuing
257+
Operation: Update
258+
Subresource: status
259+
Time: 2024-03-06T17:58:52Z
260+
API Version: cert-manager.io/v1
261+
Fields Type: FieldsV1
262+
fieldsV1:
263+
f:status:
264+
.:
265+
f:conditions:
266+
.:
267+
k:{"type":"Ready"}:
268+
.:
269+
f:lastTransitionTime:
270+
f:message:
271+
f:observedGeneration:
272+
f:reason:
273+
f:status:
274+
f:type:
275+
f:notAfter:
276+
f:notBefore:
277+
f:renewalTime:
278+
Manager: cert-manager-certificates-readiness
279+
Operation: Update
280+
Subresource: status
281+
Time: 2024-03-06T17:58:52Z
282+
Resource Version: 2128063
283+
UID: 977eaa8a-1612-489b-a34d-0e78ab113096
284+
Spec:
285+
Common Name: example.com
286+
Dns Names:
287+
green.nginx.example.com
288+
blue.nginx.example.com
289+
nginx.example.com
290+
example.com
291+
Is CA: true
292+
Issuer Ref:
293+
Kind: Issuer
294+
Name: cfe-selfsigned-issuer
295+
Secret Name: cfe-tls-key-pair
296+
Status:
297+
Conditions:
298+
Last Transition Time: 2024-03-06T17:58:52Z
299+
Message: Certificate is up to date and has not expired
300+
Observed Generation: 1
301+
Reason: Ready
302+
Status: True
303+
Type: Ready
304+
Not After: 2024-06-04T17:58:52Z
305+
Not Before: 2024-03-06T17:58:52Z
306+
Renewal Time: 2024-05-05T17:58:52Z
307+
Revision: 1
308+
Events: <none>
309+
```
310+
245311
### Deploy sample Nginx applications
246312

247313
In order to validate the Ingress TLS termination, three sample Nginx applications will be deployed to the cluster using the YAML manifest files from GitHub repo [ingress-demo](https://github.com/GuopingJia/ingress-demo):
@@ -411,7 +477,7 @@ Events:
411477

412478
### Access deployed Nginx applications
413479

414-
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*.
480+
With three Nginx applications and 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*.
415481

416482
Type the following commands to check this is done correctly:
417483

@@ -463,7 +529,6 @@ You have successfully configured the Ingress with the generated TLS certifica
463529
### Conclusion
464530

465531

466-
This blog post provided a comprehensive guide on how to expose applications deployed in a K8 cluster and make them accessible securely via HTTPS. 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. Although the emphasis was on self-signed certificates, the procedure is applicable to any type of certificates. This
467-
enables customers to follow up the steps using their own CA certificates for Ingress TLS termination.
532+
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. Although the emphasis was on self-signed certificates, the procedure is applicable to any type of certificates. This enables customers to follow up the steps using their own CA certificates for Ingress TLS termination.
468533

469534
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

Comments
 (0)