Browse Source

init

master
tobi 9 months ago
commit
acd7477c95
5 changed files with 113 additions and 0 deletions
  1. +5
    -0
      README.md
  2. +52
    -0
      db.yaml
  3. +36
    -0
      default.yaml
  4. +4
    -0
      namespace.yaml
  5. +16
    -0
      pvc.yaml

+ 5
- 0
README.md View File

@@ -0,0 +1,5 @@
# Template Kubernetes files

Some base files I find myself creating over and over again.

TODO: Search for tool / automate the process a bit more.

+ 52
- 0
db.yaml View File

@@ -0,0 +1,52 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: template
namespace: template
spec:
selector:
matchLabels:
app: template
# completely removes the pod on update BEFORE creating the new one.
# this is needed since normal ceph block devices can only be mountet
# ONCE at a time
strategy:
type: Recreate
template:
metadata:
labels:
app: template
spec:
containers:
- image: mariadb:10.5.6
name: mariadb
env:
# passwords can be dead simple because the database is only accessible from within the cluster
- name: MYSQL_ROOT_PASSWORD
value: "template"
- name: MYSQL_DATABASE
value: "template"
volumeMounts:
- name: db-vol
mountPath: /var/lib/mysql
volumes:
- name: db-vol
persistentVolumeClaim:
claimName: template
---

apiVersion: v1
kind: Service
metadata:
name: template
namespace: template
spec:
# internal floating ip
externalIPs:
- 10.0.0.9
ports:
- port: 3306
targetPort: 3306
selector:
app: template


+ 36
- 0
default.yaml View File

@@ -0,0 +1,36 @@
apiVersion: v1
kind: Service
metadata:
name: template
namespace: template
spec:
ports:
- port: 80
targetPort: 80
selector:
app: template

---

apiVersion: apps/v1
kind: Deployment
metadata:
name: template
namespace: template
spec:
selector:
matchLabels:
app: template
template:
metadata:
labels:
app: template
spec:
containers:
- image: nexus.tobias-huebner.org/th-wiki:0.5
name: template





+ 4
- 0
namespace.yaml View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: template

+ 16
- 0
pvc.yaml View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: template
namespace: tobias-huebner
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
# Filesystem for normally using the volume, block to only add it as a
# raw device (which you then have to format and mount I think)
volumeMode: Filesystem
# volumeName should be same as PV name
volumeName: template

Loading…
Cancel
Save