Skip to content

daviddsp/mlops-flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MlOps-flow

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.


Requisitos / Prerequisites

  • 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.


Estructura / Structure

  • infra/ Terraform para crear el clúster k3d y desplegar Kubeflow
    • main.tf crea el clúster y llama a los scripts de instalación
    • variables.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

Uso Rápido / Quickstart

  1. Clona el repo / Clone the repo
git clone https://github.com/<tu-usuario>/mlops-flow.git
cd mlops-flow/infra
  1. 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
  1. 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.


Personalización / Customization

Variables principales (ver infra/variables.tf):

  • cluster_name (string, por defecto kubeflow)
  • agents (number, por defecto 2)
  • map_http (string, por defecto 80:80@loadbalancer)
  • map_https (string, por defecto 443: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"

Destruir / Destroy

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.


Solución de problemas / Troubleshooting

  • Verifica que Docker esté en ejecución.
  • Asegúrate de tener k3d instalado y en el PATH.
  • Si los puertos 80/443 están ocupados, ajusta map_http y map_https.
  • Si el apply falla por tiempo, vuelve a ejecutar terraform apply.
  • Comprueba el contexto: kubectl config use-context k3d-<cluster_name>.

Licencia / License

Apache 2.0. Ver LICENSE.

About

This repository contains a practice example to help understand the MLOps workflow.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published