-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.yaml
53 lines (52 loc) · 1.33 KB
/
deploy.yaml
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
apiVersion: apps/v1
kind: Deployment
metadata:
name: example-deployment
spec:
replicas: 1
selector:
matchLabels:
app: example
template:
metadata:
labels:
app: example
spec:
initContainers:
- name: init-nginx-config
image: alpine:latest
command: ['/bin/sh', '-c', 'apk add --no-cache openssl && echo "${USERNAME}:$(openssl passwd -apr1 ${PASSWORD})" > /etc/nginx/.htpasswd']
env:
- name: USERNAME
valueFrom:
secretKeyRef:
name: example-secret
key: username
- name: PASSWORD
valueFrom:
secretKeyRef:
name: example-secret
key: <secret-key>
volumeMounts:
- name: config-volume
mountPath: /etc/nginx/
containers:
- name: example-container
image: nginx:latest
ports:
- containerPort: 80
volumeMounts:
- name: config-volume
mountPath: /etc/nginx/
- name: nginx-config-volume
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
volumes:
- name: config-volume
emptyDir: {}
- name: <nginx-config-volume-name>
configMap:
name: nginx-config
items:
- key: nginx.conf
path: nginx.conf