📚 I miei articoli#

Benvenuto in questa sezione, qui troverai tutti i miei articoli.

Ogni pezzo è organizzato per argomento e aggiornato man mano che creo nuovi contenuti.


Come ho costruito il mio sito con Hugo, Hugo Book e Kubernetes#

Hugo#

Ho usato Hugo come generatore di siti statici. Tutti i contenuti sono in Markdown e Hugo li trasforma in HTML pronto per il web, senza database o server dinamici.

Tema Hugo Book#

Il tema Hugo Book gestisce:

  • Sidebar automatica

  • Navigazione gerarchica

  • Ricerca integrata

  • Design responsive

Installazione:

git submodule add https://github.com/alex-shpak/hugo-book themes/hugo-book 
echo 'theme = "hugo-book"' >> config.toml

Parametri principali e menu configurati in config.toml.

Struttura dei contenuti#

Contenuti in Markdown, organizzati così:

   ├─ docs/  
   ├─ blog/  
   └─ about.md

Hugo Book genera la sidebar basandosi sulla struttura delle cartelle.

Build#

Generazione del sito:

hugo

Crea la cartella public/ pronta per il deploy.

Containerizzazione#

Dockerfile semplice:

FROM nginx:alpine 
COPY public/ /usr/share/nginx/html

Il sito diventa un container pronto da distribuire.

Deploy su Kubernetes#

PersistentVolumeClaim, Deployment e Service:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: hugo-thegoatlab
  namespace: hugo-thegoatlab
spec:
  storageClassName: nfs
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10G

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: hugo-app
  labels:
    app: hugo-app
  namespace: hugo-thegoatlab
spec:
  replicas: 1
  selector:
    matchLabels:
        app: hugo-app
  template:
    metadata:
      labels:
        app: hugo-app
    spec:
      volumes:
        - name: hugo-thegoatlab
          persistentVolumeClaim:
            claimName: hugo-thegoatlab
      containers:
        - name: hugo-app
          image: hugomods/hugo:debian-non-root
          volumeMounts:
            - mountPath: '/src'
              name: hugo-thegoatlab
          workingDir: '/src'
          command: ['server'] 
          args: ['-D']
          ports:
            - containerPort: 1313
              name: hugo


---

apiVersion: v1
kind: Service
metadata:
  name: hugo-thegoatlab
  namespace: hugo-thegoatlab
spec:
  ports:
    - port: 80
      protocol: TCP
      targetPort: hugo
  selector:
    app: hugo-app
  type: ClusterIP

---

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: hugo-thegoatlab
  namespace: hugo-thegoatlab
spec:
  rules:
  - host: www.thegoatlab.it
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: hugo-thegoatlab
            port:
              number: 80

Il sito è ridondante, scalabile e bilanciato automaticamente.

Conclusione#

Hugo + Hugo Book + container + Kubernetes permette di avere un sito statico veloce, moderno e pronto per alta disponibilità.

© 2025 The Goat Lab. Tutti i diritti riservati.