Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kubernetes): install authelia #157

Merged
merged 1 commit into from
Dec 28, 2023
Merged

feat(kubernetes): install authelia #157

merged 1 commit into from
Dec 28, 2023

Conversation

martinohmann
Copy link
Owner

No description provided.

@github-actions github-actions bot added the area/kubernetes Changes made in the kubernetes directory label Dec 28, 2023
Copy link

--- kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/authelia

+++ kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/authelia

@@ -0,0 +1,36 @@

+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: cluster-apps
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: authelia
+  namespace: flux-system
+spec:
+  commonMetadata:
+    labels:
+      app.kubernetes.io/name: authelia
+  decryption:
+    provider: sops
+    secretRef:
+      name: sops-age
+  dependsOn:
+  - name: cloudnative-pg-cluster
+  interval: 30m
+  path: ./kubernetes/apps/default/authelia/app
+  postBuild:
+    substituteFrom:
+    - kind: ConfigMap
+      name: cluster-settings
+    - kind: Secret
+      name: cluster-secrets
+  prune: true
+  retryInterval: 1m
+  sourceRef:
+    kind: GitRepository
+    name: home-kubernetes
+  targetNamespace: default
+  timeout: 5m
+  wait: false
+
--- kubernetes/apps/default/authelia/app Kustomization: flux-system/authelia HelmRelease: default/authelia

+++ kubernetes/apps/default/authelia/app Kustomization: flux-system/authelia HelmRelease: default/authelia

@@ -0,0 +1,170 @@

+---
+apiVersion: helm.toolkit.fluxcd.io/v2beta2
+kind: HelmRelease
+metadata:
+  labels:
+    app.kubernetes.io/name: authelia
+    kustomize.toolkit.fluxcd.io/name: authelia
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: authelia
+  namespace: default
+spec:
+  chart:
+    spec:
+      chart: app-template
+      sourceRef:
+        kind: HelmRepository
+        name: bjw-s
+        namespace: flux-system
+      version: 2.4.0
+  dependsOn:
+  - name: lldap
+    namespace: default
+  - name: redis
+    namespace: database
+  install:
+    remediation:
+      retries: 3
+  interval: 30m
+  uninstall:
+    keepHistory: false
+  upgrade:
+    cleanupOnFail: true
+    remediation:
+      retries: 3
+  values:
+    controllers:
+      main:
+        annotations:
+          reloader.stakater.com/auto: 'true'
+        containers:
+          main:
+            env:
+              AUTHELIA_SERVER_ADDRESS: tcp://0.0.0.0:80
+              AUTHELIA_SERVER_DISABLE_HEALTHCHECK: 'true'
+              AUTHELIA_TELEMETRY_METRICS_ADDRESS: tcp://0.0.0.0:8080
+              AUTHELIA_TELEMETRY_METRICS_ENABLED: 'true'
+              AUTHELIA_THEME: light
+              X_AUTHELIA_CONFIG: /config/configuration.yaml
+              X_AUTHELIA_CONFIG_FILTERS: expand-env
+            envFrom:
+            - secretRef:
+                name: authelia
+            image:
+              repository: ghcr.io/authelia/authelia
+              tag: v4.38.0-beta3@sha256:9ad7df91dfec75d2f46d544e3128215b755ee78550b4ed0ed995b5a3fad35458
+            probes:
+              liveness:
+                custom: true
+                enabled: true
+                spec:
+                  failureThreshold: 3
+                  httpGet:
+                    path: /api/health
+                    port: 80
+                  initialDelaySeconds: 0
+                  periodSeconds: 10
+                  timeoutSeconds: 1
+              readiness:
+                custom: true
+                enabled: true
+                spec:
+                  failureThreshold: 3
+                  httpGet:
+                    path: /api/health
+                    port: 80
+                  initialDelaySeconds: 0
+                  periodSeconds: 10
+                  timeoutSeconds: 1
+              startup:
+                enabled: false
+            resources:
+              limits:
+                memory: 128Mi
+              requests:
+                cpu: 10m
+                memory: 32Mi
+            securityContext:
+              allowPrivilegeEscalation: false
+              capabilities:
+                drop:
+                - ALL
+              readOnlyRootFilesystem: true
+        initContainers:
+          init-db:
+            envFrom:
+            - secretRef:
+                name: authelia
+            image:
+              repository: ghcr.io/onedr0p/postgres-init
+              tag: 16
+        pod:
+          enableServiceLinks: false
+          securityContext:
+            runAsGroup: 568
+            runAsNonRoot: true
+            runAsUser: 568
+          topologySpreadConstraints:
+          - labelSelector:
+              matchLabels:
+                app.kubernetes.io/name: authelia
+            maxSkew: 1
+            topologyKey: kubernetes.io/hostname
+            whenUnsatisfiable: DoNotSchedule
+        replicas: 2
+        strategy: RollingUpdate
+    ingress:
+      main:
+        annotations:
+          external-dns.alpha.kubernetes.io/target: external.18b.haus
+          hajimari.io/icon: simple-icons:authelia
+          nginx.ingress.kubernetes.io/configuration-snippet: |
+            add_header Cache-Control "no-store";
+            add_header Pragma "no-cache";
+            add_header X-Frame-Options "SAMEORIGIN";
+            add_header X-XSS-Protection "1; mode=block";
+        className: external
+        enabled: true
+        hosts:
+        - host: '{{ .Release.Name }}.18b.haus'
+          paths:
+          - path: /
+            service:
+              name: main
+              port: http
+        - host: auth.18b.haus
+          paths:
+          - path: /
+            service:
+              name: main
+              port: http
+        tls:
+        - hosts:
+          - '{{ .Release.Name }}.18b.haus'
+          - auth.18b.haus
+    persistence:
+      config:
+        enabled: true
+        globalMounts:
+        - path: /config/configuration.yaml
+          readOnly: true
+          subPath: configuration.yaml
+        name: authelia
+        type: configMap
+    service:
+      main:
+        ports:
+          http:
+            port: 80
+          metrics:
+            port: 8080
+    serviceMonitor:
+      main:
+        enabled: true
+        endpoints:
+        - interval: 1m
+          path: /metrics
+          port: metrics
+          scheme: http
+          scrapeTimeout: 10s
+
--- kubernetes/apps/default/authelia/app Kustomization: flux-system/authelia ConfigMap: default/authelia

