From 32045ef0287c4ecf76900e4a19c5a6b4997ca11b Mon Sep 17 00:00:00 2001 From: gregory hendrickson Date: Thu, 26 Jan 2023 04:15:16 -0800 Subject: [PATCH] fixes --- .gitignore | 3 ++- README.md | 16 +++++----------- services/LoadBalancer-traefik.yaml | 15 +++++++++++++++ volumes/nginx-pv.yaml | 13 ------------- volumes/traefik-pv.yaml | 11 +++++++++++ volumes/{nginx-pvc.yaml => traefik-pvc.yaml} | 8 ++------ 6 files changed, 35 insertions(+), 31 deletions(-) create mode 100644 services/LoadBalancer-traefik.yaml delete mode 100644 volumes/nginx-pv.yaml create mode 100644 volumes/traefik-pv.yaml rename volumes/{nginx-pvc.yaml => traefik-pvc.yaml} (51%) diff --git a/.gitignore b/.gitignore index 225cb08..bc451a7 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ .DS_Store Thumbs.db -*-config-map.yaml \ No newline at end of file +*-config-map.yaml +*-secrets.yaml \ No newline at end of file diff --git a/README.md b/README.md index 3366efd..b80c429 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ Ghost Blog on Kubernetes + This repository contains the configuration files necessary to deploy a Ghost blog on Kubernetes using a MySQL backend and an nginx-proxy for routing traffic. Prerequisites -A running Kubernetes cluster -The kubectl command-line tool installed on your local machine -Deployment +- A running Kubernetes cluster +- The kubectl command-line tool installed on your local machine +Deployment kubectl apply -f namespace.yaml kubectl apply -f blog-config-map.yaml - kubectl apply -f deployments/ghost-blog-deployment.yaml kubectl apply -f deployments/mysql-deployment.yaml kubectl apply -f deployments/nginx-proxy-deployment.yaml @@ -16,7 +16,6 @@ kubectl apply -f services/ghost-blog-service.yaml kubectl apply -f services/ingress-service.yaml kubectl apply -f services/mysql-service.yaml kubectl apply -f services/nginx-proxy-service.yaml - kubectl apply -f volumes/nginx-pv.yaml kubectl apply -f volumes/nginx-pvc.yaml kubectl apply -f volumes/mysql-pv.yaml @@ -27,9 +26,4 @@ kubectl apply -f volumes/blog-pvc.yaml This will create the necessary resources in the cluster, including a deployment for the Ghost app, a service for connecting to the MySQL server, and an ingress service for routing traffic to the Ghost app via the nginx-proxy with https and http. Volumes -This configuration is using a Persistent Volume to store the Ghost blog data, this can be done by creating a persistent volume and persistent volume claim, and then referencing it in the ghost-blog-deployment.yaml file. - -ingress-service.yaml -In this example, $(VAR_HOST) and $(SECRET_NAME) are variables that are stored in a configMap and a Secret, respectively. These variables can be managed and updated separately from the YAML files, making it easier to update and maintain your configuration. - -To use variables in your YAML files, you'll first need to create a configMap and a Secret that contains the variables you need. You can do this using the kubectl \ No newline at end of file +This configuration is using a Persistent Volume to store the Ghost blog data, this can be done by creating a persistent volume and persistent diff --git a/services/LoadBalancer-traefik.yaml b/services/LoadBalancer-traefik.yaml new file mode 100644 index 0000000..f61689c --- /dev/null +++ b/services/LoadBalancer-traefik.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: traefik-loadbalancer +spec: + selector: + app: traefik + ports: + - name: http + port: 80 + targetPort: 80 + - name: https + port: 443 + targetPort: 443 + type: LoadBalancer diff --git a/volumes/nginx-pv.yaml b/volumes/nginx-pv.yaml deleted file mode 100644 index c8a0888..0000000 --- a/volumes/nginx-pv.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: PersistentVolume -metadata: - name: nginx-proxy-pv - namespace: blog -spec: - capacity: - storage: 2Gi - accessModes: - - ReadWriteOnce - hostPath: - path: "/mnt/data/nginx-proxy" - persistentVolumeReclaimPolicy: Retain \ No newline at end of file diff --git a/volumes/traefik-pv.yaml b/volumes/traefik-pv.yaml new file mode 100644 index 0000000..8f7c156 --- /dev/null +++ b/volumes/traefik-pv.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: traefik-pv +spec: + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data/traefik" diff --git a/volumes/nginx-pvc.yaml b/volumes/traefik-pvc.yaml similarity index 51% rename from volumes/nginx-pvc.yaml rename to volumes/traefik-pvc.yaml index 94a134a..03f0fc5 100644 --- a/volumes/nginx-pvc.yaml +++ b/volumes/traefik-pvc.yaml @@ -1,14 +1,10 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: nginx-proxy-pvc - namespace: blog + name: traefik-pvc spec: accessModes: - ReadWriteOnce resources: requests: - storage: 2Gi - selector: - matchLabels: - app: nginx-proxy + storage: 10Gi