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¶
- Installation & Setup
- Install Telepresence CLI
- Connect to Kubernetes cluster
-
Deploy Traffic Manager
-
Basic Intercepts
- Global intercepts (all traffic)
- Personal intercepts (header-based)
-
Preview URLs (shareable links)
-
Development Workflows
- Local debugging with cluster access
- Hot reload development
-
Integration testing
-
Advanced Features
- Volume mounts
- Environment variable sync
- 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:
- Understand Telepresence architecture
- Install and configure Telepresence
- Create and manage intercepts
- Debug services with local tools
- Collaborate using personal intercepts
- Share changes via preview URLs
- Integrate Telepresence into workflows
- Troubleshoot common issues
π Best Practices¶
- Use personal intercepts in shared environments
- Keep telepresence connected during development
- Leverage hot reload for fast feedback
- Export environment variables once, reuse
- Monitor Traffic Manager logs
- Clean up intercepts when done
- Use preview URLs for demos
- Document team intercept conventions
π Troubleshooting¶
If you encounter issues:
- Check TROUBLESHOOTING.md
- Run
./test.shto verify setup - Check
telepresence status - Enable debug:
telepresence loglevel debug - 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:
- Integrate Telepresence into CI/CD
- Create team workflows
- Explore Ambassador Cloud features
- Set up automated testing
- Configure for your specific stack
- Share knowledge with team
Happy Coding! π
Questions? Check the README.md for detailed information or EXAMPLES.md for practical use cases.