ungleich-k8s/apps/nginx-certbot/base/deployment.yaml

120 lines
2.4 KiB
YAML
Raw Normal View History

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: tls1-letsencrypt-certs
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 50Mi
storageClassName: rook-cephfs
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: tls1-webroot
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Mi
storageClassName: rook-cephfs
---
2021-06-18 18:39:35 +00:00
apiVersion: apps/v1
kind: Deployment
metadata:
name: tls1-https
spec:
selector:
matchLabels:
app: tls1-nginx
ssl: yes
replicas: 1
template:
metadata:
labels:
app: tls1-nginx
ssl: yes
spec:
containers:
2021-06-18 19:08:53 +00:00
- name: nginx-443
2021-06-18 21:42:15 +00:00
image: nginx:1.21.0-alpine
2021-06-18 19:08:53 +00:00
ports:
2021-06-18 21:42:15 +00:00
- containerPort: 80
2021-06-18 19:08:53 +00:00
- containerPort: 443
volumeMounts:
- name: nginx-config-443
mountPath: "/etc/nginx/conf.d/"
- name: etcletsencrypt
mountPath: "/etc/letsencrypt"
- name: webroot
mountPath: "/usr/share/nginx/html"
2021-06-18 18:39:35 +00:00
volumes:
2021-06-18 19:08:53 +00:00
- name: nginx-config-443
2021-06-18 18:39:35 +00:00
configMap:
2021-06-18 19:08:53 +00:00
name: nginx-443-config
- name: etcletsencrypt
persistentVolumeClaim:
claimName: tls1-letsencrypt-certs
- name: webroot
persistentVolumeClaim:
claimName: tls1-webroot
2021-06-18 18:39:35 +00:00
---
apiVersion: v1
kind: Service
metadata:
2021-06-18 19:08:53 +00:00
name: tls1
2021-06-18 18:39:35 +00:00
labels:
2021-06-18 19:08:53 +00:00
app: tls1
2021-06-18 18:39:35 +00:00
spec:
type: ClusterIP
ports:
2021-06-18 19:08:53 +00:00
- port: 80
name: http
2021-06-18 19:08:53 +00:00
- port: 443
name: https
2021-06-18 18:39:35 +00:00
selector:
2021-06-18 19:08:53 +00:00
app: tls1-nginx
---
apiVersion: batch/v1
kind: Job
metadata:
name: tls1-getcert
spec:
template:
2021-06-18 21:42:15 +00:00
metadata:
labels:
app: tls1-nginx
spec:
restartPolicy: Never
containers:
- name: certbot
image: ungleich/ungleich-certbot
2021-06-18 21:42:15 +00:00
ports:
- containerPort: 80
command:
- certbot
- certonly
- --agree-tos
- --cert-name
- 'tls1.default.svc.c2.k8s.ooo'
- --email
- sre@ungleich.ch
- --expand
- --non-interactive
- --domain
- 'tls1.default.svc.c2.k8s.ooo'
2021-06-18 21:42:15 +00:00
- --standalone
volumeMounts:
- name: etcletsencrypt
mountPath: "/etc/letsencrypt"
volumes:
- name: etcletsencrypt
persistentVolumeClaim:
claimName: tls1-letsencrypt-certs
backoffLimit: 3