The PostgreSQL server managed by *Postgres Operator* uses a self-signed certificate by default. In order to enable full validation of the server certificate, we need to use a certificate signed by a known CA that the clients can trust. To that end, I have added a *cert-manager* Issuer specifically for PostgreSQL. The CA certificate is also managed by *cert-manager*; it is self-signed and needs to be distributed to clients out-of-band.
54 lines
925 B
YAML
54 lines
925 B
YAML
apiVersion: cert-manager.io/v1
|
|
kind: Issuer
|
|
metadata:
|
|
name: postgresql-ca-issuer
|
|
spec:
|
|
selfSigned: {}
|
|
|
|
---
|
|
apiVersion: cert-manager.io/v1
|
|
kind: Certificate
|
|
metadata:
|
|
name: postgresql-ca
|
|
spec:
|
|
isCA: true
|
|
commonName: PostgreSQL CA
|
|
secretName: postgresql-ca
|
|
duration: 96360h
|
|
privateKey:
|
|
algorithm: ECDSA
|
|
size: 256
|
|
issuerRef:
|
|
name: postgresql-ca-issuer
|
|
kind: Issuer
|
|
group: cert-manager.io
|
|
|
|
---
|
|
apiVersion: cert-manager.io/v1
|
|
kind: Issuer
|
|
metadata:
|
|
name: postgresql-issuer
|
|
spec:
|
|
ca:
|
|
secretName: postgresql-ca
|
|
|
|
---
|
|
apiVersion: cert-manager.io/v1
|
|
kind: Certificate
|
|
metadata:
|
|
name: default
|
|
spec:
|
|
secretName: default-cert
|
|
dnsNames:
|
|
- default.postgresql.svc.cluster.local
|
|
- default.postgresql.svc
|
|
- default.postgresql
|
|
- default
|
|
issuerRef:
|
|
group: cert-manager.io
|
|
kind: Issuer
|
|
name: postgresql-issuer
|
|
privateKey:
|
|
algorithm: ECDSA
|
|
rotationPolicy: Always
|