Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and run Rancher 2.0 on your desktop

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to install and run Rancher 2.0 on the desktop. I hope you will get something after reading this article. Let's discuss it together.

No problem, just install Rancher 2.0 on your desktop.

In this tutorial, I will take you to install the Docker-for-Desktop Edge version, enable the built-in Kubernetes engine, and run your own 2. 0 person instance of Rancher on the desktop.

Prepare in advance

In this tutorial, to manage and deploy local Kubernetes instances, you need to prepare the following tools in advance:

Kubectl-Kubernetes CLI tool

Helm-Kubernetes inventory catalog tool

Docker-for-Desktop

The basic Kubernetes engine is included in the Docker CE Edge installation package for Windows/Mac. We can use it to install the local Rancher Server. You can download and install it from Docker Store.

Windows version:

Https://store.docker.com/editions/community/docker-ce-desktop-windows

Mac version:

Https://store.docker.com/editions/community/docker-ce-desktop-mac

Docker configuration

Log in to Docker, right-click the Docker icon in System Tray, and select Settings

> > Advanced Settings

Add Memory to at least 4096MB in the Advanced section. Of course, you may also want to increase the number of CPUs allocated and the maximum size of the disk image (Disk image max size).

> > enable Kubernetes

In the Kubernetes section, select the check box to enable Kubernets API. Docker-for-Desktop automatically creates a ~ / .kube / config file with credentials so that kubectl can access the new local "cluster".

What if I don't see the Kubernetes section? Please check the General section and make sure you are using the Edge version.

> > Test cluster

Open the terminal test cluster. Run kubectl get nodes. Kubectl should return a node named docker-for-desktop.

Prepare Kubernetes

Docker-for-Desktop does not have any additional tools installed. We can use some static YAML manifest files with kubectl, but we want to make more use of existing tools in the Kubernetes community rather than reinventing wheels. Therefore, helm is used as the preferred packaging management tool for Kubernetes.

Helm charts provides template syntax for Kubernetes YAML manifest documents. With helm, we can create deployments that can be configured instead of just using static files. For more information on creating your own deployment directory, refer to the documentation above https://helm.sh/.

Initialize Helm on the cluster

Helm will install the tiller service on your cluster to manage the chart deployment. Because docker-for-desktop has RBAC enabled by default, we need to create serviceaccount and clusterrolebinding with kubectl so that tiller can be deployed to our cluster.

Create a ServiceAccount in the kube-system namespace

Create a ClusterRoleBinding so that the tiller account can access the cluster

Finally, initialize the tiller service with helm

Note: the installation of tiller has full cluster access and may not be suitable for production environments. So you need to read more helm documents and restrict access to tiller according to your own security requirements.

Add Ingress Controller

Ingress Controller is used to provide L7 http routing from the outside world to services running in Kubernetes.

We will install nginx-ingress chart using helm. This will create an ingress controller on our local cluster.

The default option for the "rancher" helm chart is to use SSL to pass back the self-signed certificate on the Rancher server pod. To support this option, we need to add the-- controller.extraArgs.enable-ssl-passthrough= "" option when installing chart.

Install Rancher

Let's install Rancher using helm.

Rancher's built-in self-signed SSL certificate will be used under the default installation. You can see all the options for the helm chart here: https://github.com/jgreat/helm-rancher-server

First add the rancher-server repository to helm

Install rancher chart now

Set up the hosts file

By default, the Rancher server will listen on the rancher.localhost. If we want to access it, we need to set a host file entry so that our browser can resolve the name.

Windows

C:\ windows\ system32\ drivers\ etc\ hosts

Mac

/ etc/hosts

Edit the appropriate file for the system and add this entry

Connect to Rancher

Browser accesses to https://rancher.localhost

Ignore the SSL warning, and then you should be able to see the Rancher login screen, which requires you to set the administrator password.

After reading this article, I believe you have a certain understanding of "how to install and run Rancher 2.0 on your desktop". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report