Skip to content

Commit c8d290d

Browse files
authored
Merge pull request #598 from citrix/self-signed-certificate
Added the steps for self signed certificate
2 parents d375af4 + 5eff603 commit c8d290d

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Create a self-signed certificate and linking into Kubernetes secret
2+
3+
Use the steps in the procedure to create a self-signed certificate using OpenSSL and link into Kubernetes secret. You can use this secret to secure your Ingress.
4+
5+
## Create a self-signed certificate
6+
7+
You can create a TLS secret by using the following steps. In this procedure, a self-signed certificate and key are created.
8+
You can link it to the Kubernetes secret and use that secret in the Ingress for securing the Ingress.
9+
10+
openssl genrsa -out cert_key.pem 2048
11+
openssl req -new -key cert_key.pem -out cert_csr.pem -subj "/CN=example.com"
12+
openssl x509 -req -in cert_csr.pem -sha256 -days 365 -extensions v3_ca -signkey cert_key.pem -CAcreateserial -out cert_cert.pem
13+
14+
**Note:** Here, `example.com` is used for reference. You must replace `example.com` with the required domain name.
15+
16+
**Note:** In the example, the generated certificate has a validity of one year as the days are mentioned as 365.
17+
18+
## Linking the certificate to a Kubernetes secret
19+
20+
Perform the following steps to link the certificate to the Kubernetes secret.
21+
22+
1. Run the following command to create a Kubernetes secret based on the TLS certificate that you have created.
23+
24+
kubectl create secret tls tls-secret --cert=cert_cert.pem --key=cert_key.pem
25+
26+
1. Run the following command to view the secret that contains the TLS certificate information:
27+
28+
kubectl get secret tls-secret
29+
30+
## Deploy the Ingress
31+
32+
Create and apply the Ingress configuration. The following YAML can be used for reference.
33+
34+
apiVersion: networking.k8s.io/v1
35+
kind: Ingress
36+
metadata:
37+
name: ingress-demo
38+
namespace: netscaler
39+
annotations:
40+
kubernetes.io/ingress.class: "netscaler"
41+
spec:
42+
tls:
43+
- secretName: tls-secret
44+
hosts:
45+
- "example.com"
46+
rules:
47+
- host: "example.com"
48+
http:
49+
paths:
50+
- path: /
51+
pathType: Prefix
52+
backend:
53+
service:
54+
name: service-test
55+
port:
56+
number: 80

0 commit comments

Comments
 (0)