This is a Kubernetes
deployment file that originally was using only MongoDB
database. I tried to add MySQL
to it as well like below:
apiVersion: apps/v1
kind: Deployment
metadata:
name: auth-depl
spec:
replicas: 1
selector:
matchLabels:
app: auth
template:
metadata:
labels:
app: auth
spec:
containers:
- name: auth
image: learner/auth
env:
- name: MONGO_URI
value: 'mongodb://auth-mongo-srv:27017/auth'
- name: JWT_KEY
valueFrom:
secretKeyRef:
name: jwt-secret
key: JWT_KEY
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secret
key: MYSQL_KEY
---
apiVersion: v1
kind: Service
metadata:
name: auth-srv
spec:
selector:
app: auth
ports:
- name: auth
protocol: TCP
port: 3000
targetPort: 3000
But I am not sure if I must also define another env
for MYSQL_URI
or not? Something like:
- name: MYSQL_URI
value: 'mysql://auth-mongo-srv:3306/auth'