From 4849dd092768adc37f5cfd482f4f0b62d372c679 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 7 Aug 2025 09:27:36 +0300 Subject: migrate to be a helm chart --- f3s/example-apache-volume-claim/Makefile | 10 ++---- .../apache-deployment.yaml | 41 ---------------------- .../apache-ingress.yaml | 41 ---------------------- .../apache-persistent-volume.yaml | 27 -------------- .../apache-service.yaml | 17 --------- .../helm-chart/Chart.yaml | 5 +++ .../helm-chart/README.md | 11 ++++++ .../helm-chart/templates/apache-deployment.yaml | 41 ++++++++++++++++++++++ .../helm-chart/templates/apache-ingress.yaml | 41 ++++++++++++++++++++++ .../templates/apache-persistent-volume.yaml | 27 ++++++++++++++ .../helm-chart/templates/apache-service.yaml | 17 +++++++++ 11 files changed, 144 insertions(+), 134 deletions(-) delete mode 100644 f3s/example-apache-volume-claim/apache-deployment.yaml delete mode 100644 f3s/example-apache-volume-claim/apache-ingress.yaml delete mode 100644 f3s/example-apache-volume-claim/apache-persistent-volume.yaml delete mode 100644 f3s/example-apache-volume-claim/apache-service.yaml create mode 100644 f3s/example-apache-volume-claim/helm-chart/Chart.yaml create mode 100644 f3s/example-apache-volume-claim/helm-chart/README.md create mode 100644 f3s/example-apache-volume-claim/helm-chart/templates/apache-deployment.yaml create mode 100644 f3s/example-apache-volume-claim/helm-chart/templates/apache-ingress.yaml create mode 100644 f3s/example-apache-volume-claim/helm-chart/templates/apache-persistent-volume.yaml create mode 100644 f3s/example-apache-volume-claim/helm-chart/templates/apache-service.yaml diff --git a/f3s/example-apache-volume-claim/Makefile b/f3s/example-apache-volume-claim/Makefile index d0c3044..19f4714 100644 --- a/f3s/example-apache-volume-claim/Makefile +++ b/f3s/example-apache-volume-claim/Makefile @@ -1,11 +1,5 @@ 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 + helm install example-apache-volume-claim ./helm-chart 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 + helm uninstall example-apache-volume-claim \ No newline at end of file diff --git a/f3s/example-apache-volume-claim/apache-deployment.yaml b/f3s/example-apache-volume-claim/apache-deployment.yaml deleted file mode 100644 index 78706a3..0000000 --- a/f3s/example-apache-volume-claim/apache-deployment.yaml +++ /dev/null @@ -1,41 +0,0 @@ -# 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: example-apache-pvc diff --git a/f3s/example-apache-volume-claim/apache-ingress.yaml b/f3s/example-apache-volume-claim/apache-ingress.yaml deleted file mode 100644 index b26f95b..0000000 --- a/f3s/example-apache-volume-claim/apache-ingress.yaml +++ /dev/null @@ -1,41 +0,0 @@ -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 deleted file mode 100644 index 7df28e6..0000000 --- a/f3s/example-apache-volume-claim/apache-persistent-volume.yaml +++ /dev/null @@ -1,27 +0,0 @@ -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 deleted file mode 100644 index 1105e3a..0000000 --- a/f3s/example-apache-volume-claim/apache-service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -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 diff --git a/f3s/example-apache-volume-claim/helm-chart/Chart.yaml b/f3s/example-apache-volume-claim/helm-chart/Chart.yaml new file mode 100644 index 0000000..78d5397 --- /dev/null +++ b/f3s/example-apache-volume-claim/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/example-apache-volume-claim/helm-chart/README.md b/f3s/example-apache-volume-claim/helm-chart/README.md new file mode 100644 index 0000000..c5740f1 --- /dev/null +++ b/f3s/example-apache-volume-claim/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 example-apache-volume-claim . +``` diff --git a/f3s/example-apache-volume-claim/helm-chart/templates/apache-deployment.yaml b/f3s/example-apache-volume-claim/helm-chart/templates/apache-deployment.yaml new file mode 100644 index 0000000..78706a3 --- /dev/null +++ b/f3s/example-apache-volume-claim/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: example-apache-pvc diff --git a/f3s/example-apache-volume-claim/helm-chart/templates/apache-ingress.yaml b/f3s/example-apache-volume-claim/helm-chart/templates/apache-ingress.yaml new file mode 100644 index 0000000..b26f95b --- /dev/null +++ b/f3s/example-apache-volume-claim/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/example-apache-volume-claim/helm-chart/templates/apache-persistent-volume.yaml b/f3s/example-apache-volume-claim/helm-chart/templates/apache-persistent-volume.yaml new file mode 100644 index 0000000..7df28e6 --- /dev/null +++ b/f3s/example-apache-volume-claim/helm-chart/templates/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/helm-chart/templates/apache-service.yaml b/f3s/example-apache-volume-claim/helm-chart/templates/apache-service.yaml new file mode 100644 index 0000000..1105e3a --- /dev/null +++ b/f3s/example-apache-volume-claim/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 -- cgit v1.2.3