MLOps Quick Reference Cheatsheetπ
git init # initialize repo
git add . # stage all changes
git commit -m "message" # commit
git checkout -b feature/branch # new branch
git push origin branch-name # push branch
git pull origin main # pull latest
git tag v1.0.0 && git push --tags # tag a release
dvc init # init DVC in repo
dvc remote add -d gcs gs://bucket # set remote storage
dvc add data/dataset.csv # track large file
dvc push # push to remote
dvc pull # pull from remote
dvc repro # reproduce pipeline
dvc dag # view pipeline DAG
π³ Dockerπ
docker build -t image:tag . # build image
docker run -p 8000:8000 image # run container
docker run -d --name app image # run detached
docker ps # list running
docker logs app # view logs
docker exec -it app bash # shell into container
docker push gcr.io/proj/img:tag # push to registry
docker system prune -a # clean up all
βΈοΈ Kubernetesπ
kubectl apply -f deployment.yaml # deploy
kubectl get pods -n production # list pods
kubectl get svc # list services
kubectl logs pod-name # pod logs
kubectl describe pod pod-name # pod details
kubectl exec -it pod-name -- bash # shell into pod
kubectl scale deploy/app --replicas=5 # scale
kubectl rollout status deploy/app # check rollout
kubectl rollout undo deploy/app # rollback
kubectl delete -f deployment.yaml # remove
βοΈ GCP / gcloudπ
gcloud auth login # authenticate
gcloud config set project my-proj # set project
gcloud container clusters create ml-cluster \
--num-nodes=3 --region=us-central1 # create GKE
gcloud container clusters get-credentials ml-cluster \
--region=us-central1 # connect kubectl
gsutil cp file.csv gs://bucket/ # upload to GCS
gsutil ls gs://bucket/ # list GCS
gcloud builds submit --config cloudbuild.yaml # cloud build
π¬ MLflowπ
import mlflow
mlflow.set_experiment("exp-name")
with mlflow.start_run():
mlflow.log_param("lr", 0.01)
mlflow.log_metric("accuracy", 0.92)
mlflow.sklearn.log_model(model, "model")
# Load model
model = mlflow.sklearn.load_model("models:/name/Production")
π Kubernetes Manifestsπ
# Minimum deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: ml-model
spec:
replicas: 3
selector:
matchLabels:
app: ml-model
template:
metadata:
labels:
app: ml-model
spec:
containers:
- name: ml-model
image: gcr.io/project/ml-model:v1
ports:
- containerPort: 8000
resources:
requests: {memory: "256Mi", cpu: "250m"}
limits: {memory: "512Mi", cpu: "500m"}
π MLOps Maturity Checklistπ
Level 0 (Manual):
β‘ Model trained in notebook
β‘ Manual deployment
Level 1 (Automated Training):
β‘ Training pipeline automated
β‘ Data versioned (DVC)
β‘ Experiments tracked (MLflow)
β‘ Model registry in use
Level 2 (CI/CD + CT):
β‘ CI pipeline (lint + test on every push)
β‘ CD pipeline (auto-build + deploy on merge)
β‘ CT (auto-retrain on new data/drift)
β‘ Model quality gates
β‘ Containerized deployment (Docker)
β‘ Kubernetes orchestration
β‘ Monitoring + alerting (Prometheus/Grafana)
β‘ Drift detection (Evidently)
| Tool |
URL |
| MLflow Docs |
https://mlflow.org/docs |
| DVC Docs |
https://dvc.org/doc |
| Kubernetes Docs |
https://kubernetes.io/docs |
| GCP Vertex AI |
https://cloud.google.com/vertex-ai |
| Prometheus |
https://prometheus.io/docs |
| Grafana |
https://grafana.com/docs |
| Jenkins |
https://www.jenkins.io/doc |
| Docker |
https://docs.docker.com |
| GitHub Actions |
https://docs.github.com/en/actions |