+++ kubernetes/apps/default/authelia/app Kustomization: flux-system/authelia ConfigMap: default/authelia

@@ -0,0 +1,83 @@

+---
+apiVersion: v1
+data:
+  configuration.yaml: |
+    ---
+    authentication_backend:
+      password_reset:
+        disable: true
+      refresh_interval: 1m
+      ldap:
+        address: ldap://lldap.default.svc.cluster.local:389
+        implementation: custom
+        timeout: 5s
+        start_tls: false
+        base_dn: dc=home,dc=arpa
+        additional_users_dn: ou=people
+        users_filter: (&({username_attribute}={input})(objectClass=person))
+        additional_groups_dn: ou=groups
+        groups_filter: (member={dn})
+        group_search_mode: filter
+        user: uid=admin,ou=people,dc=home,dc=arpa
+        password: password
+        attributes:
+          username: uid
+          display_name: displayName
+          mail: mail
+          member_of: memberOf
+          group_name: cn
+
+    session:
+      same_site: lax
+      inactivity: 5m
+      expiration: 1h
+      remember_me: 1M
+      cookies:
+        - name: 18b_session
+          domain: 18b.haus
+          authelia_url: https://auth.18b.haus
+          default_redirection_url: https://18b.haus
+      redis:
+        host: redis.database.svc.cluster.local
+        database_index: 10
+        high_availability:
+          sentinel_name: redis-master
+          nodes:
+            - host: redis-node-0.redis-headless.database.svc.cluster.local
+              port: 26379
+            - host: redis-node-1.redis-headless.database.svc.cluster.local
+              port: 26379
+            - host: redis-node-2.redis-headless.database.svc.cluster.local
+              port: 26379
+
+    notifier:
+      disable_startup_check: true
+      smtp: {}
+
+    totp:
+      disable: true
+      issuer: authelia.com
+
+    webauthn:
+      disable: true
+
+    duo_api:
+      disable: true
+
+    access_control:
+      default_policy: one_factor
+      networks:
+        - name: internal
+          networks: ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
+      rules: []
+kind: ConfigMap
+metadata:
+  annotations:
+    kustomize.toolkit.fluxcd.io/substitute: disabled
+  labels:
+    app.kubernetes.io/name: authelia
+    kustomize.toolkit.fluxcd.io/name: authelia
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: authelia
+  namespace: default
+

Copy link

--- HelmRelease: default/authelia Service: default/authelia

+++ HelmRelease: default/authelia Service: default/authelia

@@ -0,0 +1,26 @@

+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: authelia
+  labels:
+    app.kubernetes.io/instance: authelia
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: authelia
+    app.kubernetes.io/service: authelia
+spec:
+  type: ClusterIP
+  ports:
+  - port: 80
+    targetPort: 80
+    protocol: TCP
+    name: http
+  - port: 8080
+    targetPort: 8080
+    protocol: TCP
+    name: metrics
+  selector:
+    app.kubernetes.io/component: main
+    app.kubernetes.io/instance: authelia
+    app.kubernetes.io/name: authelia
+
--- HelmRelease: default/authelia Deployment: default/authelia

+++ HelmRelease: default/authelia Deployment: default/authelia

@@ -0,0 +1,117 @@

