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 create a custom k8s cluster by rancher

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

Share

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

This article mainly introduces "how to create a custom k8s cluster by rancher". In daily operation, I believe many people have doubts about how to create a custom k8s cluster by rancher. The editor has consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful to answer the doubts about "how to create a custom k8s cluster by rancher". Next, please follow the editor to study!

Rancher creates a custom kubernetes cluster, which is suitable for CVMs with internal virtual machines, internal CPMs, or CVMs that do not provide kubernetes cloud services. You can quickly install kubernetes clusters through custom installation methods.

Host and port requirements

Visit https://docs.rancher.cn/docs/rancher2/installation_new/requirements/_index/ for specific information about the underlying environment hardware configuration and port requirements.

Add Cluster

Enter the global / cluster view, and then click add Cluster

Select Custom

Set cluster name

Members and roles

The cluster member corresponds to a real user in Rancher, and the role represents the cluster permissions that this user has. To add members and corresponding member roles when creating a cluster, you need to first add users and cluster roles globally.

Cluster option

Kubernetes version

Each Rancher distribution corresponds to a different kubernetes version, which can be selected according to your needs.

Network component

Currently, Rancher supports three network components: flannel, calico, and canal. Canal supports project-based network isolation, and you can choose whether to enable it according to international needs. Flannel supports Windows (experimental phase).

Cloud provider

Select the corresponding cloud provider according to the cloud platform to which the host belongs. By selecting the corresponding cloud provider, you can connect some infrastructure on the public cloud, which is better than layer 4 load balancing and storage.

Show advanced options

You can see the Advanced options button in the lower right corner of the cluster options page

Private mirror warehouse

There is a default private repository in the global system settings, which is global. If set up, any cluster installed will pull the image from that repository. This private image repository is cluster-level and only works on the currently created cluster.

Authorized cluster access address

K8s communicates authentication through ssl, and the ssl certificate needs to be bound to the domain name when it is generated. Therefore, when creating the cluster, set an access address for the K8S cluster in advance, and when the Rancher Server cannot be accessed, you can connect to this address through kubectl to manage the K8S cluster.

Advanced clustering options

Nginx Ingress

Nginx Ingress,v2.0.7 is supported by default in Rancher. It is enabled by default depending on whether the custom is enabled.

NodePort Port ran

When using NodePort network mode, the host port mapped by Pod. Default is 30000-32767.

Metrics service monitoring

For service monitoring metrics, v2.0.7 will be enabled by default depending on whether the custom is enabled.

Pod security policy

Choose to enable or disable it according to your needs. If you want to enable it, you need to create a policy in the Pod security policy. It is prohibited by default.

Host Docker version

In the current version, there are three versions of Docker that have been strictly tested: 18.06.x, 18.09.x and 19.03.x. If it is set to the version that needs to be supported, the Docker version of the host needs to be one of the three versions. If the version is inconsistent, the K8S cluster cannot be installed. The default setting allows unsupported versions, and it is recommended that you select a supported version for the production environment.

Docker root directory

If the docker root directory is not the default, specify it here

ETCD backup Stora

You can choose the ETCD backup storage path, which is local by default, or you can store it to S3 storage

ETCD backup rotation

When ETCD backup rotation is enabled, ETCD backup copy data and snapshot creation cycle will be controlled

Finally, click next.

Custom host run command

Host role

In the architecture of K8S, there must be at least one etcd, Control, and Worker, and three roles can run on the same host. To ensure the high availability of the cluster, you need to ensure that there are multiple etcd and Control instances and running on different hosts. Because of the etcd data synchronization mechanism, the number of etcd nodes needs to be odd, such as 1, 3, 5. Check the etcd cluster fault tolerance table. So to ensure that ETCD is highly available to run, you need at least three nodes to run etcd services.

Advanced option

In the advanced options, you can specify the IP address of the node. You can ignore this setting for a single IP host in a private network environment; if it is a multi-IP host, use this setting to specify the host's access IP.

Host label

Tags can be used for host identification and application scheduling, and can be specified when nodes are added.

Assuming that there is currently only one host, you can choose in the following ways:

Finally, click the copy button on the right.

Ssh logs in to the node you are going to add to the K8S cluster, pastes and runs the command you copied in the previous step.

Finally, click finish.

At this point, the study on "how to create a custom k8s cluster by rancher" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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