-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
112 changed files
with
2,523 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
kubernetes/apps/cert-manager/cert-manager/app/helmrelease.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
apiVersion: helm.toolkit.fluxcd.io/v2beta1 | ||
kind: HelmRelease | ||
metadata: | ||
name: cert-manager | ||
namespace: cert-manager | ||
spec: | ||
interval: 15m | ||
chart: | ||
spec: | ||
chart: cert-manager | ||
version: v1.12.2 | ||
sourceRef: | ||
kind: HelmRepository | ||
name: jetstack | ||
namespace: flux-system | ||
maxHistory: 2 | ||
install: | ||
createNamespace: true | ||
remediation: | ||
retries: 3 | ||
upgrade: | ||
cleanupOnFail: true | ||
remediation: | ||
retries: 3 | ||
uninstall: | ||
keepHistory: false | ||
values: | ||
installCRDs: true | ||
extraArgs: | ||
- --dns01-recursive-nameservers=1.1.1.1:53,9.9.9.9:53 | ||
- --dns01-recursive-nameservers-only | ||
podDnsPolicy: None | ||
podDnsConfig: | ||
nameservers: | ||
- "1.1.1.1" | ||
- "9.9.9.9" | ||
prometheus: | ||
enabled: true | ||
servicemonitor: | ||
enabled: true | ||
prometheusInstance: monitoring |
7 changes: 7 additions & 0 deletions
7
kubernetes/apps/cert-manager/cert-manager/app/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: cert-manager | ||
resources: | ||
- ./helmrelease.yaml | ||
- ./prometheusrule.yaml |
68 changes: 68 additions & 0 deletions
68
kubernetes/apps/cert-manager/cert-manager/app/prometheusrule.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PrometheusRule | ||
metadata: | ||
name: cert-manager.rules | ||
namespace: cert-manager | ||
spec: | ||
groups: | ||
- name: cert-manager | ||
rules: | ||
- alert: CertManagerAbsent | ||
expr: | | ||
absent(up{job="cert-manager"}) | ||
for: 15m | ||
labels: | ||
severity: critical | ||
annotations: | ||
description: | ||
"New certificates will not be able to be minted, and existing | ||
ones can't be renewed until cert-manager is back." | ||
runbook_url: https://gitlab.com/uneeq-oss/cert-manager-mixin/-/blob/master/RUNBOOK.md#certmanagerabsent | ||
summary: "Cert Manager has dissapeared from Prometheus service discovery." | ||
- name: certificates | ||
rules: | ||
- alert: CertManagerCertExpirySoon | ||
expr: | | ||
avg by (exported_namespace, namespace, name) ( | ||
certmanager_certificate_expiration_timestamp_seconds - time()) | ||
< (21 * 24 * 3600) | ||
for: 15m | ||
labels: | ||
severity: warning | ||
annotations: | ||
description: | ||
"The domain that this cert covers will be unavailable after | ||
{{ $value | humanizeDuration }}. Clients using endpoints that this cert | ||
protects will start to fail in {{ $value | humanizeDuration }}." | ||
runbook_url: https://gitlab.com/uneeq-oss/cert-manager-mixin/-/blob/master/RUNBOOK.md#certmanagercertexpirysoon | ||
summary: | ||
"The cert {{ $labels.name }} is {{ $value | humanizeDuration }} | ||
from expiry, it should have renewed over a week ago." | ||
- alert: CertManagerCertNotReady | ||
expr: | | ||
max by (name, exported_namespace, namespace, condition) ( | ||
certmanager_certificate_ready_status{condition!="True"} == 1) | ||
for: 15m | ||
labels: | ||
severity: critical | ||
annotations: | ||
description: | ||
"This certificate has not been ready to serve traffic for at least | ||
10m. If the cert is being renewed or there is another valid cert, the ingress | ||
controller _may_ be able to serve that instead." | ||
runbook_url: https://gitlab.com/uneeq-oss/cert-manager-mixin/-/blob/master/RUNBOOK.md#certmanagercertnotready | ||
summary: "The cert {{ $labels.name }} is not ready to serve traffic." | ||
- alert: CertManagerHittingRateLimits | ||
expr: | | ||
sum by (host) (rate(certmanager_http_acme_client_request_count{status="429"}[5m])) | ||
> 0 | ||
for: 15m | ||
labels: | ||
severity: critical | ||
annotations: | ||
description: | ||
"Depending on the rate limit, cert-manager may be unable to generate | ||
certificates for up to a week." | ||
runbook_url: https://gitlab.com/uneeq-oss/cert-manager-mixin/-/blob/master/RUNBOOK.md#certmanagerhittingratelimits | ||
summary: "Cert manager hitting LetsEncrypt rate limits." |
39 changes: 39 additions & 0 deletions
39
kubernetes/apps/cert-manager/cert-manager/issuers/issuers.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apiVersion: cert-manager.io/v1 | ||
kind: ClusterIssuer | ||
metadata: | ||
name: letsencrypt-production | ||
spec: | ||
acme: | ||
server: https://acme-v02.api.letsencrypt.org/directory | ||
email: "${SECRET_ACME_EMAIL}" | ||
privateKeySecretRef: | ||
name: letsencrypt-production | ||
solvers: | ||
- dns01: | ||
cloudflare: | ||
apiTokenSecretRef: | ||
name: cert-manager-secret | ||
key: api-token | ||
selector: | ||
dnsZones: | ||
- "${SECRET_DOMAIN}" | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: ClusterIssuer | ||
metadata: | ||
name: letsencrypt-staging | ||
spec: | ||
acme: | ||
server: https://acme-staging-v02.api.letsencrypt.org/directory | ||
email: "${SECRET_ACME_EMAIL}" | ||
privateKeySecretRef: | ||
name: letsencrypt-staging | ||
solvers: | ||
- dns01: | ||
cloudflare: | ||
apiTokenSecretRef: | ||
name: cert-manager-secret | ||
key: api-token | ||
selector: | ||
dnsZones: | ||
- "${SECRET_DOMAIN}" |
6 changes: 6 additions & 0 deletions
6
kubernetes/apps/cert-manager/cert-manager/issuers/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ./secret.sops.yaml | ||
- ./issuers.yaml |
27 changes: 27 additions & 0 deletions
27
kubernetes/apps/cert-manager/cert-manager/issuers/secret.sops.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: cert-manager-secret | ||
namespace: cert-manager | ||
stringData: | ||
api-token: ENC[AES256_GCM,data:SVu8r96qjGuu9TkXul4zoiTgaRDAn4wutkH5O0Vfy3WoiNOPXjepag==,iv:lDIAh43MzaicyoPJmJ1SeoZLc/RnnzLrRsLOOAAbE0M=,tag:EVqkFIzPMf4k6KJ3p7HmZA==,type:str] | ||
sops: | ||
kms: [] | ||
gcp_kms: [] | ||
azure_kv: [] | ||
hc_vault: [] | ||
age: | ||
- recipient: age1y0kzuf0tn94a74whazwae4r9qal4snuqfuhl5jacscrpr7up5gts74fe5w | ||
enc: | | ||
-----BEGIN AGE ENCRYPTED FILE----- | ||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBzQVN3aUtmaUdSNlE3dTVE | ||
eFBWQ3BvNFYyek1CM0l3TlRBZVd0RDJuZlcwCm11ZEorV2l3Q3pnYWZBVTF2Q3Zq | ||
d0JnL0pPazJpclEraGU0U3EzM3YwTmcKLS0tIE9XMy9teFg3RG9uMXcrTURTUmNr | ||
RTVlZEJlazNQdThnV2ZqZmVNWGYyeEkKEJA6CSzSUKdOOHSlsXvuiidRfMsdxu/H | ||
XuDI+rYTl1VF3N1mAZzs6dlNPGjsn+aKEYmhr50qXL9JpCWSpeIjhA== | ||
-----END AGE ENCRYPTED FILE----- | ||
lastmodified: "2023-06-18T16:15:31Z" | ||
mac: ENC[AES256_GCM,data:jAbZSiTATlogB6UbSs3CQ2lznpmYjPltssRE+bOMAZO86yulK/iGSiJv38fZ6V+MyW+LSMhWpAUbBnnR5sf5m6KjzHpuzmqkO2O4ZtcnaIIQuxbGddZKElMLEqr42GtVmpqJuX4Du5MV9DiBXRNWOfOm9Q5D6j0YTxIkHsp8doI=,iv:M4H4M5laL+eLpSzOesnBpuOclfR8b8QwyE48rebYySY=,tag:nDTJMTK7ZSGeJtbdzxQ37w==,type:str] | ||
pgp: [] | ||
encrypted_regex: ^(data|stringData)$ | ||
version: 3.7.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1 | ||
kind: Kustomization | ||
metadata: | ||
name: cluster-apps-cert-manager | ||
namespace: flux-system | ||
spec: | ||
path: ./kubernetes/apps/cert-manager/cert-manager/app | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: k8s-homelab | ||
wait: true | ||
interval: 30m | ||
retryInterval: 1m | ||
timeout: 5m | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1 | ||
kind: Kustomization | ||
metadata: | ||
name: cluster-apps-cert-manager-issuers | ||
namespace: flux-system | ||
spec: | ||
dependsOn: | ||
- name: cluster-apps-cert-manager | ||
path: ./kubernetes/apps/cert-manager/cert-manager/issuers | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: k8s-homelab | ||
wait: true | ||
interval: 30m | ||
retryInterval: 1m | ||
timeout: 5m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ./namespace.yaml | ||
- ./cert-manager/ks.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: cert-manager | ||
labels: | ||
kustomize.toolkit.fluxcd.io/prune: disabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
apiVersion: helm.toolkit.fluxcd.io/v2beta1 | ||
kind: HelmRelease | ||
metadata: | ||
name: echo-server | ||
namespace: default | ||
spec: | ||
interval: 15m | ||
chart: | ||
spec: | ||
chart: app-template | ||
version: 1.5.1 | ||
sourceRef: | ||
kind: HelmRepository | ||
name: bjw-s | ||
namespace: flux-system | ||
maxHistory: 2 | ||
install: | ||
createNamespace: true | ||
remediation: | ||
retries: 3 | ||
upgrade: | ||
cleanupOnFail: true | ||
remediation: | ||
retries: 3 | ||
uninstall: | ||
keepHistory: false | ||
dependsOn: | ||
- name: ingress-nginx | ||
namespace: networking | ||
values: | ||
controller: | ||
strategy: RollingUpdate | ||
image: | ||
repository: docker.io/jmalloc/echo-server | ||
tag: 0.3.5 | ||
service: | ||
main: | ||
ports: | ||
http: | ||
port: &port 8080 | ||
probes: | ||
liveness: &probes | ||
enabled: true | ||
custom: true | ||
spec: | ||
httpGet: | ||
path: /health | ||
port: *port | ||
initialDelaySeconds: 0 | ||
periodSeconds: 10 | ||
timeoutSeconds: 1 | ||
failureThreshold: 3 | ||
readiness: *probes | ||
startup: | ||
enabled: false | ||
ingress: | ||
main: | ||
enabled: true | ||
ingressClassName: nginx | ||
annotations: | ||
external-dns.alpha.kubernetes.io/target: "ingress.${SECRET_DOMAIN}" | ||
hajimari.io/icon: video-input-antenna | ||
hosts: | ||
- host: &host "{{ .Release.Name }}.${SECRET_DOMAIN}" | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
tls: | ||
- hosts: | ||
- *host | ||
resources: | ||
requests: | ||
cpu: 5m | ||
memory: 10Mi | ||
limits: | ||
memory: 50Mi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: default | ||
resources: | ||
- ./helmrelease.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1 | ||
kind: Kustomization | ||
metadata: | ||
name: cluster-apps-echo-server | ||
namespace: flux-system | ||
spec: | ||
path: ./kubernetes/apps/default/echo-server/app | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: k8s-homelab | ||
wait: false # no flux ks dependents | ||
interval: 30m | ||
retryInterval: 1m | ||
timeout: 5m |
Oops, something went wrong.