-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d1c2339
Showing
14 changed files
with
394 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Blog de Ghost en Kubernetes | ||
|
||
Este repositorio contiene manifiestos de Kubernetes para implementar un blog de Ghost junto con una base de datos MySQL. La configuración está organizada utilizando Kustomize para una mejor gestión y personalización. | ||
|
||
## Contenido | ||
|
||
- **base/namespace.yaml**: Define el espacio de nombres de Kubernetes para la implementación de Ghost. | ||
- **base/secrets.yaml**: Contiene secretos genéricos utilizados tanto por Ghost como por MySQL. | ||
- **app/ghost/deployment.yaml**: Describe la implementación de la aplicación Ghost. | ||
- **app/ghost/configmap.yaml**: ConfigMap para la configuración de la aplicación Ghost. | ||
- **app/ghost/secrets.yaml**: Secretos específicos de la aplicación Ghost. | ||
- **app/ghost/service.yaml**: Configuración del servicio para la aplicación Ghost. | ||
- **app/ghost/pvc.yaml**: Reclamación de volumen persistente para el almacenamiento de Ghost. | ||
- **app/ghost/ingress.yaml**: Configuración de Ingress para acceder al blog de Ghost. | ||
- **app/mysql/deployment.yaml**: Describe la implementación de la base de datos MySQL. | ||
- **app/mysql/service.yaml**: Configuración del servicio para la base de datos MySQL. | ||
- **app/mysql/pvc.yaml**: Reclamación de volumen persistente para el almacenamiento de MySQL. | ||
|
||
## Configuración de la Implementación de Ghost | ||
|
||
### Implementación | ||
|
||
- **Replicas**: 1 | ||
- **Estrategia**: Recrear | ||
- **Imagen del Contenedor**: ghost:alpine | ||
- **Recursos**: | ||
- Solicitudes: CPU=250m, Memoria=180Mi | ||
- Límites: CPU=350m, Memoria=300Mi | ||
- **Puertos**: ContainerPort=2368 | ||
|
||
### Sondas | ||
|
||
- **Sonda de Disponibilidad**: Verifica si Ghost está listo para aceptar tráfico. | ||
- **Sonda de Supervivencia**: Verifica si Ghost está vivo y saludable. | ||
|
||
### Variables de Entorno | ||
|
||
- Ghost depende de variables de entorno para la configuración, incluyendo detalles de conexión a la base de datos y configuración de Mailgun. | ||
|
||
## Configuración de Ingress | ||
|
||
- **Hosts**: questverse.blog, www.questverse.blog | ||
- **TLS**: Utiliza el secreto questverse-com-tls para HTTPS. | ||
- **Anotaciones**: | ||
- Redirección de from-to-www. | ||
- Varios ajustes de NGINX para proxy, almacenamiento en búfer, caché y brotli. | ||
|
||
## Configuración de Ghost | ||
|
||
### ConfigMap | ||
|
||
- ConfigMap llamado `ghost-configmap` con pares clave-valor para la configuración de Ghost, incluyendo URL, conexión a la base de datos y configuración de correo. | ||
|
||
### Almacenamiento Persistente | ||
|
||
- Ghost utiliza una Reclamación de Volumen Persistente (PVC) llamada `ghost` con una solicitud de almacenamiento de 15Gi y la clase de almacenamiento `do-block-storage`. | ||
|
||
### Secretos | ||
|
||
- Secretos llamados `ghost-secrets` para datos sensibles, incluyendo credenciales de Mailgun. | ||
|
||
### Servicio | ||
|
||
- Servicio de Kubernetes llamado `ghost` con asignación de puertos (80:ghost). | ||
|
||
## Configuración de la Implementación de MySQL | ||
|
||
### Implementación | ||
|
||
- **Replicas**: 1 | ||
- **Estrategia**: Recrear | ||
- **Imagen del Contenedor**: mysql:8.0.33 | ||
- **Recursos**: | ||
- Solicitudes: CPU=200m, Memoria=450Mi | ||
- Límites: CPU=400m, Memoria=550Mi | ||
- **Puertos**: ContainerPort=3306 | ||
|
||
### Sondas | ||
|
||
- **Sonda de Disponibilidad**: Verifica si MySQL está listo para aceptar tráfico. | ||
- **Sonda de Supervivencia**: Verifica si MySQL está vivo y saludable. | ||
|
||
### Variables de Entorno | ||
|
||
- La configuración de MySQL incluye la contraseña de root, el nombre de la base de datos y depende de secretos. | ||
|
||
### Almacenamiento Persistente | ||
|
||
- MySQL utiliza una Reclamación de Volumen Persistente (PVC) llamada `mysql` con una solicitud de almacenamiento de 5Gi y la clase de almacenamiento `do-block-storage`. | ||
|
||
### Servicio | ||
|
||
- Servicio de Kubernetes llamado `mysql` con clusterIP configurado como None para un servicio sin cabeza. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: ghost-configmap | ||
namespace: ghost | ||
data: | ||
url: "https://questverse.blog" | ||
database__connection__host: "mysql" | ||
database__client: "mysql" | ||
mail__transport: "SMTP" | ||
mail__options__service: "Mailgun" | ||
mail__options__host: "smtp.eu.mailgun.org" | ||
mail__options__port: "465" | ||
mail__options__secure: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
namespace: ghost | ||
name: ghost | ||
labels: | ||
app: ghost | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: ghost | ||
replicas: 1 | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app: ghost | ||
spec: | ||
containers: | ||
- name: ghost | ||
image: ghost:alpine | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
cpu: 250m | ||
memory: 180Mi | ||
limits: | ||
cpu: 350m | ||
memory: 300Mi | ||
ports: | ||
- containerPort: 2368 | ||
name: ghost | ||
readinessProbe: | ||
tcpSocket: | ||
port: ghost | ||
initialDelaySeconds: 10 | ||
periodSeconds: 10 | ||
livenessProbe: | ||
tcpSocket: | ||
port: ghost | ||
initialDelaySeconds: 30 | ||
periodSeconds: 30 | ||
env: | ||
- name: database__connection__database | ||
valueFrom: | ||
secretKeyRef: | ||
name: mysql-secrets | ||
key: db-name | ||
optional: false | ||
- name: database__connection__user | ||
valueFrom: | ||
secretKeyRef: | ||
name: mysql-secrets | ||
key: db-user | ||
optional: false | ||
- name: database__connection__password | ||
valueFrom: | ||
secretKeyRef: | ||
name: mysql-secrets | ||
key: db-pass | ||
optional: false | ||
- name: mail__options__auth__user | ||
valueFrom: | ||
secretKeyRef: | ||
name: ghost-secrets | ||
key: mailgun_username | ||
optional: false | ||
- name: mail__options__auth__pass | ||
valueFrom: | ||
secretKeyRef: | ||
name: ghost-secrets | ||
key: mailgun_password | ||
optional: false | ||
envFrom: | ||
- configMapRef: | ||
name: ghost-configmap | ||
volumeMounts: | ||
- name: ghost-persistent-storage | ||
mountPath: /var/lib/ghost/content | ||
volumes: | ||
- name: ghost-persistent-storage | ||
persistentVolumeClaim: | ||
claimName: ghost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: ghost | ||
namespace: ghost | ||
spec: | ||
rules: | ||
- host: questverse.blog | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: ghost | ||
port: | ||
number: 80 | ||
ingressClassName: nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: ghost | ||
namespace: ghost | ||
annotations: | ||
nginx.ingress.kubernetes.io/from-to-www-redirect: "true" | ||
spec: | ||
ingressClassName: nginx | ||
tls: | ||
- hosts: | ||
- questverse.blog | ||
- www.questverse.blog | ||
secretName: questverse-com-tls | ||
rules: | ||
- host: questverse.blog | ||
http: | ||
paths: | ||
- backend: | ||
service: | ||
name: ghost | ||
port: | ||
name: http | ||
path: / | ||
pathType: Prefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: ghost | ||
namespace: ghost | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 15Gi | ||
storageClassName: do-block-storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: ghost-secrets | ||
namespace: ghost | ||
type: Opaque | ||
data: | ||
mailgun_username: test | ||
mailgun_password: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: ghost | ||
namespace: ghost | ||
labels: | ||
app: ghost | ||
spec: | ||
selector: | ||
app: ghost | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: ghost | ||
name: http |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: mysql | ||
namespace: ghost | ||
labels: | ||
app: mysql | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: mysql | ||
tier: mysql | ||
replicas: 1 | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app: mysql | ||
tier: mysql | ||
spec: | ||
containers: | ||
- name: mysql | ||
image: mysql:8.0.33 | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
cpu: 200m | ||
memory: 450Mi | ||
limits: | ||
cpu: 400m | ||
memory: 550Mi | ||
ports: | ||
- containerPort: 3306 | ||
name: mysql | ||
readinessProbe: | ||
tcpSocket: | ||
port: mysql | ||
initialDelaySeconds: 10 | ||
periodSeconds: 10 | ||
livenessProbe: | ||
tcpSocket: | ||
port: mysql | ||
initialDelaySeconds: 30 | ||
periodSeconds: 30 | ||
env: | ||
- name: MYSQL_ROOT_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: mysql-secrets | ||
key: db-pass | ||
- name: MYSQL_DATABASE | ||
valueFrom: | ||
secretKeyRef: | ||
name: mysql-secrets | ||
key: db-name | ||
volumeMounts: | ||
- name: mysql-persistent-storage | ||
mountPath: /var/lib/mysql | ||
volumes: | ||
- name: mysql-persistent-storage | ||
persistentVolumeClaim: | ||
claimName: mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: mysql | ||
namespace: ghost | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 5Gi | ||
storageClassName: do-block-storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: mysql | ||
namespace: ghost | ||
labels: | ||
app: mysql | ||
spec: | ||
selector: | ||
app: mysql | ||
ports: | ||
- port: 3306 | ||
targetPort: 3306 | ||
name: mysql | ||
clusterIP: None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: ghost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: mysql-secrets | ||
namespace: ghost | ||
type: Opaque | ||
data: | ||
db-name: Z2hvc3Q= | ||
db-user: cm9vdA== | ||
db-pass: Z29saWF0 |
Oops, something went wrong.