-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathkubernetes.yaml
176 lines (162 loc) · 3.81 KB
/
kubernetes.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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Create a secret named 'regcred' for your Docker registry credentials.
#
# kubectl create secret docker-registry regcred \
# --docker-server=<Registry server> \
# --docker-username=<Username> \
# --docker-password=<Password>
#
# Create a secret named 'app-secrets' for secret keys and passwords, such as for root access to your MySQL database.
# Those will be passed to your app containers as environment variables.
#
# kubectl create secret generic app-secrets \
# --from-literal=APP_KEY='<256 bit key>' \
# --from-literal=DB_USERNAME='<MySQL username>' \
# --from-literal=DB_PASSWORD='<MySQL password>' \
# --from-literal=REDIS_PASSWORD='<Redis password>'
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
APP_NAME: "laravel-dock on Kubernetes"
APP_ENV: "production"
APP_DEBUG: "false"
APP_URL: "http://localhost"
TZ: "UTC"
LOG_CHANNEL: "stderr"
DB_HOST: "your-db-server.net"
DB_PORT: "3306"
DB_DATABASE: "laraveldock"
REDIS_HOST: "your-redis-server.net"
REDIS_PORT: "6379"
BROADCAST_DRIVER: "log"
CACHE_DRIVER: "redis"
QUEUE_CONNECTION: "redis"
SESSION_DRIVER: "redis"
---
apiVersion: v1
kind: Service
metadata:
name: web
spec:
ports:
- port: 80
targetPort: 80
selector:
app: web
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: app
image: ghcr.io/jarnovanleeuwen/laravel-dock:{{TAG}}
envFrom:
- configMapRef:
name: app-config
- secretRef:
name: app-secrets
env:
- name: CONTAINER_ROLE
value: "app"
ports:
- containerPort: 80
# Accept connections until the pod has been removed from the services on all nodes.
# See https://freecontent.manning.com/handling-client-requests-properly-with-kubernetes/
lifecycle:
preStop:
exec:
command: ["sleep", "5"]
# Start sending traffic only after the application is ready (Apache is running).
readinessProbe:
exec:
command:
- curl
- http://localhost
# initialDelaySeconds: 0
periodSeconds: 10 # default is 10
timeoutSeconds: 10 # default is 1
# successThreshold: 1
# failureThreshold: 3
resources:
requests:
cpu: 1000m
memory: 2048Mi
imagePullSecrets:
- name: regcred
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: scheduler
spec:
selector:
matchLabels:
app: scheduler
strategy:
type: Recreate
template:
metadata:
labels:
app: scheduler
spec:
containers:
- name: app
image: ghcr.io/jarnovanleeuwen/laravel-dock:{{TAG}}
envFrom:
- configMapRef:
name: app-config
- secretRef:
name: app-secrets
env:
- name: CONTAINER_ROLE
value: "scheduler"
resources:
requests:
cpu: 250m
memory: 1024Mi
imagePullSecrets:
- name: regcred
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: queue
spec:
selector:
matchLabels:
app: queue
strategy:
type: Recreate
template:
metadata:
labels:
app: queue
spec:
containers:
- name: app
image: ghcr.io/jarnovanleeuwen/laravel-dock:{{TAG}}
envFrom:
- configMapRef:
name: app-config
- secretRef:
name: app-secrets
env:
- name: CONTAINER_ROLE
value: "queue"
resources:
requests:
cpu: 250m
memory: 1024Mi
imagePullSecrets:
- name: regcred