Skip to content

Commit

Permalink
vm: add k8s apps
Browse files Browse the repository at this point in the history
  • Loading branch information
alomerry committed Feb 10, 2024
1 parent db55b74 commit 1da9bd8
Show file tree
Hide file tree
Showing 6 changed files with 286 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vm/scripts/pve/k8s/apply/alomerry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: alomerry
13 changes: 13 additions & 0 deletions vm/scripts/pve/k8s/apps/mysql/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$ANSIBLE_VAULT;1.1;AES256
66363136376431333266346465623332623464613633643239653934313330643063353730613936
3430316636636531623562613763643965373264663333370a396361396233373461373266666638
33643365656164656436663634326563323631643661646430373235626362353163366133376464
3933373465346664640a346565643564313732383530383963393661316437613737643831333965
36366564373232626531306434386338656431643038633563356434306665376162633763376163
31386365653131383133343430643166373535333364383661333864333635656233623465383431
64316261376436616639653364306234303138336162373766633466393966396632616236323665
34656433636537643532343834386162656530323765323338663766313438306564616539376238
65356636396533386665663935643531663839623565396634313734353034623934383664656134
38323263353137326266376664636664326130623063306439613562643033363230666436316265
33643531393661376361346236376631396134323466363831353138623438643330623864306630
65613935393333306437
172 changes: 172 additions & 0 deletions vm/scripts/pve/k8s/apps/mysql/mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-8-pvc-alomerry
namespace: alomerry
spec:
resources:
requests:
storage: 10G
volumeMode: Filesystem
storageClassName: nfs-csi
accessModes:
- ReadWriteOnce
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-5-pvc-alomerry
namespace: alomerry
spec:
resources:
requests:
storage: 10G
volumeMode: Filesystem
storageClassName: nfs-csi
accessModes:
- ReadWriteOnce
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-8-config
namespace: alomerry
labels:
app: mysql8
data:
my.cnf: |
[mysql]
default-character-set=utf8mb4
[mysqld]
max_connections = 2000
skip_ssl
ssl=0
---
apiVersion: v1
kind: Service
metadata:
name: mysql-8-service
namespace: alomerry
spec:
ports:
- name: mysql
port: 3306
targetPort: mysql
protocol: TCP
selector:
app: mysql8
---
apiVersion: v1
kind: Service
metadata:
name: mysql-5-service
namespace: alomerry
spec:
ports:
- name: mysql
port: 3306
targetPort: mysql
protocol: TCP
selector:
app: mysql8
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql-8-deployment
namespace: alomerry
spec:
replicas: 1
selector:
matchLabels:
app: mysql8
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql8
spec:
containers:
- image: mysql:8.0
name: mysql8
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secret
key: rootPasswd_8
- name: MYSQL_ROOT_HOST
value: ""
ports:
- containerPort: 3306
protocol: TCP
name: mysql
volumeMounts:
- name: mysql-8-config
mountPath: /etc/mysql/conf.d/my.cnf
subPath: my.cnf
- name: localtime
readOnly: true
mountPath: /etc/localtime
- name: mysql-8-pv
mountPath: /var/lib/mysql
volumes:
- name: mysql-8-config
configMap:
name: mysql-8-config
- name: mysql-8-pv
persistentVolumeClaim:
claimName: mysql-8-pvc-alomerry
- name: localtime
hostPath:
type: File
path: /etc/localtime
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql-5-deployment
namespace: alomerry
spec:
replicas: 1
selector:
matchLabels:
app: mysql5
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql5
spec:
containers:
- image: mysql:5.7
name: mysql5
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secret
key: rootPasswd_5
- name: MYSQL_ROOT_HOST
value: ""
ports:
- containerPort: 3306
protocol: TCP
name: mysql
volumeMounts:
- name: localtime
readOnly: true
mountPath: /etc/localtime
- name: mysql-5-pv
mountPath: /var/lib/mysql
volumes:
- name: mysql-5-pv
persistentVolumeClaim:
claimName: mysql-5-pvc-alomerry
- name: localtime
hostPath:
type: File
path: /etc/localtime
14 changes: 14 additions & 0 deletions vm/scripts/pve/k8s/apps/umami/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 创建数据库

```sql
CREATE DATABASE `umami` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER umami IDENTIFIED BY 'password';
grant all privileges on umami.* to 'umami'@'%';
FLUSH PRIVILEGES;
```


CREATE USER umami IDENTIFIED BY 'JdsVEewaa23IF8u8qFDS1';

ALTER USER 'umami'@'localhost' IDENTIFIED WITH mysql_native_password BY 'JdsVEewaa23IF8u8qFDS1';

18 changes: 18 additions & 0 deletions vm/scripts/pve/k8s/apps/umami/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$ANSIBLE_VAULT;1.1;AES256
63373366636430303064353431653630383763376430333766613163653132353864616636626361
3863373366373761326435656166373238323433356262320a643538333737363561613636343933
35373633653833616535356138393630373862613530313632336630363334323037643762383839
3666313864643734360a353730623632633665306262343637623663336131333061633065336632
39303839623761666630306634643038663239633236646565393535633634303163633432303635
33386231376633336364633261373839396536393434623131353966336330383732626461346639
36623333363463663539343832646537393463343163613062616166343833653737356238653238
30343239336334616132353064316631323261393936393464613362346233303236613938633561
38386332646262666539623366333137613132383638643862323564623566326662373261656332
62363464363938623464323031396365633866363162373261333234643839363136623863346638
38663830636630636238393661663165383539656463363866376533336330393234623534636534
31643039623237653065623237653866366636356464373161396665376131646666396264363236
66353963646666613132326430313937356636303036376331303664343337363534623033326335
37343431643662653965663632663762343462643939333564646230646233666332393935313833
65623063613535386536646432376133303661316430623663323166313136313932623138633965
36363738366533303564663166663362313664323462316261646335373930353039336335396337
3562
64 changes: 64 additions & 0 deletions vm/scripts/pve/k8s/apps/umami/umami.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
apiVersion: v1
kind: Service
metadata:
name: umami-service
namespace: alomerry
spec:
ports:
- name: umami
port: 3000
targetPort: umami
protocol: TCP
selector:
app: umami
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: umami-deployment
namespace: alomerry
spec:
replicas: 1
selector:
matchLabels:
app: umami
strategy:
type: Recreate
template:
metadata:
labels:
app: umami
spec:
containers:
# ghcr.lank8s.cn/umami-software/umami:mysql-latest
# registry.cn-hangzhou.aliyuncs.com/alomerry/k8s-umami:latest
- image: registry.cn-hangzhou.aliyuncs.com/alomerry/k8s-umami:latest
imagePullPolicy: Always
name: umami
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: mysql-umami-cfg
key: dsn
- name: APP_SECRET
valueFrom:
secretKeyRef:
name: mysql-umami-cfg
key: secret
- name: DATABASE_TYPE
value: mysql
ports:
- containerPort: 3000
protocol: TCP
name: umami
volumeMounts:
- name: localtime
readOnly: true
mountPath: /etc/localtime
volumes:
- name: localtime
hostPath:
type: File
path: /etc/localtime

0 comments on commit 1da9bd8

Please sign in to comment.