kube-exam/api-deployment.yaml

60 lines
1.1 KiB
YAML

apiVersion: v1
kind: Service
metadata:
name: api
labels:
app: api
spec:
ports:
- port: 5000
selector:
app: api
tier: backend
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
labels:
app: api
spec:
replicas: 1
selector:
matchLabels:
app: api
tier: backend
strategy:
type: Recreate
template:
metadata:
labels:
app: api
tier: backend
spec:
containers:
- image: api:prod
name: api
env:
- name: POSTGRES_DB
value: api-db
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secrets
key: password
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-secrets
key: username
- name: DATABASE_URL
value: postgresql://$(POSTGRES_USER):$(POSTGRES_PASS)@api-db/$(POSTGRES_DB)
- name: APP_SETTINGS
value: src.config.ProductionConfig
- name: PORT
value: "5000"
ports:
- containerPort: 5000
name: api