Prepare for Kubernetes deployment

This commit is contained in:
2018-11-08 15:34:30 +01:00
parent 63c8098397
commit 4d1cb1353c
4 changed files with 106 additions and 2 deletions
+8 -2
View File
@@ -2,14 +2,20 @@ server {
listen 80; listen 80;
server_name localhost; server_name localhost;
access_log /log/access.log combined; access_log /dev/stdout combined;
error_log /log/error.log error; error_log /dev/stdout info;
location / { location / {
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html index.htm; index index.html index.htm;
} }
location /health {
add_header Content-Type text/plain;
access_log off;
return 200 'Ok';
}
error_page 500 502 503 504 /50x.html; error_page 500 502 503 504 /50x.html;
location = /50x.html { location = /50x.html {
root /usr/share/nginx/html; root /usr/share/nginx/html;
+65
View File
@@ -0,0 +1,65 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: lingonpaj-site
labels:
app: lingonpaj-site
annotations:
kubernetes.io/change-cause: "${TIMESTAMP} Deployed commit id: ${COMMIT}"
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
minReadySeconds: 30
selector:
matchLabels:
app: lingonpaj-site
template:
metadata:
labels:
app: lingonpaj-site
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- lingonpaj-site
topologyKey: kubernetes.io/hostname
containers:
- name: lingonpaj-site
readinessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 5
imagePullPolicy: Always
image: registry.gitlab.com/unboundsoftware/lingonpaj-site:${COMMIT}
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: lingonpaj-site
labels:
app: lingonpaj-site
spec:
type: NodePort
selector:
app: lingonpaj-site
ports:
- port: 80
targetPort: 80
+16
View File
@@ -0,0 +1,16 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: lingonpaj-site-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
ingress.kubernetes.io/enable-cors: "true"
spec:
rules:
- host: "local-lingonpaj.unbound.se"
http:
paths:
- path: /
backend:
serviceName: lingonpaj-site
servicePort: 80
+17
View File
@@ -0,0 +1,17 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: lingonpaj-site-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
ingress.kubernetes.io/enable-cors: "true"
ingress.kubernetes.io/force-ssl-redirect: "true"
spec:
rules:
- host: "lingonpaj.com"
http:
paths:
- path: /
backend:
serviceName: lingonpaj-site
servicePort: 80