About the Author
Wang Hailong, Technical Manager of SUSE Rancher China Community, responsible for the maintenance and operation of Rancher China Technical Community. With 8 years of experience in the cloud computing field, he has experienced the technological transformation from OpenStack to Kubernetes, and has rich operational and practical experience in the underlying operating system Linux, virtualized KVM or Docker container technology.
What is Rancher Desktop
Rancher Desktop is an application that provides container and Kubernetes management on the desktop. It works on Mac (including Intel and Apple chips), Windows, and Linux, allowing Kubernetes and container management to run natively on workstations.
It provides many great features, such as allowing you to choose the version of Kubernetes to run locally, build, push and run container images using containerd or Moby (aka dockerd). Also, you can build and run these images without first pushing the images to the registry.
Rancher Desktop Architecture
Rancher Desktop implements a cross-platform user interface based on Electron, and encapsulates tools such as nerdctl, kubectl, Helm, and Docker CLI. On MacOS and Linux, Rancher Desktop utilizes virtual machines to run containerd or dockerd and Kubernetes. In Windows, Windows Subsystem for Linux 2 (WSL2) is used.
Rancher Desktop uses a dedicated Rancher K3s distribution. K3s is a CNCF sandbox project, which provides a lightweight Kubernetes distribution, mainly suitable for edge computing, IoT and other scenarios. K3s is easy to install and very lightweight. Not only suitable for production environments, but can also run inside Rancher Desktop as a local development platform.
All you need to do is download and run Rancher Desktop.
Rancher Desktop install and configure
As of this writing, the latest version of Rancher Desktop is 1.0.1
Rancher Desktop
Download Rancher Desktop for your system from the Github release ( https://github.com/rancher-sandbox/rancher-desktop/releases ) page:
Install Rancher Desktop on Mac
Since my computer is a Mac, I will download and install the Mac version of Rancher Desktop 1.0.1. As you can see from the screenshot above, the installation package is small, only 339 MB. After downloading Rancher Desktop, simply run Rancher.Desktop-1.0.1.x86_64.dmg and follow the prompts to move Rancher Desktop into Applications to complete the installation.
For more installation methods, please refer to the official documentation: http://docs.rancher.cn/docs/rancherdesktop/installation/_index
Configure Rancher Desktop Kubernetes
- After opening Rancher Desktop, the Kubernetes cluster is automatically configured and started:
- The default parameter configuration for Kubernetes can be seen from the Kubernetes Settings tab:
- After a few minutes, Rancher Desktop will finish loading:
At this point, you have completed the installation and configuration of Rancher Desktop. And you've started a Kubernetes cluster locally that you can use to operate.
The General tab provides general information about the status of the project, as well as links to discuss the project, report an issue, or learn more about the project.
On the Kubernetes Settings tab, you can manage virtual machine settings such as: Kubernetes version, Container Runtime, memory, CPU, etc. You can also reset a Kubernetes cluster via Reset Kubernetes/Reset Kubernetes and Container Images.
On the Supporting Utilities tab, you can create symbolic links to tools in /usr/local/bin. By default, if the tool does not exist locally, a symbolic link is created.
- The Images tab allows you to manage images on the virtual machine, including pulling and building images.
- The Troubleshooting tab allows you to view logs and reset the environment to factory configuration if you encounter problems.
Notice:
The options supported by Rancher Desktop for Windows, Linux and Mac may be different. For more supported options, please refer to the official documentation: https://docs.rancher.cn/docs/rancherdesktop/features-guide/preferences/_index
Using the nerdctl command line tool
Nerdctl is a containerd CLI tool that is compatible with the Docker CLI style. The experience is basically the same as that of Docker, such as docker run, docker pull and docker logs. Nerdctl basically covers all the functions of the Docker CLI. At the same time, it also implements many functions that are not available in Docker, such as: lazy-pulling, image encryption (imgcrypt), etc.
Rancher Desktop automatically installs nerdctl on your workstation after starting the Kubernetes cluster. So you can directly manipulate your cluster with nerdctl:
Using Kubectl to connect Rancher Desktop Kubernetes
Now, we can connect to the Rancher Desktop Kubernetes cluster using Kubectl. But first you need to make sure your kubectl context is set to Rancher Desktop Kubernetes cluster. You can view or switch the current context through Kubernetes Contexts:
Of course, you can also view it through kubectl config get-contexts:
Finally, pods and nodes can be viewed using normal kubectl commands:
Dashboard
Rancher Desktop 1.0.1 does not provide a dashboard for managing Kubernetes clusters. By default, you can only manage Kubernetes clusters created by Rancher Desktop through kubectl, helm, nerdctl.
If you want to manage Kubernetes clusters created by Rancher Desktop through a neat dashboard, you can use Kube-explorer ( https://github.com/cnrancher/kube-explorer ).
Kube-explorer is a portable explorer for Kubernetes without any dependencies. It integrates the Rancher steve framework and its dashboard, and is recompiled, packaged, minified, and provides an almost completely stateless Kubernetes resource manager.
To install kube-explorer, download the binaries from the kube-explorer release ( https://github.com/cnrancher/kube-explorer/releases ) page.
Server running HTTP:
/kube-explorer --http-listen-port=9898 --https-listen-port=0
Then, open a browser and visit http://xxxx:9898 , and then you can manage your Kubernetes cluster through a very simple dashboard.
Note: If you are installing Rancher Desktop on Windows, you can use kubectl to install kube-explorer.
Q: Does Rancher Desktop support Chinese?
At present, Rancher Desktop does not support Chinese, but the Chinese documentation of Rancher Desktop is already online. You can visit http://docs.rancher.cn/rancherdesktop/ to check related information.
Q: Is Rancher Desktop the desktop version of Rancher?
No, Rancher Desktop is not Rancher on the desktop. Installing Rancher Desktop does not install Rancher, but you can install Rancher as a workload. Rancher Desktop is similar to apps like minikube, kind, or Docker Desktop, and the goal is to have an easy-to-setup local Kubernetes environment to manage containers.
Q: How does it compare to Docker Desktop? Is Rancher Desktop going to replace Docker Desktop?
We didn't start developing Rancher Desktop to create a replacement for Docker Desktop. Instead, we focused on improving the experience of running Kubernetes locally, and Docker Desktop focused on containerized applications. Also, Docker has been working on Docker Desktop for years, making it great for containerizing applications.
Build, push and pull images and run containers as we add functionality to Rancher Desktop. Rancher Desktop starts to overlap with Docker Desktop in terms of functionality.
Postscript
Rancher Desktop is a great solution to easily set up a local Kubernetes environment on a local workstation and is very lightweight (with K3s built in), great for development, learning and other purposes. The process of running Kubernetes with Rancher Desktop is also very simple, and provides features that other development environments do not have, such as: arbitrarily switch Kubernetes versions to configure the environment; switch your favorite container runtime, etc.
Rancher Desktop 1.0.1 does not yet support offline installation, and the corresponding configuration options are not particularly rich, and you need to manually install the dashboard. Subsequent versions will support offline installation, and will also integrate Rancher Dashboard, as well as support more advanced configuration options you need.
End this sharing with a recent popular sentence: You can always trust Rancher Team!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。