MANUAL

Kubernetes and Terraform: do you need them?

Kubernetes and Terraform: do you need them?

Two names you often hear, and which your AI assistant sometimes suggests. They’re powerful, but too resource-intensive for most small and medium-sized apps. This guide will help you choose.

01

What is Kubernetes?

Kubernetes (often referred to as “K8s”) runs and manages many containers across multiple servers. It restarts containers if they crash, distributes traffic and automatically scales up and down.

Terms you’ll come across:

Term Meaning
Pod The smallest unit: one or more containers together
Deployment Ensures that there are always X copies of your pod running
Service A fixed address where you can collect your pods
Ingress Inbound traffic (domains, HTTPS)
Node A server in the cluster
Namespace A separate space within the cluster
ConfigMap / Secret Settings / secrets for your pods

02

What is Terraform?

Terraform describes your infrastructure (servers, databases, DNS, storage) in code files. This allows you to rebuild a complete environment and see every change reflected in Git. This is known as Infrastructure as Code.

03

Do you need it?

Situation Advice
One app, one database, up to thousands of users No. A managed platform or a VPS with Docker is cheaper and simpler (see Putting your Laravel app online).
Multiple apps or services, a team with DevOps experience Perhaps. Start with a managed container platform, and only switch once you’ve reached your limits.
Many services, strict availability requirements, multiple environments Yes, and preferably managed Kubernetes (the cloud provider manages the cluster).
Your infrastructure consists of many separate cloud components that you often have to set up from scratch Terraform is useful in this situation, even without Kubernetes.

Is your AI assistant suggesting Kubernetes for a small app? If so, ask for clarification: "Why is this necessary, and what is the simplest alternative?"

04

If you’re working with Kubernetes anyway

kubectl get pods                          # wat draait er?
kubectl describe pod <naam>               # details en fouten
kubectl logs -f <pod>                     # logs volgen
kubectl apply -f deployment.yaml          # wijziging toepassen
kubectl rollout status deployment/app     # voortgang van een update
kubectl rollout undo deployment/app       # vorige versie terug

First, use kubectl apply --dry-run=client -f … to see what happens. Be careful when using kubectl delete.

05

If you’re using Terraform anyway

Always follow this order:

terraform init
terraform fmt
terraform validate
terraform plan -out=tfplan     # bekijk wat er verandert
terraform apply tfplan

When using plan, pay particular attention to lines containing - (delete) and -/+ (replace). Is a database being deleted? Stop and check. Store the state in a secure remote backend and never in Git. The

06

Need help?

Not sure which architecture is right for your app? At Bespoke Software and Web Applications, I choose the simplest architecture that ensures your app runs reliably and can be expanded later on.

07

Skills

08

Related services