Introducing chpharos - Kontena Pharos version switcher

Managing multiple versions of Kubernetes clusters can be tricky. Each Kubernetes version may require different versions of management tools such as kubectl. For Kontena Pharos users, the pharos-cluster tool already takes care of installing and upgrading their clusters to different versions of Kubernetes and their dependencies (like networking, kubelet, kube-proxy, cri-o etc) to versions that are compatible with that Kubernetes version.

To make the lives of users even easier, we are now introducing a new tool called chpharos.

With chpharos it's easy to install multiple versions of pharos-cluster binaries with the corresponding versions of management tools such as kubectl and switch between them while managing your clusters. The tool also has an option to perform the switching automatically when working in a project directory that contains a .pharos-version file.

Like pharos-cluster, chpharos works on MacOS and most Linux distributions and in addition to a shell such as Bash or Zsh, it only requires a version of curl or wget to function, which you will usually find pre-installed on most systems.

Installation

Installing chpharos is easy. You can install it from the command line using:

curl -s https://get.pharos.sh | bash

The installer has some options that you can list by using:

curl -s https://get.pharos.sh | bash -s -- -h

Alternative installation options, such as MacOS Homebrew are also available.

Usage

Log in

Logging in with your Kontena Account credentials is required to list and download the binaries. To log in, you can use chpharos login command which will display a prompt for your username and password. For automation such as CI/CD pipelines you can provide the authentication token in the CHPHAROS_TOKEN environment variable.

List available versions

chpharos list-remote command will list all released stable versions of pharos-cluster binaries.

If you want to include the pre-release/beta versions you can use the --pre option: chpharos list-remote --pre

Install a new version

chpharos install <version> command is used when installing a new version. The installer will download the specified versions of pharos-cluster binaries and their dependencies and verify their SHA checksums before installation.

To install the currently latest version, you can use chpharos install latest.

List installed versions

chpharos list command will list all versions that are currently installed.

Select the version to use

To switch between pharos-cluster binaries you can use the chpharos use <version> command. This also changes the version of currently used kubectl to match the version of Kubernetes used by that version of pharos-cluster.

Automatic version switching

chpharos can be used in an automatic mode where switching to a directory that contains a .pharos-version file will automatically switch to the version specified in the file.

To enable this, you need to use the command chpharos auto or add it into your start-up scripts after the loading of chpharos.sh.

You can use chpharos use --local 1.1.1 to create a .pharos-version file in the current directory or chpharos use --default 1.1.1 to set a default version by creating a .pharos-version file in the $HOME directory

About Kontena Inc.

Kontena Inc. is specialized in creating the most developer friendly solutions for running containers. Kontena's products are built on open source technology developed and maintained by Kontena. Kontena was founded in 2015 and has offices in Helsinki, Finland and New York, USA. More information: www.kontena.io.

Image credits Photo by Zoltan Tasi on Unsplash