feat: cert-manager ca for internal certs, enable tls for postgres
also fix: incorrect namespace for wildcard cert
This commit is contained in:
parent
4fe6efbfc9
commit
d7d81b3903
|
@ -0,0 +1,16 @@
|
||||||
|
apiVersion: cert-manager.io/v1
|
||||||
|
kind: Certificate
|
||||||
|
metadata:
|
||||||
|
name: ca-cert
|
||||||
|
namespace: cert-manager
|
||||||
|
spec:
|
||||||
|
isCA: true
|
||||||
|
commonName: cluster-ca
|
||||||
|
secretName: ca-cert-secret
|
||||||
|
privateKey:
|
||||||
|
algorithm: ECDSA
|
||||||
|
size: 256
|
||||||
|
issuerRef:
|
||||||
|
name: self-signed-issuer
|
||||||
|
kind: ClusterIssuer
|
||||||
|
group: cert-manager.io
|
|
@ -0,0 +1,7 @@
|
||||||
|
apiVersion: cert-manager.io/v1
|
||||||
|
kind: ClusterIssuer
|
||||||
|
metadata:
|
||||||
|
name: ca-issuer
|
||||||
|
spec:
|
||||||
|
ca:
|
||||||
|
secretName: ca-cert-secret
|
|
@ -0,0 +1,6 @@
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ./self-signed-issuer.yaml
|
||||||
|
- ./ca-cert.yaml
|
||||||
|
- ./ca-issuer.yaml
|
|
@ -0,0 +1,6 @@
|
||||||
|
apiVersion: cert-manager.io/v1
|
||||||
|
kind: ClusterIssuer
|
||||||
|
metadata:
|
||||||
|
name: self-signed-issuer
|
||||||
|
spec:
|
||||||
|
selfSigned: {}
|
|
@ -4,4 +4,4 @@ resources:
|
||||||
- ./cloudflare-cred.sops.yaml
|
- ./cloudflare-cred.sops.yaml
|
||||||
- ./letsencrypt-prod.yaml
|
- ./letsencrypt-prod.yaml
|
||||||
- ./letsencrypt-stage.yaml
|
- ./letsencrypt-stage.yaml
|
||||||
- ./wildcard-cert.yaml
|
- ./ca
|
|
@ -1,25 +0,0 @@
|
||||||
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
|
|
||||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
|
||||||
kind: Kustomization
|
|
||||||
metadata:
|
|
||||||
name: traefik
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
timeout: 5m
|
|
||||||
interval: 10m
|
|
||||||
path: ./kubernetes/common/apps/traefik/app/files
|
|
||||||
prune: true
|
|
||||||
sourceRef:
|
|
||||||
kind: GitRepository
|
|
||||||
name: home-cluster
|
|
||||||
decryption:
|
|
||||||
provider: sops
|
|
||||||
secretRef:
|
|
||||||
name: sops-gpg
|
|
||||||
postBuild:
|
|
||||||
substitute: {}
|
|
||||||
substituteFrom:
|
|
||||||
- kind: ConfigMap
|
|
||||||
name: cluster-settings
|
|
||||||
- kind: Secret
|
|
||||||
name: cluster-secrets
|
|
|
@ -1,30 +0,0 @@
|
||||||
|
|
||||||
---
|
|
||||||
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
|
|
||||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
|
||||||
kind: Kustomization
|
|
||||||
metadata:
|
|
||||||
name: traefik-default-tls
|
|
||||||
namespace: flux-system
|
|
||||||
spec:
|
|
||||||
timeout: 5m
|
|
||||||
interval: 10m
|
|
||||||
path: ./kubernetes/common/apps/traefik/extra/files
|
|
||||||
prune: true
|
|
||||||
sourceRef:
|
|
||||||
kind: GitRepository
|
|
||||||
name: home-cluster
|
|
||||||
decryption:
|
|
||||||
provider: sops
|
|
||||||
secretRef:
|
|
||||||
name: sops-gpg
|
|
||||||
dependsOn:
|
|
||||||
- name: traefik
|
|
||||||
namespace: flux-system
|
|
||||||
postBuild:
|
|
||||||
substitute: {}
|
|
||||||
substituteFrom:
|
|
||||||
- kind: ConfigMap
|
|
||||||
name: cluster-settings
|
|
||||||
- kind: Secret
|
|
||||||
name: cluster-secrets
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
apiVersion: cert-manager.io/v1
|
||||||
|
kind: Certificate
|
||||||
|
metadata:
|
||||||
|
name: postgres-cert
|
||||||
|
namespace: database
|
||||||
|
spec:
|
||||||
|
secretName: postgres-cert
|
||||||
|
|
||||||
|
duration: 2160h # 90d
|
||||||
|
renewBefore: 360h # 15d
|
||||||
|
|
||||||
|
issuerRef:
|
||||||
|
name: cluster-ca-issuer
|
||||||
|
kind: ClusterIssuer
|
||||||
|
|
||||||
|
dnsNames:
|
||||||
|
- postgresql.database
|
|
@ -20,6 +20,12 @@ spec:
|
||||||
adminPasswordKey: "adminPassword"
|
adminPasswordKey: "adminPassword"
|
||||||
replicationPasswordKey: "replicationPassword"
|
replicationPasswordKey: "replicationPassword"
|
||||||
|
|
||||||
|
tls:
|
||||||
|
enabled: true
|
||||||
|
certificatesSecret: postgres-cert
|
||||||
|
certFilename: "tls.crt"
|
||||||
|
certKeyFilename: "tls.key"
|
||||||
|
|
||||||
serviceMonitor:
|
serviceMonitor:
|
||||||
enabled: true
|
enabled: true
|
||||||
labels:
|
labels:
|
||||||
|
@ -39,4 +45,5 @@ spec:
|
||||||
readReplicas:
|
readReplicas:
|
||||||
containerSecurityContext:
|
containerSecurityContext:
|
||||||
enabled: true
|
enabled: true
|
||||||
runAsUser: 10000
|
runAsUser: 10000
|
||||||
|
|
|
@ -3,5 +3,6 @@ kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- ./pgsql-pv.yaml
|
- ./pgsql-pv.yaml
|
||||||
- ./pgsql.sops.yaml
|
- ./pgsql.sops.yaml
|
||||||
|
- ./cert.yaml
|
||||||
- ./helm-release.yaml
|
- ./helm-release.yaml
|
||||||
#- ./pgadmin4
|
#- ./pgadmin4
|
|
@ -5,7 +5,7 @@ resources:
|
||||||
- ./helm-repositories.yaml
|
- ./helm-repositories.yaml
|
||||||
- ../../common/apps/cert-manager
|
- ../../common/apps/cert-manager
|
||||||
- ../../common/apps/metallb
|
- ../../common/apps/metallb
|
||||||
- ../../common/apps/traefik
|
- ./traefik/ks.yaml
|
||||||
# storage
|
# storage
|
||||||
- ./longhorn
|
- ./longhorn
|
||||||
- ./openebs
|
- ./openebs
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
apiVersion: cert-manager.io/v1
|
||||||
|
kind: Certificate
|
||||||
|
metadata:
|
||||||
|
name: wildcard-main-cert
|
||||||
|
namespace: traefik
|
||||||
|
spec:
|
||||||
|
secretName: wildcard-main-tls
|
||||||
|
|
||||||
|
duration: 2160h # 90d
|
||||||
|
renewBefore: 360h # 15d
|
||||||
|
|
||||||
|
issuerRef:
|
||||||
|
name: letsencrypt-production
|
||||||
|
kind: ClusterIssuer
|
||||||
|
|
||||||
|
dnsNames:
|
||||||
|
- "${SECRET_NEW_DOMAIN}"
|
||||||
|
- "*.${SECRET_NEW_DOMAIN}"
|
||||||
|
- "*.internal.${SECRET_NEW_DOMAIN}"
|
|
@ -0,0 +1,56 @@
|
||||||
|
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
|
||||||
|
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||||
|
kind: Kustomization
|
||||||
|
metadata:
|
||||||
|
name: traefik
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
timeout: 5m
|
||||||
|
interval: 10m
|
||||||
|
path: ./kubernetes/main/core/traefik/app
|
||||||
|
prune: true
|
||||||
|
sourceRef:
|
||||||
|
kind: GitRepository
|
||||||
|
name: home-cluster
|
||||||
|
decryption:
|
||||||
|
provider: sops
|
||||||
|
secretRef:
|
||||||
|
name: sops-gpg
|
||||||
|
dependsOn:
|
||||||
|
- name: cert-manager-certificates
|
||||||
|
postBuild:
|
||||||
|
substitute: {}
|
||||||
|
substituteFrom:
|
||||||
|
- kind: ConfigMap
|
||||||
|
name: cluster-settings
|
||||||
|
- kind: Secret
|
||||||
|
name: cluster-secrets
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
|
||||||
|
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||||
|
kind: Kustomization
|
||||||
|
metadata:
|
||||||
|
name: traefik-extra
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
timeout: 5m
|
||||||
|
interval: 10m
|
||||||
|
path: ./kubernetes/main/core/traefik/extra
|
||||||
|
prune: true
|
||||||
|
sourceRef:
|
||||||
|
kind: GitRepository
|
||||||
|
name: home-cluster
|
||||||
|
decryption:
|
||||||
|
provider: sops
|
||||||
|
secretRef:
|
||||||
|
name: sops-gpg
|
||||||
|
dependsOn:
|
||||||
|
- name: traefik
|
||||||
|
namespace: flux-system
|
||||||
|
postBuild:
|
||||||
|
substitute: {}
|
||||||
|
substituteFrom:
|
||||||
|
- kind: ConfigMap
|
||||||
|
name: cluster-settings
|
||||||
|
- kind: Secret
|
||||||
|
name: cluster-secrets
|
|
@ -1,6 +1,35 @@
|
||||||
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
|
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
|
||||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
|
metadata:
|
||||||
|
name: nginx-wildcard-cert
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
targetNamespace: nginx
|
||||||
|
timeout: 5m
|
||||||
|
interval: 10m
|
||||||
|
path: ./kubernetes/thin/apps/nginx/wildcard-cert
|
||||||
|
prune: true
|
||||||
|
sourceRef:
|
||||||
|
kind: GitRepository
|
||||||
|
name: home-cluster
|
||||||
|
decryption:
|
||||||
|
provider: sops
|
||||||
|
secretRef:
|
||||||
|
name: sops-gpg
|
||||||
|
dependsOn:
|
||||||
|
- name: cert-manager-certificates
|
||||||
|
postBuild:
|
||||||
|
substitute: {}
|
||||||
|
substituteFrom:
|
||||||
|
- kind: ConfigMap
|
||||||
|
name: cluster-settings
|
||||||
|
- kind: Secret
|
||||||
|
name: cluster-secrets
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
|
||||||
|
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||||
|
kind: Kustomization
|
||||||
metadata:
|
metadata:
|
||||||
name: nginx-external
|
name: nginx-external
|
||||||
namespace: flux-system
|
namespace: flux-system
|
||||||
|
@ -17,6 +46,8 @@ spec:
|
||||||
provider: sops
|
provider: sops
|
||||||
secretRef:
|
secretRef:
|
||||||
name: sops-gpg
|
name: sops-gpg
|
||||||
|
dependsOn:
|
||||||
|
- name: nginx-wildcard-cert
|
||||||
postBuild:
|
postBuild:
|
||||||
substitute: {}
|
substitute: {}
|
||||||
substituteFrom:
|
substituteFrom:
|
||||||
|
@ -44,6 +75,8 @@ spec:
|
||||||
provider: sops
|
provider: sops
|
||||||
secretRef:
|
secretRef:
|
||||||
name: sops-gpg
|
name: sops-gpg
|
||||||
|
dependsOn:
|
||||||
|
- name: nginx-wildcard-cert
|
||||||
postBuild:
|
postBuild:
|
||||||
substitute: {}
|
substitute: {}
|
||||||
substituteFrom:
|
substituteFrom:
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- ./app/ks.yaml
|
- ./wildcard-cert.yaml
|
||||||
- ./extra/ks.yaml
|
|
Loading…
Reference in New Issue