+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: authelia
+  labels:
+    app.kubernetes.io/component: main
+    app.kubernetes.io/instance: authelia
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: authelia
+  annotations:
+    reloader.stakater.com/auto: 'true'
+spec:
+  revisionHistoryLimit: 3
+  replicas: 2
+  strategy:
+    type: RollingUpdate
+  selector:
+    matchLabels:
+      app.kubernetes.io/component: main
+      app.kubernetes.io/name: authelia
+      app.kubernetes.io/instance: authelia
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/component: main
+        app.kubernetes.io/instance: authelia
+        app.kubernetes.io/name: authelia
+    spec:
+      enableServiceLinks: false
+      serviceAccountName: default
+      automountServiceAccountToken: true
+      securityContext:
+        runAsGroup: 568
+        runAsNonRoot: true
+        runAsUser: 568
+      hostIPC: false
+      hostNetwork: false
+      hostPID: false
+      dnsPolicy: ClusterFirst
+      topologySpreadConstraints:
+      - labelSelector:
+          matchLabels:
+            app.kubernetes.io/name: authelia
+        maxSkew: 1
+        topologyKey: kubernetes.io/hostname
+        whenUnsatisfiable: DoNotSchedule
+      initContainers:
+      - envFrom:
+        - secretRef:
+            name: authelia
+        image: ghcr.io/onedr0p/postgres-init:16
+        name: init-db
+        volumeMounts:
+        - mountPath: /config/configuration.yaml
+          name: config
+          readOnly: true
+          subPath: configuration.yaml
+      containers:
+      - env:
+        - name: AUTHELIA_SERVER_ADDRESS
+          value: tcp://0.0.0.0:80
+        - name: AUTHELIA_SERVER_DISABLE_HEALTHCHECK
+          value: 'true'
+        - name: AUTHELIA_TELEMETRY_METRICS_ADDRESS
+          value: tcp://0.0.0.0:8080
+        - name: AUTHELIA_TELEMETRY_METRICS_ENABLED
+          value: 'true'
+        - name: AUTHELIA_THEME
+          value: light
+        - name: X_AUTHELIA_CONFIG
+          value: /config/configuration.yaml
+        - name: X_AUTHELIA_CONFIG_FILTERS
+          value: expand-env
+        envFrom:
+        - secretRef:
+            name: authelia
+        image: ghcr.io/authelia/authelia:v4.38.0-beta3@sha256:9ad7df91dfec75d2f46d544e3128215b755ee78550b4ed0ed995b5a3fad35458
+        livenessProbe:
+          failureThreshold: 3
+          httpGet:
+            path: /api/health
+            port: 80
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          timeoutSeconds: 1
+        name: main
+        readinessProbe:
+          failureThreshold: 3
+          httpGet:
+            path: /api/health
+            port: 80
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          timeoutSeconds: 1
+        resources:
+          limits:
+            memory: 128Mi
+          requests:
+            cpu: 10m
+            memory: 32Mi
+        securityContext:
+          allowPrivilegeEscalation: false
+          capabilities:
+            drop:
+            - ALL
+          readOnlyRootFilesystem: true
+        volumeMounts:
+        - mountPath: /config/configuration.yaml
+          name: config
+          readOnly: true
+          subPath: configuration.yaml
+      volumes:
+      - configMap:
+          name: authelia
+        name: config
+
--- HelmRelease: default/authelia Ingress: default/authelia

+++ HelmRelease: default/authelia Ingress: default/authelia

@@ -0,0 +1,45 @@

+---
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: authelia
+  labels:
+    app.kubernetes.io/instance: authelia
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: authelia
+  annotations:
+    external-dns.alpha.kubernetes.io/target: external.18b.haus
+    hajimari.io/icon: simple-icons:authelia
+    nginx.ingress.kubernetes.io/configuration-snippet: |
+      add_header Cache-Control "no-store";
+      add_header Pragma "no-cache";
+      add_header X-Frame-Options "SAMEORIGIN";
+      add_header X-XSS-Protection "1; mode=block";
+spec:
+  ingressClassName: external
+  tls:
+  - hosts:
+    - authelia.18b.haus
+    - auth.18b.haus
+  rules:
+  - host: authelia.18b.haus
+    http:
+      paths:
+      - path: /
+        pathType: Prefix
+        backend:
+          service:
+            name: authelia
+            port:
+              number: 80
+  - host: auth.18b.haus
+    http:
+      paths:
+      - path: /
+        pathType: Prefix
+        backend:
+          service:
+            name: authelia
+            port:
+              number: 80
+
--- HelmRelease: default/authelia ServiceMonitor: default/authelia

+++ HelmRelease: default/authelia ServiceMonitor: default/authelia

@@ -0,0 +1,22 @@

+---
+apiVersion: monitoring.coreos.com/v1
+kind: ServiceMonitor
+metadata:
+  name: authelia
+  labels:
+    app.kubernetes.io/instance: authelia
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: authelia
+spec:
+  selector:
+    matchLabels:
+      app.kubernetes.io/service: authelia
+      app.kubernetes.io/name: authelia
+      app.kubernetes.io/instance: authelia
+  endpoints:
+  - interval: 1m
+    path: /metrics
+    port: metrics
+    scheme: http
+    scrapeTimeout: 10s
+

@martinohmann martinohmann merged commit 4086cd3 into main Dec 28, 2023
4 checks passed
@martinohmann martinohmann deleted the authelia branch December 28, 2023 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes Changes made in the kubernetes directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant