feat: add k8s deployment yaml
This commit is contained in:
parent
bcf2699feb
commit
b86ea2737d
79
resource/deploy/cache.yaml
Normal file
79
resource/deploy/cache.yaml
Normal file
@ -0,0 +1,79 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: cache-config
|
||||
labels:
|
||||
app: cache
|
||||
data:
|
||||
redis.conf: |
|
||||
requirepass YeT_An0tHeR_VeRy-S3cUr3^PaSsWoRd
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: cache-pvc
|
||||
labels:
|
||||
app: cache
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: local-path
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: cache-deployment
|
||||
labels:
|
||||
app: cache
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cache
|
||||
template:
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: cache-pod
|
||||
labels:
|
||||
app: cache
|
||||
spec:
|
||||
containers:
|
||||
- name: cache
|
||||
image: docker.io/library/redis:7-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 6379
|
||||
volumeMounts:
|
||||
- name: cache-vol
|
||||
mountPath: /data
|
||||
- name: cache-config
|
||||
mountPath: /etc/redis/
|
||||
volumes:
|
||||
- name: cache-vol
|
||||
persistentVolumeClaim:
|
||||
claimName: cache-pvc
|
||||
- name: cache-config
|
||||
configMap:
|
||||
name: cache-config
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: cache-service
|
||||
labels:
|
||||
app: cache
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: cache
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 6379
|
||||
targetPort: 6379
|
78
resource/deploy/db.yaml
Normal file
78
resource/deploy/db.yaml
Normal file
@ -0,0 +1,78 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: db-config
|
||||
labels:
|
||||
app: db
|
||||
data:
|
||||
POSTGRES_USER: "woj"
|
||||
POSTGRES_PASSWORD: "A_VeRy-S3cUr3^PaSsWoRd"
|
||||
POSTGRES_DB: "woj"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: db-pvc
|
||||
labels:
|
||||
app: db
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: local-path
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: db-deployment
|
||||
labels:
|
||||
app: db
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: db
|
||||
template:
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: db-pod
|
||||
labels:
|
||||
app: db
|
||||
spec:
|
||||
containers:
|
||||
- name: db
|
||||
image: docker.io/library/postgres:16-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: db-config
|
||||
volumeMounts:
|
||||
- name: db-vol
|
||||
mountPath: /var/lib/postgresql/data
|
||||
volumes:
|
||||
- name: db-vol
|
||||
persistentVolumeClaim:
|
||||
claimName: db-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: db-service
|
||||
labels:
|
||||
app: db
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: db
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 5432
|
||||
targetPort: 5432
|
74
resource/deploy/runner.yaml
Normal file
74
resource/deploy/runner.yaml
Normal file
@ -0,0 +1,74 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: runner-config
|
||||
labels:
|
||||
app: runner
|
||||
data:
|
||||
DATABASE_HOST: "db-service.woj.svc.cluster.local"
|
||||
DATABASE_USER: "woj"
|
||||
DATABASE_PASSWORD: "A_VeRy-S3cUr3^PaSsWoRd"
|
||||
DATABASE_NAME: "woj"
|
||||
|
||||
REDIS_ADDRESS: "cache-service.woj.svc.cluster.local"
|
||||
REDIS_PASSWORD: "YeT_An0tHeR_VeRy-S3cUr3^PaSsWoRd"
|
||||
|
||||
STORAGE_ENDPOINT: "storage-service.woj.svc.cluster.local:9000"
|
||||
STORAGE_ACCESS_KEY: "A_VeRy_CoMpLeX_AcCeSs_KeY"
|
||||
STORAGE_SECRET_KEY: "A_VeRy_CoMpLeX_ScReT_KeY"
|
||||
STORAGE_BUCKET: "woj"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: runner-pvc
|
||||
labels:
|
||||
app: runner
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: local-path
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: runner-deployment
|
||||
labels:
|
||||
app: runner
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: runner
|
||||
template:
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: runner-pod
|
||||
labels:
|
||||
app: runner
|
||||
spec:
|
||||
containers:
|
||||
- name: runner
|
||||
image: git.0x7f.app/woj/woj-runner:1.1.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
args:
|
||||
- runner
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: runner-config
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- name: runner-vol
|
||||
mountPath: /app/resource/runner/user
|
||||
volumes:
|
||||
- name: runner-vol
|
||||
persistentVolumeClaim:
|
||||
claimName: runner-pvc
|
77
resource/deploy/server.yaml
Normal file
77
resource/deploy/server.yaml
Normal file
@ -0,0 +1,77 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: server-config
|
||||
labels:
|
||||
app: server
|
||||
data:
|
||||
DATABASE_HOST: "db-service.woj.svc.cluster.local"
|
||||
DATABASE_USER: "woj"
|
||||
DATABASE_PASSWORD: "A_VeRy-S3cUr3^PaSsWoRd"
|
||||
DATABASE_NAME: "woj"
|
||||
|
||||
REDIS_ADDRESS: "cache-service.woj.svc.cluster.local"
|
||||
REDIS_PASSWORD: "YeT_An0tHeR_VeRy-S3cUr3^PaSsWoRd"
|
||||
|
||||
STORAGE_ENDPOINT: "storage-service.woj.svc.cluster.local:9000"
|
||||
STORAGE_ACCESS_KEY: "A_VeRy_CoMpLeX_AcCeSs_KeY"
|
||||
STORAGE_SECRET_KEY: "A_VeRy_CoMpLeX_ScReT_KeY"
|
||||
STORAGE_BUCKET: "woj"
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: server-deployment
|
||||
labels:
|
||||
app: server
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: server
|
||||
template:
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: server-pod
|
||||
labels:
|
||||
app: server
|
||||
spec:
|
||||
initContainers:
|
||||
- name: init-server
|
||||
image: git.0x7f.app/woj/woj-server:1.1.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
args:
|
||||
- init
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: server-config
|
||||
containers:
|
||||
- name: server
|
||||
image: git.0x7f.app/woj/woj-server:1.1.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
args:
|
||||
- server
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: server-config
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: server-service
|
||||
labels:
|
||||
app: server
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
app: server
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 8000
|
||||
targetPort: 8000
|
84
resource/deploy/storage.yaml
Normal file
84
resource/deploy/storage.yaml
Normal file
@ -0,0 +1,84 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: storage-config
|
||||
labels:
|
||||
app: storage
|
||||
data:
|
||||
MINIO_ROOT_USER: "A_VeRy_CoMpLeX_AcCeSs_KeY"
|
||||
MINIO_ROOT_PASSWORD: "A_VeRy_CoMpLeX_ScReT_KeY"
|
||||
MINIO_VOLUMES: "/data"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: storage-pvc
|
||||
labels:
|
||||
app: storage
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: local-path
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: storage-deployment
|
||||
labels:
|
||||
app: storage
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: storage
|
||||
template:
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: storage-pod
|
||||
labels:
|
||||
app: storage
|
||||
spec:
|
||||
containers:
|
||||
- name: storage
|
||||
image: quay.io/minio/minio:latest
|
||||
imagePullPolicy: Always
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
args:
|
||||
- mkdir -p /data/woj && minio server /data --console-address ":9001"
|
||||
ports:
|
||||
- containerPort: 9000
|
||||
- containerPort: 9001
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: storage-config
|
||||
volumeMounts:
|
||||
- name: storage-vol
|
||||
mountPath: /data
|
||||
volumes:
|
||||
- name: storage-vol
|
||||
persistentVolumeClaim:
|
||||
claimName: storage-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
namespace: woj
|
||||
name: storage-service
|
||||
labels:
|
||||
app: storage
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
app: storage
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 9000
|
||||
targetPort: 9000
|
Loading…
Reference in New Issue
Block a user