[nginx/app/tls] ++update

This commit is contained in:
Nico Schottelius 2021-06-18 21:08:53 +02:00
parent 0a565c9e99
commit cda1990935
6 changed files with 66 additions and 22 deletions

View File

@ -0,0 +1,5 @@
## nginx service for getting letsencrypt certificates
### Architecture
* nginx/port 80 serves only the root for letsencrypt

View File

@ -1,40 +1,50 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: etherpadlite name: tls1
spec: spec:
selector: selector:
matchLabels: matchLabels:
app: etherpadsooooolite app: tls1
replicas: 1 replicas: 1
template: template:
metadata: metadata:
labels: labels:
app: etherpadsooooolite app: tls1
spec: spec:
containers: containers:
- name: etherpad - name: nginx-80
image: etherpad/etherpad:1.8.13 image: nginx:1.20.0-alpine
ports: ports:
- containerPort: 9001 - containerPort: 80
volumeMounts: volumeMounts:
- name: etherpadconfig - name: nginx-config-80
mountPath: "/opt/etherpad-lite/settings.json" mountPath: "/etc/nginx/conf.d/"
subPath: settings.json - name: nginx-443
image: nginx:1.20.0-alpine
ports:
- containerPort: 443
volumeMounts:
- name: nginx-config-443
mountPath: "/etc/nginx/conf.d/"
volumes: volumes:
- name: etherpadconfig - name: nginx-config-80
configMap: configMap:
name: etherpadliteconfig name: nginx-80-config
- name: nginx-config-443
configMap:
name: nginx-443-config
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: etherpad name: tls1
labels: labels:
app: etherpadsooooolite app: tls1
spec: spec:
type: ClusterIP type: ClusterIP
ports: ports:
- port: 9001 - port: 80
- port: 443
selector: selector:
app: etherpadsooooolite app: tls1-nginx

View File

@ -1,10 +1,9 @@
configMapGenerator: configMapGenerator:
- name: - name: nginx-80-config
files: files:
- settings.json=settings.json - default.conf=nginx-80
- name: nginx-443-config
commonLabels: files:
app: etherpadlite - default.conf=nginx-443
customer: xyz
resources: resources:
- deployment.yaml - deployment.yaml

View File

@ -0,0 +1,15 @@
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name tls1.svc.c2.k8s.ooo;
ssl_certificate /etc/letsencrypt/live/tls1.svc.c2.k8s.ooo/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/tls1.svc.c2.k8s.ooo/privkey.pem;
client_max_body_size 256m;
root /usr/share/nginx/html;
autoindex on;
}

View File

@ -0,0 +1,16 @@
server {
listen *:80;
listen [::]:80;
server_name _;
# Forward for certbot
location /.well-known/acme-challenge/ {
root /usr/share/nginx/html;
}
# Everything else -> ssl
location / {
return 301 https://$host$request_uri;
}
}

View File

@ -1 +0,0 @@
kubectl apply -f https://k8s.io/examples/application/deployment.yaml