codevalet/k8s/20-webapp.yaml

160 lines
3.9 KiB
YAML

---
apiVersion: "v1"
kind: "List"
items:
- apiVersion: v1
kind: Service
metadata:
name: 'webapp'
namespace: 'webapp'
spec:
ports:
- port: 80
targetPort: 9292
protocol: TCP
selector:
app: 'webapp'
- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: 'webapp'
namespace: 'webapp'
labels:
name: 'webapp'
spec:
replicas: 3
strategy:
type: RollingUpdate
selector:
template:
metadata:
labels:
app: 'webapp'
annotations:
spec:
containers:
- name: 'webapp'
image: 'codevalet/webapp:latest'
imagePullPolicy: Always
ports:
- containerPort: 9292
name: http
resources:
requests:
memory: 64M
limits:
memory: 256M
env:
- name: RACK_ENV
value: 'production'
- name: PRODUCTION
value: 'true'
- name: REDIRECT_URI
value: 'https://codevalet.io/github/authenticate'
- name: GITHUB_CLIENT_ID
value: '790a28783a813e2b2b3c'
- name: MEMCACHED_SERVER
value: 'memcached.webapp.svc.cluster.local'
- name: SESSION_SECRET
valueFrom:
secretKeyRef:
name: 'webapp'
key: 'sessionsecret'
- name: SENTRY_DSN
valueFrom:
secretKeyRef:
name: 'webapp'
key: 'sentry'
- name: GITHUB_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: 'oauth'
key: 'secret'
livenessProbe:
httpGet:
path: /
port: 9292
initialDelaySeconds: 60
timeoutSeconds: 10
- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: 'memcached'
namespace: 'webapp'
labels:
name: 'memcached'
spec:
replicas: 3
strategy:
type: RollingUpdate
selector:
template:
metadata:
labels:
app: 'memcached'
spec:
containers:
- name: 'cache'
image: 'memcached:alpine'
imagePullPolicy: Always
ports:
- containerPort: 11211
name: 'memcached'
resources:
requests:
memory: 64M
limits:
memory: 256M
livenessProbe:
tcpSocket:
port: 'memcached'
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
tcpSocket:
port: 'memcached'
initialDelaySeconds: 5
timeoutSeconds: 1
- apiVersion: v1
kind: Service
metadata:
name: 'memcached'
namespace: 'webapp'
spec:
clusterIP: None
ports:
- port: 11211
targetPort: 'memcached'
protocol: TCP
selector:
app: 'memcached'
- apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: 'http-ingress'
namespace: 'webapp'
annotations:
kubernetes.io/tls-acme: "true"
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/affinity: 'cookie'
spec:
tls:
- hosts:
- codevalet.io
secretName: ingress-tls
rules:
- host: codevalet.io
http:
paths:
- path: /
backend:
serviceName: webapp
servicePort: 80
# vim: ft=yaml