This documentation provides a comprehensive, step-by-step roadmap to building a local Kubernetes cluster using Ubuntu Virtual Machines and deploying a production-ready environment for API and Odoo services.
To ensure a successful deployment, follow these guides in sequential order:
- Cluster Setup: Prepare nodes, install the container runtime (Containerd), and initialize the cluster with
kubeadm. - Networking & Load Balancing: Configure the CNI (Flannel) and set up MetalLB to handle external IP assignments.
- Ingress & Persistence: Deploy the NGINX Ingress Controller and configure StatefulSets for data persistence.
- Secrets & Application Deployment: Manage environment secrets and launch the API and Odoo deployments.
Important
Since it is a server using Virtual Machines instead of real machines or Cloud ones, you need to trick your local computer to let you access the ingress urls
If you are in Linux edit /etc/hosts add the ingress adress of your controller, you can get by executing kubectl get ingress -A in your master node, follow the adress with the url you assigned to the service.
If you are in Windows edit C:\Windows\System32\drivers\etc\hosts and follow the same steps as for Linux.
- View all resources:
kubectl get pods, pvc, svc - Check node status:
kubectl get nodes
- Restart a specific deployment:
kubectl rollout restart deployment/<name> - Scale replicas:
kubectl scale deployment/<name> --replicas=n - Terminal access:
kubectl exec -it deployment/odoo -- /bin/bash
- Initialize Master:
sudo kubeadm init --pod-network-cidr=192.168.0.0/16 - Generate join command:
sudo kubeadm token create --print-join-command