Split up k8s.yaml

This commit is contained in:
2022-03-16 01:56:17 +09:00
parent 9bd7f03301
commit 7fb7f01dc6
2 changed files with 33 additions and 36 deletions

85
k8s/deployments.yaml Normal file
View File

@@ -0,0 +1,85 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: astrojs
spec:
selector:
matchLabels:
app: astrojs
replicas: 1
template:
metadata:
labels:
app: astrojs
spec:
securityContext:
runAsGroup: 1001
runAsNonRoot: true
runAsUser: 1001
imagePullSecrets:
- name: registry-auth
initContainers:
- name: init-dir
image: alpine:latest
command:
- chown
- 1001:1001
- /app/cache
securityContext:
runAsNonRoot: false
volumeMounts:
- name: cache
mountPath: "/app/cache"
containers:
- name: web
image: registry.k8s.astropenguin.net/astrojs:2022.03.15.04
env:
- name: FLASK_DEBUG
value: "0"
- name: FLASK_ENV
value: "production"
- name: RUN_MODE
value: "web"
volumeMounts:
- name: cache
mountPath: "/app/cache"
- name: redis
image: redis:6.0.8-alpine
- name: compiler
image: registry.k8s.astropenguin.net/astrojs:2022.03.15.04
env:
- name: RUN_MODE
value: "tasks"
volumeMounts:
- name: cache
mountPath: "/app/cache"
volumes:
- name: cache
persistentVolumeClaim:
claimName: astrojs-cache
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: astrojs-cache
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
storageClassName: local-storage
---
apiVersion: v1
kind: Service
metadata:
name: astrojs
spec:
selector:
app: astrojs
ports:
- port: 5000
targetPort: 5000

33
k8s/ingress.yaml Normal file
View File

@@ -0,0 +1,33 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: default-astrojs
namespace: ingress-https
spec:
ingressClassName: nginx
tls:
- hosts:
- astrojs.k8s.astropenguin.net
secretName: any-k8s-astro-prod
rules:
- host: astrojs.k8s.astropenguin.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: default-astrojs
port:
number: 5000
---
kind: Service
apiVersion: v1
metadata:
name: default-astrojs
namespace: ingress-https
spec:
type: ExternalName
externalName: astrojs.default.svc.cluster.local