add all**

This commit is contained in:
gregory hendrickson
2023-01-28 22:34:40 -08:00
parent c4b8a7df51
commit 22e03c22f2
17 changed files with 317 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
spec:
replicas: 1
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql:8
ports:
- containerPort: 3306
env:
- name: MYSQL_ROOT_PASSWORD
value: "password"
- name: MYSQL_DATABASE
value: "nextcloud"
- name: MYSQL_USER
value: "nextcloud"
- name: MYSQL_PASSWORD
value: "password"
volumeMounts:
- name: mysql-data
mountPath: /var/lib/mysql
volumes:
- name: mysql-data
persistentVolumeClaim:
claimName: mysql-pvc

View File

@@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nextcloud
spec:
replicas: 1
selector:
matchLabels:
app: nextcloud
template:
metadata:
labels:
app: nextcloud
spec:
containers:
- name: nextcloud
image: nextcloud:latest
ports:
- containerPort: 80
volumeMounts:
- name: nextcloud-data
mountPath: /var/www/html
volumes:
- name: nextcloud-data
persistentVolumeClaim:
claimName: nextcloud-pvc

View File

@@ -0,0 +1,59 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-ingress
spec:
replicas: 1
selector:
matchLabels:
app: nginx-ingress
template:
metadata:
labels:
app: nginx-ingress
spec:
containers:
- name: nginx-ingress
image: nginx-ingress-controller:alpine
ports:
- containerPort: 80
- containerPort: 443
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
args:
- /nginx-ingress-controller
- --configmap=$(POD_NAMESPACE)/nginx-ingress-config
- --tcp-services-configmap=$(POD_NAMESPACE)/nginx-ingress-tcp-services-config
- --udp-services-configmap=$(POD_NAMESPACE)/nginx-ingress-udp-services-config
- --annotations-prefix=nginx.ingress.kubernetes.io
- --publish-service=$(POD_NAMESPACE)/nginx-ingress
volumeMounts:
- name: nginx-ingress-config
mountPath: /etc/nginx/nginx-ingress-config
- name: nginx-ingress-tcp-services-config
mountPath: /etc/nginx/nginx-ingress-tcp-services-config
- name: nginx-ingress-udp-services-config
mountPath: /etc/nginx/nginx-ingress-udp-services-config
- name: nginx-ingress-certs
mountPath: /etc/nginx/nginx-ingress-certs
volumes:
- name: nginx-ingress-config
configMap:
name: nginx-ingress-config
- name: nginx-ingress-tcp-services-config
configMap:
name: nginx-ingress-tcp-services-config
- name: nginx-ingress-udp-services-config
configMap:
name: nginx-ingress-udp-services-config
- name: nginx-ingress-certs
secret:
secretName: nginx-ingress-certs

11
mysql-configmap.yaml Normal file
View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-config
data:
my.cnf: |
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
bind-address=0.0.0.0
max_connections=1024

6
mysql-secret.yaml Normal file
View File

@@ -0,0 +1,6 @@
apiVersion: v1
kind: Secret
metadata:
name: mysql-secret
data:
root-password: "cGFzc3dvcmQ="

27
nextcloud-configmap.yaml Normal file
View File

@@ -0,0 +1,27 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nextcloud-config
data:
config.php: |
<?php
$CONFIG = array (
'instanceid' => 'oc12345678',
'passwordsalt' => 'abcdefghijklmnopqrstuvwxyz',
'secret' => 'abcdefghijklmnopqrstuvwxyz',
'trusted_domains' =>
array (
0 => 'nextcloud.example.com',
),
'datadirectory' => '/var/www/html/data',
'overwrite.cli.url' => 'http://nextcloud.example.com',
'dbtype' => 'mysql',
'version' => '20.0.0.10',
'dbname' => 'nextcloud',
'dbhost' => 'nextcloud-mysql',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => 'nextcloud',
'dbpassword' => 'password',
'installed' => true,
);

41
nginx-configmap.yaml Normal file
View File

@@ -0,0 +1,41 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-ingress-config
data:
nginx-ingress.conf: |-
# Configuration for nginx-ingress
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name _;
location / {
proxy_pass http://nextcloud-service;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 443 ssl;
server_name _;
ssl_certificate /etc/nginx/certs/tls.crt;
ssl_certificate_key /etc/nginx/certs/tls.key;
location / {
proxy_pass http://nextcloud-service;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}

7
nginx-secret.yaml Normal file
View File

@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: nginx-ingress-certs
data:
tls.crt: <base64 encoded cert>
tls.key: <base64 encoded key>

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
selector:
app: mysql
ports:
- name: mysql
port: 3306
targetPort: 3306
type: ClusterIP

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: nextcloud
spec:
selector:
app: nextcloud
ports:
- name: http
port: 80
targetPort: 80
type: ClusterIP

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: nginx-ingress
spec:
selector:
app: nginx-ingress
ports:
- name: http
port: 80
targetPort: 80
- name: https
port: 443
targetPort: 443
type: ClusterIP

11
volumes/mysql-pv.yaml Normal file
View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: mysql-pv
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data/mysql"

10
volumes/mysql-pvc.yaml Normal file
View File

@@ -0,0 +1,10 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi

11
volumes/nextcloud-pv.yaml Normal file
View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: nextcloud-pv
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data/nextcloud"

View File

@@ -0,0 +1,10 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nextcloud-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi

11
volumes/nginx-pv.yaml Normal file
View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: nginx-ingress-pv
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data/nginx-ingress"

13
volumes/nginx-pvc.yaml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nginx-ingress-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
selector:
matchLabels:
app: nginx-ingress