Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
---
apiVersion: v1
kind: Namespace
metadata:
name: wordpress
---
apiVersion: v1
kind: Secret
metadata:
name: wpmulti-externaldb
labels:
app: wpmulti-externaldb
namespace: wordpress
type: Opaque
data:
# "password123"
db-password: "cGFzc3dvcmQxMjM="
---
apiVersion: v1
kind: Service
metadata:
name: wpmulti-wordpress
labels:
app: "wpmulti-wordpress"
namespace: wordpress
spec:
selector:
app: "wpmulti-wordpress"
ports:
- name: http
port: 8080
targetPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: memcached
namespace: wordpress
labels:
app: memcached
spec:
ports:
- port: 11211
targetPort: memcached
protocol: TCP
name: memcached
selector:
app: memcached
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: memcached
namespace: wordpress
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: memcached
template:
metadata:
labels:
app: memcached
spec:
containers:
- name: memcached
image: memcached:1.5
imagePullPolicy: Always
resources:
requests:
memory: 128Mi
ports:
- name: memcached
containerPort: 11211
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: wpmulti-wordpress
labels:
app: "wpmulti-wordpress"
namespace: wordpress
spec:
selector:
matchLabels:
app: "wpmulti-wordpress"
strategy:
type: Recreate
replicas: 1
template:
metadata:
labels:
app: "wpmulti-wordpress"
spec:
containers:
- name: wordpress
image: your/custom/docker-image:latest
imagePullPolicy: "IfNotPresent"
env:
- name: DB_HOST
value: "<sql-server>:3306"
- name: DB_NAME
value: "wordpress"
- name: DB_USER
value: "wordpress"
- name: WP_HOME
value: "https://example.com"
- name: WP_SITEURL
value: "https://example.com/wp"
- name: MEMCACHED_HOST
value: memcached.wordpress:11211
- name: WP_ENV
value: "development"
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: wpmulti-externaldb
key: db-password
ports:
- name: http
containerPort: 8080
livenessProbe:
httpGet:
path: /wp/wp-login.php
port: 8080
failureThreshold: 6
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /wp/wp-login.php
port: 8080
failureThreshold: 6
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
resources:
requests:
cpu: 300m
memory: 512Mi
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: wpmulti-wordpress
namespace: wordpress
labels:
app: "wpmulti-wordpress"
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
kubernetes.io/tls-acme: "true"
spec:
rules:
- host: example.com
http:
paths:
- path: /
backend:
serviceName: "wpmulti-wordpress"
servicePort: 8080
tls:
- hosts:
- 'example.com'
secretName: wpmulti-cert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.