forked from k8spatterns/examples
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathweb-app.yml
59 lines (59 loc) · 1.35 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
# Example for a HTTP server with a git pulling sidecar
---
apiVersion: v1
kind: List
items:
- 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: git
# Sidecar poll every 10 minutes a given repository with git
- name: poll
image: axeclbr/git
volumeMounts:
- mountPath: /var/lib/data
name: git
env:
- name: GIT_REPO
value: https://github.com/mdn/beginner-html-site-scripted
command:
- "sh"
- "-c"
- "git clone $(GIT_REPO) . && watch -n 60 git pull"
workingDir: /var/lib/data
volumes:
# The shared directory for holding the files
- emptyDir: {}
name: git
# 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