Skip to content

Instantly share code, notes, and snippets.

@mgerhardy
Last active August 26, 2020 19:45
Show Gist options
  • Save mgerhardy/68f70811068ce01bdf700d652325d82b to your computer and use it in GitHub Desktop.
Save mgerhardy/68f70811068ce01bdf700d652325d82b to your computer and use it in GitHub Desktop.
nextcloud-deployment.yaml.j2
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: nextcloud-credentials
stringData:
NEXTCLOUD_ADMIN_USER: {{ nextcloud_admin_user }}
NEXTCLOUD_ADMIN_PASSWORD: {{ nextcloud_admin_password }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nextcloud-deployment
spec:
replicas: 1
selector:
matchLabels:
app: nextcloud
template:
metadata:
labels:
app: nextcloud
spec:
volumes:
- name: nextcloud-persistent-storage
persistentVolumeClaim:
claimName: shared-pv-claim
containers:
- env:
- name: PUID
value: "1000"
- name: PGID
value: "1000"
- name: MYSQL_DATABASE
value: nextcloud
- name: MYSQL_USER
value: {{ mariadb_user }}
- name: MYSQL_HOST
value: mariadb
- name: TZ
value: Europe/Berlin
- name: NEXTCLOUD_DATA_DIR
value: /data
- name: NC_TRUSTED_DOMAINS
value: nextcloud.{{ cluster_fqdn }}
- name: REDIS_HOST
value: redis
- name: REDIS_HOST_PORT
value: "6379"
envFrom:
- secretRef:
name: mariadb-credentials
- secretRef:
name: nextcloud-credentials
image: linuxserver/nextcloud:19.0.1-ls96
name: nextcloud
ports:
- containerPort: 443
protocol: TCP
volumeMounts:
- name: nextcloud-persistent-storage
mountPath: /config
subPath: nextcloud
- name: nextcloud-persistent-storage
mountPath: /data
subPath: nextcloud-data
resources:
requests:
memory: 512Mi
cpu: 1000m
limits:
memory: 2048Mi
cpu: 2000m
readinessProbe:
httpGet:
path: /status.php
port: 443
scheme: HTTP
initialDelaySeconds: 70
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
failureThreshold: 10
livenessProbe:
httpGet:
path: /status.php
port: 443
scheme: HTTP
initialDelaySeconds: 60
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
failureThreshold: 10
dnsPolicy: ClusterFirst
restartPolicy: Always
terminationGracePeriodSeconds: 30
---
apiVersion: "networking.k8s.io/v1beta1"
kind: "Ingress"
metadata:
annotations:
kubernetes.io/ingress.class: traefik
name: "nextcloud"
spec:
rules:
- host: nextcloud.{{ cluster_fqdn }}
http:
paths:
- path: /
backend:
serviceName: nextcloud
servicePort: 443
---
apiVersion: v1
kind: Service
metadata:
name: nextcloud
spec:
ports:
- port: 443
name: http-tls
protocol: TCP
targetPort: 443
selector:
app: nextcloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment