Lb1/k8s/deployment.yaml

103 lines
2.1 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: luxe-gateway
namespace: default
labels:
app: luxe-gateway
spec:
replicas: 3
selector:
matchLabels:
app: luxe-gateway
template:
metadata:
labels:
app: luxe-gateway
spec:
containers:
- name: gateway
image: luxe/gateway:1.0.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
envFrom:
- configMapRef:
name: luxe-config
- secretRef:
name: luxe-secrets
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "1000m"
livenessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 15
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 3000
initialDelaySeconds: 5
periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
name: luxe-gateway-service
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 3000
selector:
app: luxe-gateway
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: luxe-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec:
tls:
- hosts:
- api.luxe.com
secretName: luxe-tls-secret
rules:
- host: api.luxe.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: luxe-gateway-service
port:
number: 80
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: luxe-gateway-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: luxe-gateway
minReplicas: 3
maxReplicas: 20
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75