Discover Rancher Desktop, a free, open-source solution for seamless Kubernetes and container management on your desktop, allowing you to run the Kubernetes version of your choice on a Windows, macOS, or Linux desktop.

Kubernetes is notoriously challenging to configure and run. Setting up a dedicated multinode development cluster to develop code can be overkill. Rancher Desktop is a free, open-source solution from SUSE that enables developers, enthusiasts, home labbers, and others to run containers and Kubernetes clusters on a local workstation. On macOS and Linux, it uses a VM to operate containerd or dockerd and Kubernetes. For Windows systems, it relies on the Windows Subsystem for Linux v2.

Rancher Desktop features

Rancher Desktop offers the following features:

  • Container management: Rancher Desktop can build, push, and pull container images. Since it uses the same container runtime as Kubernetes, the images are ready for your Kubernetes clusters running in Rancher Desktop or as standalone containers. In addition, images are immediately available since you don't have to check them into a separate repository.
  • Built-in security scanning: You can proactively scan for security vulnerabilities in container images.
  • Kubernetes clusters: One of the great features of the Rancher Desktop Kubernetes cluster is that it allows developers to choose the version of Kubernetes that they want to run. In addition, it enables developers to select the same version of Kubernetes that are running in production clusters to ensure compatibility and interoperability with their code.
  • Open-source components: Moby, K3s, kubectl, etc.

Rancher Desktop architecture

The underlying components of Rancher Desktop are free, open-source utilities and include:

  • Nerdctl: A Docker-compatible CLI for working with containerd that allows experimenting with the latest features not present in Docker
  • Kubectl: Command-line tool used to interact with Kubernetes
  • Helm: Provides an APT-like or YUM-like experience installing apps in Kubernetes
  • Docker CLI: The Docker command line tool
  • Kubernetes K3s: A lightweight open-source Kubernetes distribution
  • Containerd/dockerd: Container runtime and container engine components
Rancher Desktop high level architecture overview

Rancher Desktop high level architecture overview

Installing Rancher Desktop

You can run Rancher Desktop on the following platforms:

  • Mac (Apple Silicon)
  • Mac (Intel)
  • Windows
  • Linux

The installation process for Rancher Desktop is easy. You just have to decide whether you want to install Rancher Desktop for all users or only for yourself.

Running and using Rancher Desktop

When Rancher Desktop launches for the first time, you will notice that it begins downloading and starting K3s. This process does not take long. In the example below, Rancher downloads and starts the single-node K3s cluster in WSL2.

Rancher begins downloading and starting K3s Kubernetes

Rancher begins downloading and starting K3s Kubernetes

One thing you will want to do is switch your Kubernetes context to the Rancher Desktop context. In Kubernetes, the kubeconfig file in the user's profile directory can store configurations (contexts) for multiple clusters. Switching the context tells the kubectl command which cluster you want to work with.

Below, I have a workstation with configurations for multiple Kubernetes clusters. As you can see in the image, the current context doesn't point to the rancher-desktop cluster. We will need to switch the context to "rancher-desktop."

To view your current kubectl context, issue the following command:

kubectl config get-contexts

To switch the kubectl context to rancher-desktop, issue the command:

kubectl config use-context rancher-desktop
Viewing and switching the Kubernetes context

Viewing and switching the Kubernetes context

To verify that you are connected to the rancher-desktop cluster, use the command:

kubectl get nodes
or
kubectl get nodes -o wide

The "-o wide" parameter provides additional details about the cluster, including the network address information for the cluster.

Below, we are successfully connected to the Rancher Desktop single-node cluster. At this point, we can begin interacting with the cluster like any other Kubernetes cluster using kubectl.

Viewing the Kubernetes nodes using kubectl

Viewing the Kubernetes nodes using kubectl

Back on the Rancher Desktop interface, below, we can see the Port Forwarding configuration screen. Here, you can set up port forwarding to Kubernetes workloads running in Rancher Desktop. Port forwarding in Kubernetes is needed to forward traffic coming from outside the Kubernetes cluster to the proper internal address and port of the Kubernetes hosted application.

Viewing the Port Forwarding configuration in Rancher Desktop

Viewing the Port Forwarding configuration in Rancher Desktop

On the Images configuration screen, you can view currently installed images and add images to your cluster. Navigate to Images and then click Add Image.

Beginning to add an image to Rancher Desktop

Beginning to add an image to Rancher Desktop

Entering the name of the image to pull

Entering the name of the image to pull

The image successfully pulls down

The image successfully pulls down

One of the really nice features built into Rancher Desktop is its ability to scan images for vulnerabilities. Click the three dots next to the image and select Scan.

Scanning images for vulnerabilities

Scanning images for vulnerabilities

Rancher displays any vulnerabilities found in the image

Rancher displays any vulnerabilities found in the image

On the Troubleshooting screen, you can view logs, reset Kubernetes, or even perform a Factory Reset, removing all Rancher Desktop configurations.

The Troubleshooting screen in Rancher Desktop

The Troubleshooting screen in Rancher Desktop

Rancher Desktop also includes a Diagnostics screen that proactively displays any issues discovered in the environment.

Viewing the Rancher Diagnostics screen to view issues

Viewing the Rancher Diagnostics screen to view issues

If you are wondering how to configure your Kubernetes version in Rancher Desktop, this option is found under File > Preferences.

Selecting your Kubernetes version for Rancher Desktop

Selecting your Kubernetes version for Rancher Desktop

Running an application in Rancher Desktop Kubernetes

Let's run our Nginx application in Rancher Desktop. Using kubectl, we can apply a manifest file to run the Nginx image as a pod in our Rancher Desktop cluster.

Create a file with the following contents:

apiVersion: v1
kind: Pod
metadata:
  name: rancher-pod
spec:
  containers:
    - name: nginx
      image: nginx:latest
      ports:
        - containerPort: 80
          hostPort: 8176

Once you have created the file, apply it using the following command:

Kubectl apply -f <your file name>
Applying the Nginx manifest using kubectl

Applying the Nginx manifest using kubectl

Now, you should be able to browse to the local port configured in the manifest file (8176) and reach the Nginx application running in the Rancher Desktop pod.

Subscribe to 4sysops newsletter!

Browsing to the Nginx application hosted by the Rancher Desktop Kubernetes cluster

Browsing to the Nginx application hosted by the Rancher Desktop Kubernetes cluster

Wrapping up

Rancher Desktop provides an interesting option for developers, enthusiasts, and home labbers to easily play around and interact with Kubernetes clusters and containers without the complexity of setting up a full-blown Kubernetes cluster. The Rancher Desktop GUI interface allows easy viewing and configuring of port forwarding and images for your Kubernetes cluster. As shown, you can also perform security scanning of images.

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account