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 use Rancher2.0

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to use Rancher2.0". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Prepare a Linux host

Before you begin, you need to install a compatible version of Docker for the Linux host:

Docker v1.12.6

Docker v1.13.1

Docker v17.03-2-ce

Docker v17.06-ce

Requirements for Linux hosts

Prepare a 64-bit host, system Ubuntu16.04, at least 4GB memory, kernel version 3.10; install a compatible Docker version on the host, please refer to this tutorial on how to install Docker on the server.

Start Rancher Server

With just one command and a few minutes, you can install and start Rancher Server. After the installation is complete, open a Web browser to access Rancher UI.

How to start Rancher Server

Step 1: execute the following Docker command on your host

$sudo docker run-d-restart=unless-stopped-p 8080 rancher/server:preview

This step will take several minutes to complete

Step 2: type http://:8080 in the browser to access Rancher UI, where you need to fill in the IP address of your host. Rancher can automatically deploy and manage Kubernetes,UI the interface displays a Welcome page with two options for adding hosts.

Note: initially, Rancher will create a default cluster and environment for you. Rancher can group resources into multiple clusters and environments. Each cluster is a set of physical (or virtual) computing resources. Each environment binds a cluster and runs its container on the cluster's host, while you can share a cluster with multiple environments. The environment is the namespace used to define applications, services, and containers. Containers in the environment can communicate with each other through a shared manageable network, and you can manage resources in the environment by assigning access to different users / groups.

Step 3: select an option to add hosts, and then go to the relevant section below:

Add hosts-click this option if you want to manage hosts in Rancher. You can add an existing host with Docker installed, or you can add a new host provided by other cloud service providers (more on this later). Use existing Kubernetes-Click this option if you want the cluster provider to manage hosts outside of Rancher. You can import an existing Kubernetes (more on this later).

Add Host

Here you can add hosts from cloud service providers supported by Rancher v2.0, as well as custom hosts. If you don't see your cloud service provider in the UI interface, don't worry, just select the custom host option.

If you want to add a custom host, you need to pay attention to these requirements:

Typically, Rancher automatically detects IP addresses to register hosts

If the host is behind the NAT or on the same machine running the rancher/server container, you may need to specify its IP address. To specify the IP address, click the Show advanced option and enter the registered IP address.

The host agent initiates a connection to the server, so you need to make sure that the firewall or security group allows it to reach the URL through commands.

All hosts in the environment must allow traffic to each other to be networked across hosts.

IPSec:500/udp and 4500/udp

VXLAN:4789/udp

Add hosts from cloud service providers

Step 1: on the add Host page, select your cloud service provider:

Amazon EC2

Microsoft Azure

DigitalOcean

Packet

Step 2: follow the instructions in the Rancher UI interface to add the host. This process may take several minutes. When the host is added successfully, you can see its status on the Hosts page.

Add a custom host

Step 1: on the add Host page, click "Custom" and enter the docker command, such as:

Sudo docker run-- rm-- privileged-v / var/run/docker.sock:/var/run/docker.sock-v / var/lib/rancher:/var/lib/rancher rancher/agent:v2.0-alpha2 http://:8080/v3/scripts/D5433C26EC51325F9D98:1483142400000:KvILQKwz1N2MpOkOiIvGYKKGdE

Note: the IP address in the command must correspond to yours and must be accessible from within the host.

Step 2: copy, paste and run the command on your host, and you can register your host with Rancher. The process will take a few minutes to complete.

Step 3: click "close". You can see the status of the host on the Hosts page.

Import Kubernetes Cluster

In Rancher v2.0, you can import existing externally installed Kubernetes v1.7 and above. In this case, the cluster provider can manage your host outside of Rancher. We support hosting services such as Google Container Engine, Azure Container Service and IBM Bluemix, and you can also import your own Kubernetes cluster.

How to import a Kubernetes cluster

Step 1: copy and paste the kubectl command of the UI interface and execute it in your cluster.

Step 2: click "close". On the Hosts page, you can see the status of the Kubernetes node.

Add Container

After you have added at least one host or cluster to the environment, it may take a few minutes to start all Rancher system services. To verify your environment, choose system from the default menu. If the service is normal, the status will be green.

After confirming that all system services are started normally, you can create your first container.

How to add a container

Step 1: on the Rancher UI menu, click Container

Step 2: click "add Container" to go to the add Container page

Step 3: enter "name", such as "first-container"

Step 4: enter a Docker Image hosted on Docker Hub

Step 5: click "start". This step will take several minutes to complete. When the container starts, you can see its status on the Container page

So far you have added hosts and launched the first container, and then we will introduce the new features of Rancher v2.0.

Start the Catalog application

Rancher provides a catalog application template to deploy complex applications.

How to start the catalog application

Step 1: on the Rancher UI menu, click Apps to go to the Application page

Step 2: click Launch from Catalog to display the available catalog application templates

Step 3: find the template you want to start and click View Details

Step 4: complete the necessary filling

Note: docker-compose.yml and rancher-compose.yml files are related to building applications. Click Preview before starting the stack to view them.

Step 5: click Launch, and on the Application page, you will see that Rancher is creating a stack for your new application. The process will take a few minutes.

If the service starts normally, the status of the new stack is displayed as green.

Use advanced Kubernetes options

In the Rancher UI interface, you can access the local Kubernetes dashboard with one click.

You can also execute kubectl from a web browser. Either Kubernetes CLI or kubectl can help you deploy and manage Kubernetes applications. For more information and download kubectl, visit Kubernetes documentation.

In addition, you can create a Kubernetes configuration file to use kubectl on the desktop. The Kubernetes configuration file, or kubeconfig, allows you to configure access to one or more clusters.

How to use advanced kubernets options

Step 1: on the Rancher UI menu, click Containers.

Step 2: select the Advanced tag, and the following advanced options appear:

Launch Dashboard-access the local Kubernetes dashboard in a new browser window

Launch kubectl-use shell to run the kubectl command from the browser, click Close to return to the Rancher UI interface

Download kubeconfig-generate a kubeconfig file to use kubectl on the desktop. Copy and paste the code from the ~ / .kube / config file into the new file, and then run kubectl. Click Close to return to the Rancher UI interface.

That's all for the content of "how to use Rancher2.0". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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