Enhancing Telepresence’s Efficiency on the Command Line

Level up your Telepresence experience with telepresence-ps1, a tool inspired by kube-ps1 that enhances productivity and reduces cognitive load

Alex Gervais
3 min readOct 6, 2023

In the ever-evolving world of cloud-native development, the quest for increased productivity and seamless workflow has become paramount. As engineers and developers, we constantly seek innovative tools and utilities that simplify our daily tasks, empowering us to focus on what truly matters — building exceptional software.

One such tool that has garnered immense popularity in the Kubernetes ecosystem is kube-ps1. With its sleek and informative prompt, kube-ps1 revolutionized the way developers interact with Kubernetes clusters, providing valuable insights at a glance. Inspired by its brilliance and usefulness, I embarked on a journey to create a similar power tool tailored specifically for Telepresence.

Telepresence, a powerful open-source utility, enables developers to work on local code while connected to a remote Kubernetes cluster. It’s a game-changer for debugging, testing, and locally iterating on microservices within a larger distributed system. However, as much as I appreciate its capabilities, I found myself craving a more intuitive and informative experience while working with Telepresence.

This is where the inspiration from kube-ps1 took hold. The elegant simplicity of kube-ps1’s prompt design and its ability to provide essential context about the current Kubernetes cluster pushed me to explore the creation of an analogous tool for Telepresence. I envisioned a solution that would enhance the Telepresence workflow, delivering crucial insights and reducing the cognitive load associated with managing complex environments.

Get ready to unlock a new realm of Telepresence productivity as I introduce you to the telepresence-ps1 prompt, designed to make your development journey insightful, and context-aware. Let’s dive in!

telepresence-ps1 in action

telepresence-ps1 not only amplifies efficiency but also provides essential contextual information at your fingertips. By seamlessly integrating with Telepresence, telepresence-ps1 offers real-time updates on the connection status and the connected Kubernetes cluster. This valuable information allows you to maintain a clear understanding of your development environment state, ensuring you’re always aware of the context in which you’re working.

Installing

The telepresence-ps1 utility is currently available for Zsh and Bash. While no plugins or packages are available (yet!) through your favorite package manager, telepresence-ps1 is easy to install from source in your shell.

Zsh

# Clone the project's repository
git clone https://github.com/alexgervais/telepresence-ps1.git ~/telepresence-ps1

# Source the telepresence-ps1.sh script and configure PROMPT in your ~/.zshrc
source /path/to/telepresence-ps1.sh
PROMPT='$(telepresence_ps1)'$PROMPT

Bash

# Clone the project's repository
git clone https://github.com/alexgervais/telepresence-ps1.git ~/telepresence-ps1

# Source the telepresence-ps1.sh script and configure PS1 in your ~/.bashrc
source /path/to/telepresence-ps1.sh
PS1='[\u@\h \W $(telepresence_ps1)]\$ '

Opening a new terminal window, your command line prompt should be configured to show the current connection status of Telepresence:

(⧓|disconnected)➜ ~

Requirements

The script assumes you have the telepresence binary installed and executable from your $PATH. If you are only getting started with Telepresence, you’ll find the necessary installation instruction steps here: https://www.telepresence.io/docs/latest/quick-start/

The script also depends on jq to parse status information from Telepresence. You may install the jq utility following these instructions: https://jqlang.github.io/jq/download/

Customization

The default settings of telepresence-ps1.sh can be overridden in ~/.bashrc or ~/.zshrc using environment variables. Head on over to the project documentation for an exhaustive list of options!

Contributing

This project, like many before it, thrives on the diverse contributions of developers, enthusiasts, and users from around the world. If you’ve found value in what you’ve read today, consider contributing ideas and improvements. Whether you’re offering code, design, feedback, or simply spreading the word, every bit counts!

--

--

Alex Gervais

Outdoorsy, data-driven, eternal student, not so geeky creative mind and traveler. Distributed Systems Architect & Tech Lead. ex-Ambassador Labs, ex-AppDirect