Skip to content

Commit 81e8ad8

Browse files
author
Jonathan S. Katz
committed
Update cert-manager example
Updates certificate generation to match what is done in upstream. Tweaks some of the language and instructions.
1 parent 73941b9 commit 81e8ad8

File tree

4 files changed

+21
-29
lines changed

4 files changed

+21
-29
lines changed

kustomize/certmanager/README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Using Cert-Manager with Postgres Operator 5.x
22

33
## Introduction
4-
Starting with version 5.0 of the Crunchy Data Postgres Operator for Kubernetes, TLS is on by default to secure all communication to/from the postgres cluster. By default, the Operator will generate the necessary certificates for the Postgres cluster and components. It is possible to provide custom cetificates by storing the certificates in a Kubernetes Secret and pointing the Operator to those secrets in the Postgres manifest.
4+
Starting with version 5.0 of PGO, the Postgres Operator from Crunchy Data, TLS is on by default to secure all communication to/from the postgres cluster. By default, the Operator will generate the necessary certificates for the Postgres cluster and components. It is possible to provide custom certificates by storing the certificates in a Kubernetes Secret and pointing the Operator to those secrets in the Postgres manifest.
55

66
Cert-Manager can be used to dynamically generate and manage certificates in Kubernetes. Cert-Manager can generate self-signed certificates or certificates from several certificate authorities.
77

@@ -14,7 +14,10 @@ The first step is to deploy Cert-Manager to the Kubernetes cluster. To do this,
1414
After Cert-Manager has been deployed, the next step used in this example is to setup a Certificate Issuer. The Certificate Issuer can be configured to be local to a namespace or cluster wide. In the examples provided here, a cluster wide issuer is created.
1515

1616
### Configure Issuer
17-
```kubectl apply -k certman```
17+
18+
```
19+
kubectl apply -k certman
20+
```
1821

1922
This Kustomize deployment performs the following actions:
2023

@@ -34,11 +37,13 @@ Two certificates will be generated by the Kustomize deployment. The first certi
3437

3538
In the Postgres manifest, two entries are added to point to the newly created Secrets. The customTLSSecret key references the <cluster>-tls secret while the customReplicationTLSSecret references the <cluster>-repl-tls secret.
3639

37-
### Deploy Postgres Cluster
38-
```kubectl apply -k postgres```
40+
### Deploy Postgres
41+
42+
```shell
43+
kubectl apply -k postgres
44+
```
3945

4046
The following process takes place during the deployment:
4147
* Custom certificate is generated for Postgres using the CA ClusterIssuer created in the previous steps.
4248
* Custom certificate is generated for Postgres replication using the CA ClusterIssuer.
4349
* Postgres cluster deployed using the custom certificates.
44-

kustomize/certmanager/postgres/cert-repl.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,20 @@ spec:
99
renewBefore: 360h # 15d
1010
subject:
1111
organizations:
12-
- crunchydata
12+
- hippo-org
1313
# The use of the common name field has been deprecated since 2000 and is
1414
# discouraged from being used.
1515
commonName: _crunchyrepl
1616
isCA: false
1717
privateKey:
18-
algorithm: RSA
19-
encoding: PKCS1
20-
size: 2048
18+
algorithm: ECDSA
19+
size: 256
2120
usages:
22-
- server auth
23-
- client auth
21+
- digital signature
22+
- key encipherment
2423
# At least one of a DNS Name, URI, or IP address is required.
2524
dnsNames:
2625
- _crunchyrepl
27-
# uris:
28-
# - spiffe://cluster.local/ns/zoo/hippo
29-
#ipAddresses:
30-
#- 192.168.0.5
31-
# Issuer references are always required.
3226
issuerRef:
3327
name: ca-issuer
3428
# We can reference ClusterIssuers by changing the kind here.

kustomize/certmanager/postgres/cert.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,20 @@ spec:
99
renewBefore: 360h # 15d
1010
subject:
1111
organizations:
12-
- crunchydata
12+
- hippo-org
1313
# The use of the common name field has been deprecated since 2000 and is
1414
# discouraged from being used.
1515
commonName: postgres-operator
1616
isCA: false
1717
privateKey:
18-
algorithm: RSA
19-
encoding: PKCS1
20-
size: 2048
18+
algorithm: ECDSA
19+
size: 256
2120
usages:
22-
- server auth
23-
- client auth
21+
- digital signature
22+
- key encipherment
2423
# At least one of a DNS Name, URI, or IP address is required.
2524
dnsNames:
2625
- hippo-primary
27-
# uris:
28-
# - spiffe://cluster.local/ns/zoo/hippo
29-
#ipAddresses:
30-
#- 192.168.0.5
31-
# Issuer references are always required.
3226
issuerRef:
3327
name: ca-issuer
3428
# We can reference ClusterIssuers by changing the kind here.

kustomize/certmanager/postgres/postgres.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ spec:
1010
customTLSSecret:
1111
name: hippo-tls
1212
instances:
13-
- name: pgc
14-
replicas: 2
13+
- replicas: 2
1514
dataVolumeClaimSpec:
1615
accessModes:
1716
- "ReadWriteOnce"

0 commit comments

Comments
 (0)