summaryrefslogtreecommitdiff
path: root/f3s/apache
diff options
context:
space:
mode:
Diffstat (limited to 'f3s/apache')
-rw-r--r--f3s/apache/Justfile38
-rw-r--r--f3s/apache/helm-chart/Chart.yaml5
-rw-r--r--f3s/apache/helm-chart/README.md11
-rw-r--r--f3s/apache/helm-chart/templates/apache-deployment.yaml41
-rw-r--r--f3s/apache/helm-chart/templates/apache-ingress.yaml41
-rw-r--r--f3s/apache/helm-chart/templates/apache-persistent-volume.yaml28
-rw-r--r--f3s/apache/helm-chart/templates/apache-service.yaml17
7 files changed, 181 insertions, 0 deletions
diff --git a/f3s/apache/Justfile b/f3s/apache/Justfile
new file mode 100644
index 0000000..1a825b7
--- /dev/null
+++ b/f3s/apache/Justfile
@@ -0,0 +1,38 @@
+NAMESPACE := "test"
+APP_NAME := "apache"
+
+status:
+ @echo "=== Pods ==="
+ @kubectl get pods -n {{NAMESPACE}} -l app=apache
+ @echo ""
+ @echo "=== Service ==="
+ @kubectl get svc -n {{NAMESPACE}} apache-service
+ @echo ""
+ @echo "=== Ingress ==="
+ @kubectl get ingress -n {{NAMESPACE}} apache-ingress
+ @echo ""
+ @echo "=== PVC ==="
+ @kubectl get pvc -n {{NAMESPACE}} apache-pvc
+ @echo ""
+ @echo "=== ArgoCD Status ==="
+ @kubectl get application {{APP_NAME}} -n cicd -o jsonpath='Sync: {.status.sync.status}, Health: {.status.health.status}' 2>/dev/null && echo ""
+
+logs lines="100":
+ kubectl logs -n {{NAMESPACE}} -l app=apache --tail={{lines}} -f
+
+port-forward port="8080":
+ @echo "Forwarding apache to localhost:{{port}}"
+ kubectl port-forward -n {{NAMESPACE}} svc/apache-service {{port}}:80
+
+sync:
+ @echo "Triggering ArgoCD sync..."
+ @kubectl annotate application {{APP_NAME}} -n cicd argocd.argoproj.io/refresh=normal --overwrite
+ @sleep 2
+ @kubectl get application {{APP_NAME}} -n cicd -o jsonpath='Sync: {.status.sync.status}, Health: {.status.health.status}' && echo ""
+
+argocd-status:
+ argocd app get {{APP_NAME}} --core
+
+restart:
+ @echo "Restarting apache..."
+ kubectl rollout restart -n {{NAMESPACE}} deployment/apache-deployment
diff --git a/f3s/apache/helm-chart/Chart.yaml b/f3s/apache/helm-chart/Chart.yaml
new file mode 100644
index 0000000..78d5397
--- /dev/null
+++ b/f3s/apache/helm-chart/Chart.yaml
@@ -0,0 +1,5 @@
+apiVersion: v2
+name: apache-volume-claim
+description: A Helm chart for deploying Apache with a persistent volume claim.
+version: 0.1.0
+appVersion: "1.0"
diff --git a/f3s/apache/helm-chart/README.md b/f3s/apache/helm-chart/README.md
new file mode 100644
index 0000000..2ea4096
--- /dev/null
+++ b/f3s/apache/helm-chart/README.md
@@ -0,0 +1,11 @@
+# Apache Helm Chart with Persistent Volume
+
+This chart deploys a simple Apache web server with a persistent volume claim.
+
+## Installing the Chart
+
+To install the chart with the release name `my-release`, run the following command:
+
+```bash
+helm install apache . --namespace test --create-namespace
+``` \ No newline at end of file
diff --git a/f3s/apache/helm-chart/templates/apache-deployment.yaml b/f3s/apache/helm-chart/templates/apache-deployment.yaml
new file mode 100644
index 0000000..aa9e65a
--- /dev/null
+++ b/f3s/apache/helm-chart/templates/apache-deployment.yaml
@@ -0,0 +1,41 @@
+# Apache HTTP Server Deployment
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: apache-deployment
+ namespace: test
+spec:
+ replicas: 2
+ selector:
+ matchLabels:
+ app: apache
+ template:
+ metadata:
+ labels:
+ app: apache
+ spec:
+ containers:
+ - name: apache
+ image: httpd:latest
+ ports:
+ # Container port where Apache listens
+ - containerPort: 80
+ readinessProbe:
+ httpGet:
+ path: /
+ port: 80
+ initialDelaySeconds: 5
+ periodSeconds: 10
+ livenessProbe:
+ httpGet:
+ path: /
+ port: 80
+ initialDelaySeconds: 15
+ periodSeconds: 10
+ volumeMounts:
+ - name: apache-htdocs
+ mountPath: /usr/local/apache2/htdocs/
+ volumes:
+ - name: apache-htdocs
+ persistentVolumeClaim:
+ claimName: apache-pvc
diff --git a/f3s/apache/helm-chart/templates/apache-ingress.yaml b/f3s/apache/helm-chart/templates/apache-ingress.yaml
new file mode 100644
index 0000000..b26f95b
--- /dev/null
+++ b/f3s/apache/helm-chart/templates/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/apache/helm-chart/templates/apache-persistent-volume.yaml b/f3s/apache/helm-chart/templates/apache-persistent-volume.yaml
new file mode 100644
index 0000000..b04c06f
--- /dev/null
+++ b/f3s/apache/helm-chart/templates/apache-persistent-volume.yaml
@@ -0,0 +1,28 @@
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+ name: apache-pv
+spec:
+ capacity:
+ storage: 1Gi
+ volumeMode: Filesystem
+ accessModes:
+ - ReadWriteMany
+ persistentVolumeReclaimPolicy: Retain
+ hostPath:
+ path: /data/nfs/k3svolumes/apache
+ type: Directory
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: apache-pvc
+ namespace: test
+spec:
+ storageClassName: ""
+ volumeName: apache-pv
+ accessModes:
+ - ReadWriteMany
+ resources:
+ requests:
+ storage: 1Gi
diff --git a/f3s/apache/helm-chart/templates/apache-service.yaml b/f3s/apache/helm-chart/templates/apache-service.yaml
new file mode 100644
index 0000000..1105e3a
--- /dev/null
+++ b/f3s/apache/helm-chart/templates/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