Skip to content

Lab 28 - Telepresence Demo

🎯 Quick Start

Deploy the demo and start intercepting in minutes:

# 1. Setup everything
./setup.sh

# 2. Quick start intercept
./quickstart.sh

# 3. Navigate to backend app
cd resources/backend-app

# 4. Setup Python environment (first time)
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# 5. Start intercepting
telepresence intercept backend --port 5000 --namespace telepresence-demo

# 6. Run locally
python app.py

# 7. Test via frontend
kubectl port-forward -n telepresence-demo svc/frontend 8080:80
# Open http://localhost:8080

πŸ“ Lab Structure

32-Telepresence/
β”œβ”€β”€ README.md              # Complete guide with theory and exercises
β”œβ”€β”€ EXAMPLES.md            # 12 practical examples
β”œβ”€β”€ TROUBLESHOOTING.md     # Common issues and solutions
β”œβ”€β”€ setup.sh              # Automated setup script
β”œβ”€β”€ cleanup.sh            # Cleanup script
β”œβ”€β”€ test.sh               # Test script
β”œβ”€β”€ quickstart.sh         # Quick start guide
└── resources/
    β”œβ”€β”€ 01-namespace.yaml           # Namespace definition
    β”œβ”€β”€ 02-dataservice.yaml         # Data service deployment
    β”œβ”€β”€ 03-backend.yaml             # Backend service deployment
    β”œβ”€β”€ 04-frontend.yaml            # Frontend deployment
    β”œβ”€β”€ BUILD.md                     # Docker build instructions
    β”œβ”€β”€ backend-app/
    β”‚   β”œβ”€β”€ app.py                   # Backend Python application
    β”‚   β”œβ”€β”€ requirements.txt         # Python dependencies
    β”‚   └── Dockerfile              # Backend Docker image
    β”œβ”€β”€ dataservice-app/
    β”‚   β”œβ”€β”€ app.py                   # Data service application
    β”‚   β”œβ”€β”€ requirements.txt         # Python dependencies
    β”‚   └── Dockerfile              # Data service Docker image
    └── frontend-app/
        β”œβ”€β”€ index.html               # Frontend HTML/JS
        β”œβ”€β”€ nginx.conf              # Nginx configuration
        └── Dockerfile              # Frontend Docker image

πŸš€ What You’ll Learn

  1. Installation & Setup
  2. Install Telepresence CLI
  3. Connect to Kubernetes cluster
  4. Deploy Traffic Manager

  5. Basic Intercepts

  6. Global intercepts (all traffic)
  7. Personal intercepts (header-based)
  8. Preview URLs (shareable links)

  9. Development Workflows

  10. Local debugging with cluster access
  11. Hot reload development
  12. Integration testing

  13. Advanced Features

  14. Volume mounts
  15. Environment variable sync
  16. Docker mode

πŸ“š Documentation

  • README.md - Complete guide (50+ pages)
  • Theory and concepts
  • Installation steps
  • 4 hands-on exercises
  • Best practices
  • Troubleshooting

  • EXAMPLES.md - 12 Practical Examples

  • Basic workflows
  • VS Code debugging
  • Team collaboration
  • Integration testing

  • TROUBLESHOOTING.md - Problem Solving

  • 10 common issues
  • Solutions and workarounds
  • Debug commands

πŸ› οΈ Scripts

  • setup.sh - Deploy all resources automatically
  • cleanup.sh - Remove all demo resources
  • test.sh - Verify deployment and connectivity
  • quickstart.sh - Quick start guide for intercepting

πŸŽ“ Exercises

Exercise 1: Basic Intercept

Route all backend traffic to your local machine

Exercise 2: Preview URLs

Create shareable links for stakeholder review

Exercise 3: Global Intercept

Test breaking changes safely

Exercise 4: Personal Intercept

Use header-based routing for team development

πŸ—οΈ Demo Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚
β”‚   (Nginx)       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Backend       │─────▢│ Data Service β”‚
β”‚   (Python)      β”‚      β”‚  (Python)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Intercept Point: Backend service - Local development with cluster access - Real-time testing with other services - No container builds required

⚑ Key Features Demonstrated

  • βœ… Fast inner-loop development
  • βœ… Service mesh integration
  • βœ… Real-time code changes
  • βœ… Team collaboration
  • βœ… Production debugging
  • βœ… Integration testing
  • βœ… Preview URLs
  • βœ… Environment sync

πŸ”§ Prerequisites

  • Kubernetes cluster (Minikube, Kind, or cloud)
  • kubectl configured
  • Admin access to cluster
  • Python 3.11+
  • Docker (optional)

πŸ“ Common Commands

# Connect
telepresence connect

# List services
telepresence list --namespace telepresence-demo

# Intercept
telepresence intercept backend --port 5000 --namespace telepresence-demo

# Status
telepresence status

# Leave intercept
telepresence leave backend

# Disconnect
telepresence quit

# Cleanup
telepresence uninstall --everything

🎯 Learning Outcomes

After completing this lab, you will:

  1. Understand Telepresence architecture
  2. Install and configure Telepresence
  3. Create and manage intercepts
  4. Debug services with local tools
  5. Collaborate using personal intercepts
  6. Share changes via preview URLs
  7. Integrate Telepresence into workflows
  8. Troubleshoot common issues

🌟 Best Practices

  1. Use personal intercepts in shared environments
  2. Keep telepresence connected during development
  3. Leverage hot reload for fast feedback
  4. Export environment variables once, reuse
  5. Monitor Traffic Manager logs
  6. Clean up intercepts when done
  7. Use preview URLs for demos
  8. Document team intercept conventions

πŸ› Troubleshooting

If you encounter issues:

  1. Check TROUBLESHOOTING.md
  2. Run ./test.sh to verify setup
  3. Check telepresence status
  4. Enable debug: telepresence loglevel debug
  5. View logs: kubectl logs -n ambassador deployment/traffic-manager

πŸ”— Resources

  • Official Docs: https://www.telepresence.io/docs/
  • GitHub: https://github.com/telepresenceio/telepresence
  • Community Slack: https://a8r.io/slack
  • Video Tutorials: https://www.youtube.com/c/Datawire

🧹 Cleanup

# Remove demo resources
./cleanup.sh

# Or manually
kubectl delete namespace telepresence-demo
telepresence quit
telepresence uninstall --everything

πŸ’‘ Next Steps

After mastering this lab:

  1. Integrate Telepresence into CI/CD
  2. Create team workflows
  3. Explore Ambassador Cloud features
  4. Set up automated testing
  5. Configure for your specific stack
  6. Share knowledge with team

Happy Coding! πŸš€

Questions? Check the README.md for detailed information or EXAMPLES.md for practical use cases.