Setting Up Essential Tools for Platform Engineers in WSL 2

2 minute read

Published:

Setting Up Essential Tools for Platform Engineers in WSL 2

As a Platform Engineer, having the right set of tools is crucial for efficient development and operations. In this guide, we will walk through the process of setting up essential tools in WSL 2 (Windows Subsystem for Linux 2) to enhance your productivity.

End product

ohMyPosh

Prerequisites

Before getting started, make sure you have WSL 2 installed on your Windows machine. If you haven’t installed WSL 2 yet, follow the official Microsoft documentation for installing WSL 2.

Chained Prompting

We will use chained prompting to guide you through the installation process. Please follow the instructions and provide the necessary input when prompted.

1. Installing Homebrew (brew)

Homebrew is a package manager for Linux that makes it easy to install various software packages.

To install Homebrew, open your WSL 2 terminal and run the following command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Once installed, add the Homebrew path to your ~/.bashrc or ~/.zshrc file:

echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.zshrc

2. Installing Git

Git is essential for version control. To install Git via Homebrew, run:

brew install git

3. Installing kubectl

kubectl is the command-line tool for interacting with Kubernetes clusters. To install kubectl, run:

brew install kubectl

4. Installing krew

krew is a plugin manager for kubectl, which allows you to extend kubectl’s functionality with additional plugins. To install krew, run:

brew install krew

Once installed, add the following line to your ~/.bashrc or ~/.zshrc file:

export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"

5. Installing fzf

fzf is a powerful command-line fuzzy finder. To install fzf, run:

brew install fzf

After installing fzf, add the following line to your ~/.bashrc or ~/.zshrc file:

source /usr/share/doc/fzf/examples/key-bindings.bash

6. Installing kubectx and kubens

kubectx and kubens allow you to switch between Kubernetes contexts and namespaces effortlessly. To install kubectx and kubens, run:

brew install kubectx kubens

7. Installing kube-ps1

kube-ps1 is a script that displays the current Kubernetes context and namespace in your shell prompt. To install kube-ps1, run:

brew install kube-ps1

Once installed, add the following line to your ~/.bashrc or ~/.zshrc file:

source "/usr/local/opt/kube-ps1/share/kube-ps1.sh"

8. Installing Minikube

Minikube is a tool for running Kubernetes clusters locally. To install Minikube, run:

brew install minikube

Conclusion

Congratulations! You have now set up essential tools for Platform Engineers in WSL 2. These tools will help you manage Kubernetes clusters, version control with Git, and improve your overall productivity in your development and operations tasks.

Remember to check the official documentation of each tool for further usage and advanced configurations.

If you encounter any issues during the installation process, refer to the respective tool’s official websites for troubleshooting and support.

Happy coding! 🚀

Links to the tools: