kubernetes-yaml/learn/learn-kubernetes-master/kiamol/ch07/timecheck/timecheck-with-config.yaml

41 lines
1.1 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: timecheck
labels:
kiamol: ch07
spec:
selector:
matchLabels:
app: timecheck
template:
metadata:
labels:
app: timecheck
version: v2
spec:
initContainers:
- name: init-config
image: kiamol/ch03-sleep
command: ['sh', '-c', "cat /config-in/appsettings.json | jq --arg APP_ENV \"$APP_ENVIRONMENT\" '.Application.Environment=$APP_ENV' > /config-out/appsettings.json"]
env:
- name: APP_ENVIRONMENT
value: TEST
volumeMounts:
- name: config-map
mountPath: /config-in
- name: config-dir
mountPath: /config-out
containers:
- name: timecheck
image: kiamol/ch07-timecheck
volumeMounts:
- name: config-dir
mountPath: /config
readOnly: true
volumes:
- name: config-map
configMap:
name: timecheck-config
- name: config-dir
emptyDir: {}