Fabiano Weimar: Plone on Kubernetes

published Nov 29, 2024

Talk by Fabiano Weimar (Xiru) at the Plone conference 2024 in Brasilia.

Link to talk information on Plone conference website.

Kubernetes (k8s) is an open source system for managing containerised applications It provides mechanisms for deployment and scaling. It is part of the Cloud Native Computing Foundation.

Kubernetes' benefits are scalability, fault tolerant, self-healing, efficient resource utilisation, declarative configuration, rich ecosystem.

Kubernetes basics:

  • pods: the smallest deployable unit of computing, consisting of one or more containers. Containers in one pod can talk with each other like they are all on localhost.
  • deployments: manage the replication and updates of pods
  • RepicaSets: manage a fixed number of identical pods.
  • StatefulSets: manage stateful apps, lik databases
  • Jobs: one-off tasks
  • CronJob: regular tasks
  • ConfigMap: store configuration data
  • Secrets: store sensitive information 
  • PersistentVolumeClaims: request storage
  • PersistentVolumes: actual storage
  • Pod Disruption Budgets (pdb): limit the number of pods that can be unavailable at any given time, for example during upgrades, self-healing during disaster recovery.
  • Autoscaler: automatically scale the number of nodes in a cluster based on workload. Resource optimisation.
  • Ingress: routing external traffic to services, SSL termination, load balancing, caching, rate limiting.
  • Operator: software extensions to Kubernetes that make use of custom resources to manage applications and their components. Think of this as a human operator who would go in and do some stuff.

Plone components as Kubernetes resources:

  • Plone backend: StatefulSet
  • Plone frontend: Depoloyment
  • PostgreSQL: StatefulSet
  • Varnish: Deployment
  • nginx
  • cronjobs

Kubernetes for Devops.  It has a steep learning curve. For your laptop you have microk8s and k3d so you have the Kubernetes api, although without the options that you would have with multiple machines. Basics: `apt install docker.io` and `snap install kubectl --classic` and `snap install heml --classic`. And read https://k3d.io/ 

At the Alpine City Sprint this year we worked on helm charts for Plone: https://github.com/plone/helm-charts/

Tips and tricks:

  • You can use ArgoCD to automatically do a deploy when something changes in a git repo. You need to configure this correctly of course.
  • Plone can do better on integration with proper observability tools like Grafana and Prometheus. For example, how can such tools get the logs when they are in multiple places.
  • Use ZODB with PostgreSQL and relstorage. I think it is the most stable implementation today.
  • Varnish Operator from IBM looks promising when you want to run multiple instances of varnish.
  • If you run the `test.sh` from Plone help charts this may use a lot of bandwidth downloading docker images. k3d supports import of docker images so they are in a cache.