With the popularity of big data, cluster and distributed, many company systems are running on clusters, but the young white people who just entered the company or the ordinary students who are preparing to enter the workplace do not have any experience, how to understand clusters? There are many ways: borrow a friend’s computer, open more virtual machines, buy more servers on the cloud platform, buy servers on demand and so on.

The advantages and disadvantages of building a cluster
  1. Borrow a friend’s computer, or open a few more virtual machines, although the difficulty of cluster construction is not high, but it can not be built in minutes, so a long time to occupy a friend’s computer, after all, now everyone has privacy; And open more virtual machines need to ensure that their computer performance to be high enough, otherwise very card; At the same time, both of these schemes are built locally, and there is no way to continue once you leave the office space! In short, the program is thriving, but not flexible enough.
  2. Cloud platforms to buy a few more servers though this scheme is also a kind of feasible solution, but now each big cloud server, in addition to students, the couple specific preferential, are relatively expensive, and students party using core 1 g cloud hosting, compared to 2 nuclear 4 g, 4 nuclear 8 g host in the process of building cluster, often encounter CPU bottleneck, Lack of memory and so on. In short, it works, but it’s expensive.
  3. On-demand cloud server, one of the most “money saving” solutions, now almost all cloud platforms launched this service. The job description for a test engineer reads: Have managed at least 100 servers. Wow, it’s rare for a development, operations, or supervisor to manage 100 servers, let alone testing. Of course not, if not managed hundreds of servers, we can also after the scheme to improve, through on-demand purchase buy dozens or even hundreds of servers, in order to practice some issues, but he is very secretive or fatal weakness, because in a few hours after the practice, the server associated elastic IP, and so on correlation service, some of them are not automatically release, If, like me, you miss an elastic IP, you will see the balance of your account deducted gradually over the next two days.
Having said so much nonsense, I finally want to enter the theme. Based on the advantages and disadvantages mentioned above, THE way I set up K8S cluster is to set up a group through Huawei cloud server under two Huawei cloud accounts.
Why based on two accounts?
  • Those who often pay attention to the cloud should have noticed that major cloud manufacturers often have some special preferential activities, and each account can only enjoy one discount, but occasionally, the same real-name user, registered multiple accounts, each account can enjoy the preferential situation (maybe it is a loophole).
    Build K8S problem:
  1. (Public network) server communication problem, different accounts under the server does not often special Settings, must not be under the same internal network, server communication over the public network, bandwidth is bound to be greatly limited, high latency cluster is meaningless, except special scenarios. In addition, if the K8S cluster is set up through the public network, the traffic from the Intranet to the public network will be forwarded. Therefore, the setting is responsible and error prone.
  2. (Intranet) The servers under different accounts mentioned above must not be in the same LAN, so what to do?
  • Solution 1: If the servers under different accounts are in the same area, the servers under the two accounts can communicate with each other through the Intranet through peer-to-peer connection. (This paper chooses this scheme)
  • Plan two: if the server below different account is in different area, then can the way of virtual private network communication, understood briefly, the price is more expensive!

Precautions for peer connection creation:

  • The official document: support.huaweicloud.com/usermanual-…
  1. For peer connections, the local end and the peer end must be on different network segments

    This article is published by OpenWrite, a blogging tool platform