官术网_书友最值得收藏!

  • Getting Started with Kubernetes
  • Jonathan Baier Jesse White
  • 402字
  • 2021-06-10 19:47:13

Balanced design

It's important to point out the balance that Kubernetes is trying to achieve by placing the IP at the pod level. Using unique IP addresses at the host level is problematic as the number of containers grows. Ports must be used to expose services on specific containers and allow external communication. In addition to this, the complexity of running multiple services that may or may not know about each other (and their custom ports) and managing the port space becomes a big issue.

However, assigning an IP address to each container can be overkill. In cases of sizable scale, overlay networks and NATs are needed in order to address each container. Overlay networks add latency, and IP addresses would be taken up by backend services as well since they need to communicate with their frontend counterparts.

Here, we really see an advantage in the abstractions that Kubernetes provides at the application and service level. If I have a web server and a database, we can keep them on the same pod and use a single IP address. The web server and database can use the local interface and standard ports to communicate, and no custom setup is required. Furthermore, services on the backend are not needlessly exposed to other application stacks running elsewhere in the cluster (but possibly on the same host). Since the pod sees the same IP address that the applications running within it see, service discovery does not require any additional translation.

If you need the flexibility of an overlay network, you can still use an overlay at the pod level. Weave, Flannel, and Project Calico can be used with Kubernetes as well as a plethora of other plugins and overlays that are available.

This is also very helpful in the context of scheduling the workloads. It is key to have a simple and standard structure for the scheduler to match constraints and understand where space exists on the cluster's network at any given time. This is a dynamic environment with a variety of applications and tasks running, so any additional complexity here will have rippling effects.

There are also implications for service discovery. New services coming online must determine and register an IP address on which the rest of the world, or at least a cluster, can reach them. If NAT is used, the services will need an additional mechanism to learn their externally facing IP.

主站蜘蛛池模板: 丘北县| 富宁县| 六枝特区| 通州市| 德阳市| 綦江县| 彩票| 大冶市| 万载县| 册亨县| 团风县| 营山县| 灵川县| 淮阳县| 玛曲县| 天祝| 内江市| 屏东县| 黄大仙区| 来宾市| 顺昌县| 响水县| 怀安县| 苍梧县| 沙田区| 璧山县| 仪征市| 额尔古纳市| 绥化市| 宁国市| 福州市| 晋中市| 灵山县| 汶上县| 中西区| 白水县| 忻城县| 汾阳市| 松桃| 外汇| 通榆县|