java-tutorials/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/travel-agency-deployment.yaml

44 lines
959 B
YAML

kind: Service
apiVersion: v1
metadata:
name: travel-agency-service
spec:
selector:
app: travel-agency-service
ports:
- protocol: TCP
port: 8080
nodePort: 30081
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: travel-agency-service
spec:
selector:
matchLabels:
app: travel-agency-service
replicas: 2
template:
metadata:
labels:
app: travel-agency-service
spec:
containers:
- name: travel-agency-service
image: travel-agency-service:latest
imagePullPolicy: Never
ports:
- containerPort: 8080
env:
- name: MONGO_USERNAME
valueFrom:
secretKeyRef:
name: db-secret
key: username
- name: MONGO_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: password