added wordpress
This commit is contained in:
parent
9a354489ac
commit
bd9f4159c3
92
wordpress/deployment.yaml
Normal file
92
wordpress/deployment.yaml
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: wordpress-pvc
|
||||||
|
namespace: wordpress
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 5Gi
|
||||||
|
storageClassName: do-block-storage
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: wordpress
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: wordpress
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: wordpress
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: wordpress
|
||||||
|
image: wordpress:5.1.1
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
env:
|
||||||
|
- name: WORDPRESS_DB_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mariadb-secret
|
||||||
|
key: root-password
|
||||||
|
- name: WORDPRESS_DB_NAME
|
||||||
|
value: "wordpress"
|
||||||
|
- name: WORDPRESS_DB_HOST
|
||||||
|
value: "mariadb"
|
||||||
|
- name: WORDPRESS_DB_USER
|
||||||
|
value: "root"
|
||||||
|
- name: VIRTUAL_HOST
|
||||||
|
value: "anteriorbroadband.com,anteriorsolutions.com,demo.anteriorsolutions.com,testing.anteriorsolutions.com,www.anteriorbroadband.com,www.anteriorsolutions.com,www.demo.anteriorsolutions.com,www.testing.anteriorsolutions.com"
|
||||||
|
volumeMounts:
|
||||||
|
- name: wordpress-persistent-storage
|
||||||
|
mountPath: /var/www/html
|
||||||
|
- name: wp-tmp-storage
|
||||||
|
mountPath: /tmp
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: "1Gi"
|
||||||
|
cpu: "1000m"
|
||||||
|
requests:
|
||||||
|
memory: "300Mi"
|
||||||
|
cpu: "100m"
|
||||||
|
volumes:
|
||||||
|
- name: wordpress-persistent-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: wordpress-pvc
|
||||||
|
- name: wp-tmp-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: wp-tmp-csi-s3-pvc
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: wordpress
|
||||||
|
namespace: wordpress
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: wordpress
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 80
|
||||||
|
targetPort: 80
|
||||||
|
type: NodePort
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: wp-tmp-csi-s3-pvc
|
||||||
|
namespace: wordpress
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 5Gi
|
||||||
|
storageClassName: csi-s3
|
||||||
84
wordpress/mariadb/deployment.yaml
Normal file
84
wordpress/mariadb/deployment.yaml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: mariadb-pvc
|
||||||
|
namespace: wordpress
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 5Gi
|
||||||
|
storageClassName: do-block-storage
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: mariadb
|
||||||
|
namespace: wordpress
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: mariadb
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: mariadb
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: mariadb
|
||||||
|
image: mariadb:10.6
|
||||||
|
ports:
|
||||||
|
- containerPort: 3306
|
||||||
|
env:
|
||||||
|
- name: MARIADB_ROOT_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mariadb-secret
|
||||||
|
key: root-password
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: "1Gi"
|
||||||
|
cpu: "1000m"
|
||||||
|
requests:
|
||||||
|
memory: "200Mi"
|
||||||
|
cpu: "50m"
|
||||||
|
volumeMounts:
|
||||||
|
- name: mariadb-storage
|
||||||
|
mountPath: /var/lib/mysql
|
||||||
|
- name: mariadb-tmp-storage
|
||||||
|
mountPath: /tmp
|
||||||
|
volumes:
|
||||||
|
- name: mariadb-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: mariadb-pvc
|
||||||
|
- name: mariadb-tmp-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: wpdb-tmp-csi-s3-pvc
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: mariadb
|
||||||
|
namespace: wordpress
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 3306
|
||||||
|
targetPort: 3306
|
||||||
|
selector:
|
||||||
|
app: mariadb
|
||||||
|
clusterIP: None
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: wpdb-tmp-csi-s3-pvc
|
||||||
|
namespace: wordpress
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 5Gi
|
||||||
|
storageClassName: csi-s3
|
||||||
21
wordpress/mariadb/secret-setup.sh
Executable file
21
wordpress/mariadb/secret-setup.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Prompt user for MariaDB root password
|
||||||
|
read -sp "Enter MariaDB root password: " ROOT_PASSWORD
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Ensure the password is not empty
|
||||||
|
if [[ -z "$ROOT_PASSWORD" ]]; then
|
||||||
|
echo "Error: Password cannot be empty."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Define namespace
|
||||||
|
NAMESPACE="wordpress"
|
||||||
|
|
||||||
|
# Create the Kubernetes secret
|
||||||
|
kubectl create secret generic mariadb-secret \
|
||||||
|
--from-literal=root-password="$ROOT_PASSWORD" \
|
||||||
|
--namespace="$NAMESPACE"
|
||||||
|
|
||||||
|
echo "✅ MariaDB secret created successfully in namespace '$NAMESPACE'."
|
||||||
Loading…
x
Reference in New Issue
Block a user