refresh
This commit is contained in:
155
k8s.yaml
155
k8s.yaml
@@ -1,120 +1,123 @@
|
||||
# Kubernetes manifest for Best of PB app
|
||||
# Includes frontend, backend, services, and ingress
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: awards-svc
|
||||
namespace: awards
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 4000
|
||||
protocol: TCP
|
||||
selector:
|
||||
app: awards
|
||||
|
||||
---
|
||||
# Backend Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: pb-backend
|
||||
labels:
|
||||
app: pb-backend
|
||||
name: awards-dep
|
||||
namespace: awards
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: pb-backend
|
||||
app: awards
|
||||
replicas: 2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: pb-backend
|
||||
app: awards
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: harborcred
|
||||
containers:
|
||||
- name: pb-backend
|
||||
image: harbor.scottyah.com/bestofpb/pb-backend:latest
|
||||
- name: awards
|
||||
image: harbor.scottyah.com/secure/awards:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 4000
|
||||
env:
|
||||
- name: NODE_ENV
|
||||
value: "production"
|
||||
# Add volume mounts for persistent storage if needed
|
||||
- name: PORT
|
||||
value: "4000"
|
||||
- name: DATABASE_PATH
|
||||
value: "/app/data/awards.db"
|
||||
- name: CORS_ORIGIN
|
||||
value: "https://awards.scottyah.com"
|
||||
- name: ADMIN_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: awards-secret
|
||||
key: admin-username
|
||||
- name: ADMIN_PASSWORD_HASH
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: awards-secret
|
||||
key: admin-password-hash
|
||||
- name: NOMINATIM_BASE_URL
|
||||
value: "https://nominatim.openstreetmap.org"
|
||||
- name: NOMINATIM_USER_AGENT
|
||||
value: "BestOfPBAwardsApp/1.0"
|
||||
- name: RATE_LIMIT_WINDOW_MS
|
||||
value: "900000"
|
||||
- name: RATE_LIMIT_MAX_REQUESTS
|
||||
value: "100"
|
||||
- name: RATE_LIMIT_NOMINATION_MAX
|
||||
value: "10"
|
||||
- name: RATE_LIMIT_EMOJI_MAX
|
||||
value: "50"
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /app/data
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: awards-pvc
|
||||
|
||||
---
|
||||
# Backend Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: pb-backend
|
||||
name: awards-pvc
|
||||
namespace: awards
|
||||
spec:
|
||||
selector:
|
||||
app: pb-backend
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 4000
|
||||
targetPort: 4000
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
|
||||
---
|
||||
# Frontend Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: pb-frontend
|
||||
labels:
|
||||
app: pb-frontend
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: pb-frontend
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: pb-frontend
|
||||
spec:
|
||||
containers:
|
||||
- name: pb-frontend
|
||||
image: harbor.scottyah.com/bestofpb/pb-frontend:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 80
|
||||
|
||||
---
|
||||
# Frontend Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: pb-frontend
|
||||
spec:
|
||||
selector:
|
||||
app: pb-frontend
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
||||
|
||||
---
|
||||
# Ingress (requires ingress controller, e.g., traefik)
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: bestofpb-ingress
|
||||
name: awards-ingress
|
||||
namespace: awards
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: letsencrypt-prod-cloudflare
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: web, websecure
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
spec:
|
||||
ingressClassName: traefik
|
||||
tls:
|
||||
- hosts:
|
||||
- awards.scottyah.com
|
||||
secretName: awards-scottyah-com-tls
|
||||
secretName: awards-tls
|
||||
rules:
|
||||
- host: awards.scottyah.com
|
||||
http:
|
||||
paths:
|
||||
# Route /api to backend
|
||||
- path: /api
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: pb-backend
|
||||
port:
|
||||
number: 4000
|
||||
# Route / to frontend
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: pb-frontend
|
||||
name: awards-svc
|
||||
port:
|
||||
number: 80
|
||||
number: 80
|
||||
|
||||
Reference in New Issue
Block a user