Skip to content

Instantly share code, notes, and snippets.

@trkoch
Created April 10, 2020 19:59
Show Gist options
  • Save trkoch/25a7cf36cf798065fcf826e664fa6b68 to your computer and use it in GitHub Desktop.
Save trkoch/25a7cf36cf798065fcf826e664fa6b68 to your computer and use it in GitHub Desktop.
de.coronastatus.eu
apiVersion: apps/v1
kind: Deployment
metadata:
name: germany
spec:
selector:
matchLabels:
app: germany
replicas: 2
template:
metadata:
labels:
app: germany
spec:
containers:
- name: germany
image: bustbyte/coronastatus
ports:
- containerPort: 7272
env:
- name: COUNTRY_CODE
value: "de"
- name: DB_PATH
valueFrom:
# Each country has its own connection pool to its own database.
# kubectl create secret \
# generic [country-name] \
# --from-literal=postgres-pool-connection-string='[insert-connection-string]'
secretKeyRef:
name: germany
key: postgres-pool-connection-string
---
apiVersion: v1
kind: Service
metadata:
name: germany
spec:
ports:
- port: 80
targetPort: 7272
selector:
app: germany
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: germany
annotations:
kubernetes.io/ingress.class: "nginx"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
# We redirect to non-www if host is www.
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($host = 'www.de.coronastatus.eu') {
rewrite ^ https://de.coronastatus.eu$request_uri permanent;
}
spec:
rules:
- host: de.coronastatus.eu
http:
paths:
- backend:
serviceName: germany
servicePort: 80
- host: www.de.coronastatus.eu
http:
paths:
- backend:
serviceName: germany
servicePort: 80
tls:
- hosts:
- de.coronastatus.eu
- www.de.coronastatus.eu
secretName: no-coronastatus-cert-tls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment