Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added kubernetes/.mysql.yaml.swo
Binary file not shown.
Binary file added kubernetes/.mysql.yaml.swp
Binary file not shown.
Binary file added kubernetes/.wordpress.yaml.swk
Binary file not shown.
Binary file added kubernetes/.wordpress.yaml.swl
Binary file not shown.
Binary file added kubernetes/.wordpress.yaml.swm
Binary file not shown.
Binary file added kubernetes/.wordpress.yaml.swn
Binary file not shown.
Binary file added kubernetes/.wordpress.yaml.swo
Binary file not shown.
Binary file added kubernetes/.wordpress.yaml.swp
Binary file not shown.
22 changes: 22 additions & 0 deletions kubernetes/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: wordpress-ingress
namespace: company-blog
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
spec:
rules:
- host: wordpress.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: wordpress
port:
number: 80

68 changes: 60 additions & 8 deletions kubernetes/mysql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ spec:
selector:
app: wp-blog
tier: mysql
clusterIP: None
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -39,18 +38,18 @@ spec:
storage: 20Gi
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet # Changed Deployment to StatefulSet
metadata:
name: wordpress-mysql
labels:
app: wp-blog
spec:
serviceName: "wordpress-mysql" # Added serviceName for stable network identity
replicas: 1 # Set the number of replicas to 1 for a single-node MySQL
selector:
matchLabels:
app: wp-blog
tier: mysql
strategy:
type: Recreate
template:
metadata:
labels:
Expand Down Expand Up @@ -84,7 +83,60 @@ spec:
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
---
apiVersion: v1
kind: Service
metadata:
name: wordpress
namespace: company-blog
labels:
app: wp-blog
spec:
ports:
- port: 80
selector:
app: wp-blog
tier: frontend
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: wordpress
labels:
app: wp-blog
spec:
replicas: 1
selector:
matchLabels:
app: wp-blog
tier: frontend
template:
metadata:
labels:
app: wp-blog
tier: frontend
spec:
containers:
- image: wordpress:latest
name: wordpress
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 30
periodSeconds: 5
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 300
periodSeconds: 10
env:
- name: WORDPRESS_DB_HOST
value: "wordpress-mysql"
- name: WORDPRESS_DB_PASSWORD
valueFrom:
secretKeyRef:
name: wp-blog-db-pass
key: password

57 changes: 56 additions & 1 deletion kubernetes/wordpress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ metadata:
spec:
ports:
- port: 80
targetPort: 80
nodePort: 31088 #added a node port
selector:
app: wp-blog
tier: frontend
type: LoadBalancer
type: NodePort
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -26,6 +28,59 @@ spec:
resources:
requests:
storage: 20Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: wordpress
labels:
app: wp-blog
spec:
replicas: 1 # Set the desired number of replicas
selector:
matchLabels:
app: wp-blog
tier: frontend
template:
metadata:
labels:
app: wp-blog
tier: frontend
spec:
containers:
- image: wordpress:latest
name: wordpress
ports:
- containerPort: 80
volumeMounts:
- name: wp-persistent-storage
mountPath: /var/www/html # Mount the volume to the WordPress directory
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 30
periodSeconds: 5
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 300
periodSeconds: 10
env:
- name: WORDPRESS_DB_HOST
value: "wordpress-mysql"
- name: WORDPRESS_DB_PASSWORD
valueFrom:
secretKeyRef:
name: wp-blog-db-pass
key: password
volumes:
- name: wp-persistent-storage
persistentVolumeClaim:
claimName: wp-pv-claim


---
# TODO: complete the wordpress deployment
#apiVersion: apps/v1
Expand Down