MLOps local stack example using Terraform + k3d + Kubeflow.
Este repositorio crea un clúster local con k3d y despliega Kubeflow usando Terraform. Está pensado para practicar flujos de MLOps de forma reproducible en tu máquina.
This repository provisions a local Kubernetes cluster with k3d and installs Kubeflow via Terraform. It’s meant for practicing MLOps workflows locally in a reproducible way.
- Docker Desktop (o Docker) en ejecución
- k3d (obligatorio para entorno local)
- kubectl
- kustomize
- Terraform ≥ 1.5
- git
En macOS con Homebrew:
brew install k3d kubectl kustomize terraform git
Asegúrate de tener Docker corriendo antes de ejecutar Terraform.
Make sure Docker is running before you apply Terraform.
infra/
Terraform para crear el clúster k3d y desplegar Kubeflowmain.tf
crea el clúster y llama a los scripts de instalaciónvariables.tf
variables (nombre del clúster, agentes, puertos, etc.)outputs.tf
comandos/utilidades de salida (port-forward, URL, contexto)scripts/install_kubeflow.sh
instala Kubeflow (kustomize + kubectl)scripts/uninstall_kubeflow.sh
limpieza best-effort
- Clona el repo / Clone the repo
git clone https://github.com/<tu-usuario>/mlops-flow.git
cd mlops-flow/infra
- Inicializa e implementa / Init and apply
terraform init
terraform apply
El apply
:
- Creará un clúster k3d llamado
kubeflow
(por defecto, ver variables) - Aplicará los manifests de Kubeflow con reintentos hasta que estén listos
The apply
will:
- Create a k3d cluster named
kubeflow
(defaults, see variables) - Install Kubeflow manifests with retries until ready
- Accede al dashboard / Access the dashboard
Después del apply
, puedes hacer port-forward (también aparece en outputs
):
kubectl port-forward -n istio-system svc/istio-ingressgateway 8080:80
Abre http://localhost:8080
y usa estas credenciales por defecto:
- Usuario / User:
user@example.com
- Contraseña / Password:
12341234
El contexto de Kubernetes será: k3d-kubeflow
.
The Kubernetes context will be: k3d-kubeflow
.
Variables principales (ver infra/variables.tf
):
cluster_name
(string, por defectokubeflow
)agents
(number, por defecto2
)map_http
(string, por defecto80:80@loadbalancer
)map_https
(string, por defecto443:443@loadbalancer
)kubeflow_repo
(string, repo de manifests)kubeflow_ref
(string, tag/branch/commit; vacío = default)
Ejemplos / Examples:
# Cambiar nombre del clúster y número de agentes
terraform apply -var="cluster_name=mykf" -var="agents=3"
# Cambiar puertos si 80/443 están ocupados
terraform apply -var="map_http=8081:80@loadbalancer" -var="map_https=8443:443@loadbalancer"
# Fijar una versión específica de Kubeflow manifests (tag/branch/commit)
terraform apply -var="kubeflow_ref=v1.9.0"
Para borrar todos los recursos locales:
terraform destroy
Esto eliminará el despliegue de Kubeflow y destruirá el clúster k3d.
This will remove Kubeflow and delete the k3d cluster.
- Verifica que Docker esté en ejecución.
- Asegúrate de tener
k3d
instalado y en elPATH
. - Si los puertos 80/443 están ocupados, ajusta
map_http
ymap_https
. - Si el
apply
falla por tiempo, vuelve a ejecutarterraform apply
. - Comprueba el contexto:
kubectl config use-context k3d-<cluster_name>
.
Apache 2.0. Ver LICENSE
.