Skip to content

Instantly share code, notes, and snippets.

@javierguzman
Created August 1, 2022 18:15
Show Gist options
  • Save javierguzman/cb2a2734eae364f4f49c951975c99091 to your computer and use it in GitHub Desktop.
Save javierguzman/cb2a2734eae364f4f49c951975c99091 to your computer and use it in GitHub Desktop.
Strapi K8S configuration
apiVersion: apps/v1
kind: Deployment
metadata:
name: blog-backend-deployment-$VERSION
spec:
replicas: 1
selector:
matchLabels:
subsystem: blog-backend-$VERSION
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 50%
maxUnavailable: 50%
template:
metadata:
labels:
subsystem: blog-backend-$VERSION
spec:
initContainers:
- name: wait-for-database
image: busybox:1.32
command: ['sh', '-c', 'until nslookup blog-database-service-$VERSION; do echo waiting for blog database; sleep 2; done;']
containers:
- name: blog-backend-$VERSION
image: myStrapiDockerImage
ports:
- containerPort: 1337
livenessProbe:
httpGet:
path: /
port: 1337
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /
port: 1337
initialDelaySeconds: 30
periodSeconds: 10
imagePullSecrets:
- name: mysecretcredentials
apiVersion: v1
kind: Service
metadata:
name: blog-backend-service-$VERSION
spec:
type: ClusterIP
selector:
subsystem: blog-backend-$VERSION
ports:
- port: 5006
targetPort: 1337
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: blabbla
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: 'true'
cert-manager.io/cluster-issuer: 'my-cert-issuer'
cert-manager.io/issue-temporary-certificate: 'true'
acme.cert-manager.io/http01-edit-in-place: 'true'
nginx.ingress.kubernetes.io/proxy-body-size: '50m'
spec:
ingressClassName: nginx
tls:
- hosts:
- $BACKEND_BLOG_HOST
- $WWW_BACKEND_BLOG_HOST
secretName: my-certificate-secret
rules:
- host: $WWW_BACKEND_BLOG_HOST # www.backend.blog.mydomain.com
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: blog-backend-service-$VERSION
port:
number: 5006
- host: $BACKEND_BLOG_HOST # backend.blog.mydomain.com
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: blog-backend-service-$VERSION
port:
number: 5006
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment