How to Customize k9s Themes to Different EnvironmentsHow to Customize k9s Themes to Different Environments
Updated at Oct 06, 2024
113 Views

1. Locate the k9s Skin Directory

First, you need to locate the directory where k9s stores its skin files. Open your terminal and run:

k9s info

This command will display information about your k9s setup, including the path to the skin directory. By default, the skin directory is located at:

~/Library/Application\ Support/k9s/skins

If the path is different on your system, use the one provided by the k9s info command.

2. Navigate to the Skin Directory

Next, navigate to the skin directory using the cd command:

cd ~/Library/Application\ Support/k9s/skins

3. Download a Theme

Browse the available themes on the k9s GitHub repository:

https://github.com/derailed/k9s/tree/master/skins

Download the YAML file of the theme you like (e.g., dracula.yml) and place it into the skins directory from Step 2.

4. Edit the Configuration for Your Cluster

If you want to apply the theme to a specific Kubernetes cluster, navigate to the cluster’s configuration directory. Replace k8s-production with the name of your cluster:

cd ~/Library/Application\ Support/k9s/k8s-production/k8s-production

5. Apply the Skin to Your Cluster

In the config.yml file, add or update the following lines to specify the skin you want to use:

k9s:
  cluster: k8s-production
  skin: dracula

Explanation:

  • skin: The name of the skin file you downloaded (without the .yml extension).

6. Rerun k9s

For the changes to take effect, rerun k9s:

k9s

Conclusion

Customizing K9s themes can help remind us that we are in different environments, preventing operations on production clusters by mistake.