-
Notifications
You must be signed in to change notification settings - Fork 270
/
web-app.yml
62 lines (60 loc) · 1.27 KB
/
web-app.yml
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
# Example for a HTTP server with a git pulling sidecar
apiVersion: v1
kind: Pod
metadata:
name: web-app
labels:
project: k8spatterns
pattern: Sidecar
spec:
containers:
# Main container is a stock httpd serving from /var/www/html
- name: app
image: centos/httpd
ports:
- containerPort: 80
volumeMounts:
- mountPath: /var/www/html
name: source
# Sidecar poll every minute a given repository with git
- name: poll
image: bitnami/git
env:
- name: SOURCE_REPO
value: https://github.com/mdn/beginner-html-site-scripted
command: [ "sh", "-c" ]
args:
- |
git clone $(SOURCE_REPO) .
while true; do
sleep 60
git pull
done
workingDir: /var/lib/data
volumeMounts:
- mountPath: /var/lib/data
name: source
volumes:
# The shared directory for holding the files
- emptyDir: {}
name: source
---
# A service which opens a NodePort is added for your convenience
# but is not necessarily required for this example:
apiVersion: v1
kind: Service
metadata:
labels:
project: k8spatterns
pattern: Sidecar
name: web-app
spec:
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 80
selector:
pattern: Sidecar
# Just for demo
type: NodePort