In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to create a K8S cluster". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to create a K8S cluster.
I. introduction
In China, most CaaS cloud vendors have done the secondary development of Web based on Kubernetes itself to manage the life cycle of containers. In the use of real enterprise Kubernetes, the pain point of customers does not lie in the management of Pod. Just imagine, if there are 20 Kubernetes clusters in your enterprise, how can each cluster achieve unified monitoring, rolling upgrade, dynamic expansion, automatic expansion, fault self-test and recovery, and so on? PKS CC Platfrom not only achieves the above functions, but also makes additional extensions. Our philosophy is: CsaaS, that is, Container Service As A Service.
Second, detailed explanation of the function
In the next step, we will further expand K8S itself, integrate more services into K8S store based on Pivotal Open Service Broker API standard, and leave the life cycle management, monitoring, expansion and fault recovery of these services to the platform itself to complete automatically.
K8S cluster creation:
Generate K8S clusters with one click (the number of K8S clusters is unlimited under the condition of sufficient resources), and the number of Master,Node nodes can be preset. Currently, the maximum number of Master nodes supported is 5 nodes, and the number of Node nodes is unlimited. However, the maximum number of Node for the platform is 40 by default, which can be adjusted by environment variables. The following figure shows how to create a K8S cluster with one click of PKS CC Platfrom. There are 3 Mater nodes and 5 Node nodes. The underlying resources are: Mster is 2vCPU, 4GB memory, 32GB storage, 10GB naked mapping disk (permanent disk). Node is 2cCPU 4GB memory, 32GB storage, 10GB naked mapping disk (permanent disk).
The first step is to give the K8S cluster an alias.
The second step is to select the preset node specifications of the K8S cluster, including the number of K8S Master, resources and so on.
The third step is to initialize the number of K8S Node nodes. The default maximum number here is 40, which can be adjusted by environment variables.
The fourth step is to select the user to which K8S belongs. The user concept will be explained later. When all is completed, click submit, and the backend will automatically generate the K8S cluster of the selected specifications.
The underlying resources are dynamically acquired according to the Plan threshold, which is changeable, that is to say, the resource definition of K8S cluster is variable. Currently supported virtual machine resource thresholds and permanent disk thresholds are as follows: this feature will be demonstrated later.
K8S cluster expansion:
PKS CC Platfrom supports one-click expansion or upgrade of K8S cluster version. Here, expansion refers to the expansion or reduction of the number of K8SNode nodes, and the expansion and reduction of underlying resources will be demonstrated later. PKS CC Platfrom cluster expansion and upgrade operations are all in Canary mode, and business will not be interrupted in the process of capacity expansion and upgrade (excluding single-node clusters). The following figure shows the expansion operation of the jy-k8s-clusters cluster created in the previous step.
We click "View Cluster", and then select the cluster to be expanded or upgraded. We can see that the number of Node nodes in the current cluster is 5. Here we expand the number of nodes to 7.
After entering the number of nodes to be expanded, click the confirm button, and the backend will automatically expand and shrink the nodes of the K8S cluster. We can see that the last cluster action was as UPDATE, and the status was in progress.
After the cluster Node node expansion is completed successfully, we can click the details button to view the details of the current cluster. Including: K8S version information, Master/Node node corresponding virtual machine details information, and cluster status information and so on.
K8S cluster rolling upgrade:
In the demonstration of cluster expansion, we can see that the version of K8S is 1.15.5. Next, we are upgrading the K8S version of the cluster. During the upgrade process, we can also dynamically expand the underlying resources (storage, CPU, memory) of the virtual machine, and the business continuity will not be affected during all operations.
First of all, let's take a look at the resources of the current Node node virtual machine, and we can see that the K8S version is 1.15.5. Virtual machine memory is 4GB, CPU is 2vCPU, and non-persistent disk is 32GB.
Next, we adjust the virtual machine resources of the Node node. First, we expand the original 2vCPU, 4GB memory, 32GB storage to: 8GB memory, 64GB storage. Click the Save button.
Then we select the previous jy-k8s-clusters cluster, check "I just want to upgrade this cluster version", and then click OK. After the cluster upgrade and resource expansion are completed, we check the previous Node node information again. (here, the name of the virtual machine changes each time you upgrade or expand the underlying resources, but the IP address and instance name will never change). The version of K8S has been upgraded from 1.15.5 to 1.16.7, the underlying resources of virtual machines have been automatically extended, and the types of virtual machines have been extended from medium.disk to large.disk.
Delete K8S cluster with one click:
Since the previous jy-k8s-clusters cluster is in the process of rolling upgrade and requires a long waiting time, I use another set of cluster-for-upgrade clusters to demonstrate the cluster deletion function. We select the cluster-for-upgrade cluster and click the delete button. In this case, the underlying IaaS will automatically delete the selected K8S cluster through the CPI API.
Click the confirm button to see that the cluster status changes to DELETE, and the underlying IaaS will also delete the clustered virtual machine.
Click on the cluster-for-upgrade cluster details and you can see that the K8S version is still 1.15.5 because the cluster is not upgraded. In the IaaS task on the right, you can see that the resources of this cluster have been reclaimed by the system.
Download and connect the cluster log to K8S virtual machine function:
Click the details of the jy-k8s-clusters cluster, click the log download button below, and the system will automatically collect all the log information of the current K8S node, including Waring, Error, DeBug, Info and other information, and package all the information. The main purpose of connecting the K8S virtual function is to reduce the requirements of the operators for the use of BOSH tools. By clicking on a K8S instance, you can remotely access the virtual machine of the K8S node through the Web window.
First, click on the log download function of two Mater nodes and a Node node, and the backend begins to collect logs and package them.
Under the cluster details, you can view the node log we downloaded and download it.
Click any log to download locally, and after the decompression is complete, you can view the detailed log information including each K8S component.
Connecting the K8S virtual machine through Web is more convenient and fast, and can greatly reduce the difficulty for operators to use the underlying tool commands. Take the Master node as an example, click on the Master node instance, which will automatically open the WEB Terminal and connect to the corresponding virtual machine. K8S cluster adopts process-level monitoring, any failure of K8S components, the system can automatically detect and pull up the corresponding services to ensure the robustness and reliability of K8S.
Cluster user management functions:
We click on cluster user management. The concept of cluster users has been mentioned before. For details here, cluster users can manage K8S. For example, A users can create up to 3 K8S clusters, and the total memory 200GB and total CPU80 of K8S clusters can be created. Or user A can only manage the three K8S clusters 1, 2 and 3, and have no administrative rights to other clusters. It can also be that user A can only obtain a series of functions and restrictions such as kubeconfig, network configuration, kube-profile and so on.
In the figure above, we can see that each user has three permissions, and the restrictions of these three permissions are as follows:
The operations performed by pks.clusters.adminpks.clusters.managepks.clusters.admin.read to create, update, resize and delete clusters are. You can create, modify, and delete all clusters. Yes. You can only create, modify and delete your own clusters. No. Unable to create, modify, and delete clusters. To get the cluster credentials is. You can retrieve cluster credentials for all clusters. Yes. You can only retrieve the cluster credentials of its own cluster. No. Unable to retrieve cluster credentials. Upgrade the cluster is. All clusters can be upgraded. Yes. You can only upgrade your own cluster. No. Unable to upgrade the cluster. The list of clusters is. All clusters can be listed. Yes. You can only list your own clusters. Yes. All clusters can be listed. View the cluster details yes. You can view the cluster details of all clusters. Yes. You can only view the cluster details of your own cluster. Yes. You can view the cluster details of all clusters. Create and delete calculation profiles are. You can create and delete calculation profiles. No. Unable to create and delete calculation profiles. No. Unable to create and delete calculation profiles. Create and delete network profiles are. You can create and delete network profiles. No. Unable to create and delete network profiles. No. Unable to create and delete network profiles. Create and delete Kubernetes profiles are. You can add, delete or modify all Kubernetes configuration files. Yes. You can only add, delete or change your own Kubernetes configuration file. No. Unable to create and delete Kubernetes profile. Create, update and delete quotas are. You can create, update and delete quotas. No. Unable to create, update, and delete quotas. No. Unable to create, update, and delete quotas. List the PKS Plan information is. You can list all available plans. Yes. You can list all available plans. Yes. You can list all available plans.
After you create a new user and assign permissions, you can view the cluster details and the above feature operations owned by the current user in the list.
Cluster alarm and early warning function:
When a node in K8S is shut down or a fault that cannot be repaired by process monitoring occurs, PKS CC Platfrom can achieve real-time monitoring and alarm, and can set mailbox or SMS to notify the platform administrator, so the function needs to consume a certain amount of performance and needs to be turned on manually.
Here I close a node, simulate the failure of K8S, and turn on the monitoring function, you can see that the platform has monitored the failed virtual machine node and called the police. When there is an irreparable failure in the PKS platform, the way of automatic recovery is also very simple. The platform will automatically remove this node, create a new virtual machine node, and rejoin the K8S cluster to achieve a high degree of automatic operation and maintenance of the platform.
We took a look at the cluster alarm and monitored this exception, and we also received an alarm message from the failed node in the email.
III. Brief introduction of other functions
In addition to the above functions, PKS CC Platform also provides the following functions: personal information management, PKS CC Platform user management, RBAC-based role authority authentication, temporary leave mode, K8S operation log, PKS CC Platform operation log and so on. The following is an introduction to role authentication based on RBAC. This feature can create roles and assign role permissions to corresponding users, which is more flexible in permission control.
Assign permissions to the newly created role.
Assign the appropriate role to the user.
At this point, I believe you have a deeper understanding of "how to create a K8S cluster". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.