zkt25/assignment2/deployment-api.yaml
2025-05-11 00:01:27 +02:00

42 lines
805 B
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: weather-api
namespace: webapp-ns
spec:
replicas: 1
selector:
matchLabels:
app: weather-api
template:
metadata:
labels:
app: weather-api
spec:
initContainers:
- name: wait-for-postgres
image: busybox
command: ['sh', '-c', 'until nslookup postgres; do echo waiting for db; sleep 2; done']
containers:
- name: weather-api
image: weather-api:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: weather-api-service
namespace: webapp-ns
spec:
selector:
app: weather-api
ports:
- protocol: TCP
port: 3000
targetPort: 3000
nodePort: 31000
type: NodePort