-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeployment.yaml
More file actions
87 lines (85 loc) · 2.03 KB
/
deployment.yaml
File metadata and controls
87 lines (85 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Config render example
#
# This example shows a deployment that renders a config template
# using environment variables before starting the main container.
#
# Usage:
# kubectl apply -f examples/config-render/
apiVersion: v1
kind: ConfigMap
metadata:
name: app-template
data:
app.conf.tmpl: |
server {
listen {{ .PORT | default "8080" }};
database_host {{ .DB_HOST }};
database_port {{ .DB_PORT }};
log_level {{ .LOG_LEVEL | default "info" }};
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: app-with-config
labels:
app: app-with-config
spec:
replicas: 1
selector:
matchLabels:
app: app-with-config
template:
metadata:
labels:
app: app-with-config
spec:
initContainers:
- name: render-config
image: ghcr.io/kitstream/initium:latest
args:
- render
- --template
- /templates/app.conf.tmpl
- --output
- config/app.conf
- --workdir
- /work
env:
- name: DB_HOST
value: postgres
- name: DB_PORT
value: "5432"
- name: PORT
value: "9090"
- name: LOG_LEVEL
value: debug
securityContext:
runAsNonRoot: true
runAsUser: 65534
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
volumeMounts:
- name: workdir
mountPath: /work
- name: templates
mountPath: /templates
readOnly: true
containers:
- name: app
image: myapp:latest
ports:
- containerPort: 9090
volumeMounts:
- name: workdir
mountPath: /work
readOnly: true
volumes:
- name: workdir
emptyDir: {}
- name: templates
configMap:
name: app-template