diff --git a/authentik/k8s/authentik.yaml b/authentik/k8s/authentik.yaml new file mode 100644 index 0000000..7df8954 --- /dev/null +++ b/authentik/k8s/authentik.yaml @@ -0,0 +1,93 @@ +apiVersion: v1 +kind: Service +metadata: + name: authentik-server-service + namespace: authentik +spec: + type: ClusterIP + selector: + app: authentik-server + ports: + - port: 9000 + targetPort: 9000 +--- +apiVersion: v1 +kind: Service +metadata: + name: authentik-worker-service + namespace: authentik +spec: + type: ClusterIP + selector: + app: authentik-worker + ports: + - port: 9000 + targetPort: 9000 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: authentik-server-deployment + namespace: authentik +spec: + replicas: 1 + selector: + matchLabels: + app: authentik-server + template: + metadata: + labels: + app: authentik-server + spec: + containers: + - name: authentik-server + image: ghcr.io/goauthentik/server:2025.10.2 + args: ["server"] + envFrom: + - configMapRef: + name: authentik-config + - secretRef: + name: authentik-secrets + ports: + - containerPort: 9000 + resources: + requests: + memory: "700Mi" + cpu: "300m" + limits: + memory: "1.5Gi" + cpu: "1000m" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: authentik-worker-deployment + namespace: authentik +spec: + replicas: 1 + selector: + matchLabels: + app: authentik-worker + template: + metadata: + labels: + app: authentik-worker + spec: + containers: + - name: authentik-worker + image: ghcr.io/goauthentik/server:2025.10.2 + args: ["worker"] + securityContext: + runAsUser: 0 + envFrom: + - configMapRef: + name: authentik-config + - secretRef: + name: authentik-secrets + resources: + requests: + memory: "512Mi" + cpu: "300m" + limits: + memory: "1Gi" + cpu: "700m" diff --git a/authentik/k8s/config.yaml b/authentik/k8s/config.yaml new file mode 100644 index 0000000..f888be8 --- /dev/null +++ b/authentik/k8s/config.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: authentik-config + namespace: authentik +data: + AUTHENTIK_IMAGE: ghcr.io/goauthentik/server + AUTHENTIK_TAG: "2025.10.2" + AUTHENTIK_POSTGRESQL__HOST: authentik-postgres-service + AUTHENTIK_POSTGRESQL__NAME: authentik + AUTHENTIK_ERROR_REPORTING__ENABLED: "true" diff --git a/authentik/k8s/ingress.yaml b/authentik/k8s/ingress.yaml new file mode 100644 index 0000000..181fcaf --- /dev/null +++ b/authentik/k8s/ingress.yaml @@ -0,0 +1,46 @@ +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: authentik-prod + namespace: authentik +spec: + entryPoints: + - websecure + routes: + - match: Host(`auth.forust.xyz`) + kind: Rule + services: + - name: authentik-server-service + port: 9000 + tls: + certResolver: letsencrypt +--- +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: authentik-local + namespace: authentik +spec: + entryPoints: + - websecure + routes: + - match: Host(`auth.workstation.internal`) + kind: Rule + services: + - name: authentik-server-service + port: 9000 +--- +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: authentik-dev + namespace: authentik +spec: + entryPoints: + - websecure + routes: + - match: Host(`auth.gigaforust.internal`) + kind: Rule + services: + - name: authentik-server-service + port: 9000 diff --git a/authentik/k8s/namespace.yaml b/authentik/k8s/namespace.yaml new file mode 100644 index 0000000..bb24d8d --- /dev/null +++ b/authentik/k8s/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: authentik diff --git a/authentik/k8s/postgresql.yaml b/authentik/k8s/postgresql.yaml new file mode 100644 index 0000000..8cb75c8 --- /dev/null +++ b/authentik/k8s/postgresql.yaml @@ -0,0 +1,66 @@ +apiVersion: v1 +kind: Service +metadata: + name: authentik-postgres-service + namespace: authentik +spec: + clusterIP: None + selector: + app: authentik-postgres + ports: + - port: 5432 + targetPort: 5432 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: authentik-postgres-statefulset + namespace: authentik +spec: + selector: + matchLabels: + app: authentik-postgres + serviceName: authentik-postgres-service + replicas: 1 + template: + metadata: + labels: + app: authentik-postgres + spec: + containers: + - name: postgres + image: docker.io/library/postgres:15-alpine + env: + - name: POSTGRES_DB + value: authentik + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: authentik-secrets + key: AUTHENTIK_POSTGRESQL__USER + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: authentik-secrets + key: AUTHENTIK_POSTGRESQL__PASSWORD + ports: + - containerPort: 5432 + name: postgres + volumeMounts: + - name: postgres-data + mountPath: /var/lib/postgresql/data + resources: + requests: + memory: "256Mi" + cpu: "200m" + limits: + memory: "1Gi" + cpu: "500m" + volumeClaimTemplates: + - metadata: + name: postgres-data + spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 5Gi diff --git a/authentik/k8s/secrets.yaml.example b/authentik/k8s/secrets.yaml.example new file mode 100644 index 0000000..c3c7651 --- /dev/null +++ b/authentik/k8s/secrets.yaml.example @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Secret +metadata: + name: authentik-secrets + namespace: authentik +type: Opaque +stringData: + AUTHENTIK_SECRET_KEY: "" + AUTHENTIK_POSTGRESQL__PASSWORD: "" + AUTHENTIK_POSTGRESQL__USER: authentik + AUTHENTIK_BOOTSTRAP_PASSWORD: authentik