kubernetes-yaml/learn/learn-kubernetes-master/kiamol/ch15/todo-list/web.yaml

82 lines
1.4 KiB
YAML

apiVersion: v1
kind: Service
metadata:
name: todo-web
labels:
kiamol: ch15
spec:
ports:
- port: 80
targetPort: 80
selector:
app: todo-web
---
apiVersion: v1
kind: ConfigMap
metadata:
name: todo-web-config
labels:
kiamol: ch15
data:
config.json: |-
{
"ConfigController": {
"Enabled" : true
},
"Database" : {
"Provider" : "Postgres"
},
"Metrics" : {
"Enabled" : true
}
}
---
apiVersion: v1
kind: Secret
metadata:
name: todo-web-secret
labels:
kiamol: ch15
type: Opaque
stringData:
secrets.json: |-
{
"ConnectionStrings": {
"ToDoDb": "Server=todo-db;Database=todo;User Id=postgres;Password=kiamol-2*2*;"
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: todo-web
labels:
kiamol: ch15
spec:
selector:
matchLabels:
app: todo-web
template:
metadata:
labels:
app: todo-web
spec:
containers:
- name: web
image: kiamol/ch04-todo-list
volumeMounts:
- name: config
mountPath: "/app/config"
readOnly: true
- name: secret
mountPath: "/app/secrets"
readOnly: true
volumes:
- name: config
configMap:
name: todo-web-config
- name: secret
secret:
secretName: todo-web-secret
defaultMode: 0400