summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-07-27 09:59:55 +0300
committerPaul Buetow <paul@buetow.org>2025-07-27 09:59:55 +0300
commite7eddc9a306e5d66451ef82efbeddc5196435703 (patch)
treea221d82e6b87f953d94c8d190e114e18b2acc775
parent4eb23e409a376320a4c00fbf128604cb5f148e09 (diff)
persistent volume example
-rw-r--r--f3s/example-apache-volume-claim/Makefile11
-rw-r--r--f3s/example-apache-volume-claim/apache-deployment.yaml29
-rw-r--r--f3s/example-apache-volume-claim/apache-ingress.yaml41
-rw-r--r--f3s/example-apache-volume-claim/apache-persistent-volume.yaml27
-rw-r--r--f3s/example-apache-volume-claim/apache-service.yaml17
5 files changed, 125 insertions, 0 deletions
diff --git a/f3s/example-apache-volume-claim/Makefile b/f3s/example-apache-volume-claim/Makefile
new file mode 100644
index 0000000..d0c3044
--- /dev/null
+++ b/f3s/example-apache-volume-claim/Makefile
@@ -0,0 +1,11 @@
+apply:
+ kubectl apply -f apache-persistent-volume.yaml
+ kubectl apply -f apache-service.yaml
+ kubectl apply -f apache-deployment.yaml
+ kubectl apply -f apache-ingress.yaml
+
+delete:
+ kubectl delete -f apache-ingress.yaml
+ kubectl delete -f apache-service.yaml
+ kubectl delete -f apache-deployment.yaml
+ kubectl delete -f apache-persistent-volume.yaml
diff --git a/f3s/example-apache-volume-claim/apache-deployment.yaml b/f3s/example-apache-volume-claim/apache-deployment.yaml
new file mode 100644
index 0000000..3f16827
--- /dev/null
+++ b/f3s/example-apache-volume-claim/apache-deployment.yaml
@@ -0,0 +1,29 @@
+# Apache HTTP Server Deployment
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: apache-deployment
+ namespace: test
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: apache
+ template:
+ metadata:
+ labels:
+ app: apache
+ spec:
+ containers:
+ - name: apache
+ image: httpd:latest
+ ports:
+ # Container port where Apache listens
+ - containerPort: 80
+ volumeMounts:
+ - name: apache-htdocs
+ mountPath: /usr/local/apache2/htdocs/
+ volumes:
+ - name: apache-htdocs
+ persistentVolumeClaim:
+ claimName: example-apache-pvc
diff --git a/f3s/example-apache-volume-claim/apache-ingress.yaml b/f3s/example-apache-volume-claim/apache-ingress.yaml
new file mode 100644
index 0000000..b26f95b
--- /dev/null
+++ b/f3s/example-apache-volume-claim/apache-ingress.yaml
@@ -0,0 +1,41 @@
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+ name: apache-ingress
+ namespace: test
+ namespace: test
+ annotations:
+ spec.ingressClassName: traefik
+ traefik.ingress.kubernetes.io/router.entrypoints: web
+spec:
+ rules:
+ - host: f3s.buetow.org
+ http:
+ paths:
+ - path: /
+ pathType: Prefix
+ backend:
+ service:
+ name: apache-service
+ port:
+ number: 80
+ - host: standby.f3s.buetow.org
+ http:
+ paths:
+ - path: /
+ pathType: Prefix
+ backend:
+ service:
+ name: apache-service
+ port:
+ number: 80
+ - host: www.f3s.buetow.org
+ http:
+ paths:
+ - path: /
+ pathType: Prefix
+ backend:
+ service:
+ name: apache-service
+ port:
+ number: 80
diff --git a/f3s/example-apache-volume-claim/apache-persistent-volume.yaml b/f3s/example-apache-volume-claim/apache-persistent-volume.yaml
new file mode 100644
index 0000000..7df28e6
--- /dev/null
+++ b/f3s/example-apache-volume-claim/apache-persistent-volume.yaml
@@ -0,0 +1,27 @@
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+ name: example-apache-pv
+spec:
+ capacity:
+ storage: 1Gi
+ volumeMode: Filesystem
+ accessModes:
+ - ReadWriteOnce
+ persistentVolumeReclaimPolicy: Retain
+ hostPath:
+ path: /data/nfs/k3svolumes/example-apache
+ type: Directory
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: example-apache-pvc
+ namespace: test
+spec:
+ storageClassName: ""
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: 1Gi
diff --git a/f3s/example-apache-volume-claim/apache-service.yaml b/f3s/example-apache-volume-claim/apache-service.yaml
new file mode 100644
index 0000000..1105e3a
--- /dev/null
+++ b/f3s/example-apache-volume-claim/apache-service.yaml
@@ -0,0 +1,17 @@
+apiVersion: v1
+kind: Service
+metadata:
+ labels:
+ app: apache
+ name: apache-service
+ namespace: test
+spec:
+ ports:
+ - name: web
+ port: 80
+ protocol: TCP
+ # Expose port 80 on the service
+ targetPort: 80
+ selector:
+ # Link this service to pods with the label app=apache
+ app: apache