ui/deploy/deploy.yaml

123 lines
2.4 KiB
YAML

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mathy
spec:
selector:
matchLabels:
name: mathy
template:
metadata:
labels:
name: mathy
spec:
containers:
- name: mathy
image: glmdev/mathy:latest
imagePullPolicy: Always
ports:
- containerPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mathy-api
spec:
selector:
matchLabels:
name: mathy-api
template:
metadata:
labels:
name: mathy-api
spec:
containers:
- name: mathy
image: glmdev/mathy-api:latest
imagePullPolicy: Always
env:
- name: REDIS_HOST
value: localhost
- name: DATABASE_HOST
valueFrom:
secretKeyRef:
name: psql-conn
key: host
optional: false
- name: DATABASE_USERNAME
value: postgres
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: psql-conn
key: password
optional: false
- name: DATABASE_NAME
value: mathy
ports:
- containerPort: 8000
- name: redis
image: redis:latest
imagePullPolicy: Always
ports:
- containerPort: 6379
---
apiVersion: v1
kind: Service
metadata:
name: mathy-api-service
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 8000
selector:
name: mathy-api
---
apiVersion: v1
kind: Service
metadata:
name: mathy-service
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
name: mathy
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mathy-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
tls:
- hosts:
- crystalmath.tech
secretName: mathy-tls
rules:
- host: "crystalmath.tech"
http:
paths:
- pathType: Prefix
path: "/api"
backend:
service:
name: mathy-api-service
port:
number: 80
- pathType: Prefix
path: "/"
backend:
service:
name: mathy-service
port:
number: 80