A, k8s more advanced design ideas
k8s main idea of setting, from a broader perspective, in a uniform way to define relationships between tasks
1.k8s core function chart
2.k8s global architecture diagram
The metaphor of human micro-services, service management solution is to communicate with people, too many people will need to optimize the living space and communication, which requires clusters and choreography.
compose and swarm can resolve the relationship between minorities, such as the phone number to you, you’ll find me easy, but if the phone number will change when the trouble, many people will be in trouble.
The k8s is standing highly abstract perspective of God, see
What are the overall organization, different organizations have what kind of features (Job, CronJob, Autoscaler, StatefulSet, DaemonSet …)
What may need to exchange between different organizations (ConfigMap, Secret …), this is more closely people are in the same pod, to communicate through Service- does not change the mobile phone number and different organizations,
Help people to quickly build the organization (Deployment, RC).
k8s is to organize and coordinate the management to implement the project on a computer
Second, the feature comparison
1. swarm emphasis is to deploy the vessel, while k8s emphasis on application deployment
swarm smallest unit is a container, and is k8s pod, a pod may be composed of a plurality of containers, and a shared namespace volume within pod, the communication more efficient in the same pod
pod What are the benefits?
For example, a web container, in order to collect web log, a log needs to install the plug if the plug is mounted within a web container:
If the plugin is updated, even if the service does not have to change to re-deploy the image build again
If the plug-in memory leak problem, the entire container will be compromised
The pod can log ins and create a web application each container, the two shared volume, web applications only need to save the log volume, two containers each have their own image, updated independently of each other
2. k8s more than a swarm scheduling policy, it is more suitable for large-scale container management
swarm only three scheduling policies: spread, binpack, random, and the number of k8s strategy more and more, there is a port conflict strategies, the container volume mount conflict policy to specify a particular host strategies.
Composer, a link by associating the container, as DB connection environment variables for the write process if DB is changed (e.g., mirrored)
Nodes in the cluster, as long as within the same network, service between
3. k8s load balancing mechanism more flexible than the swarm
swarm uses nginx + consul.
consul holds network information of each docker applied in, nginx, designated consul address in dockerfile at the time Compose, arranged to nginx configuration, thereby achieving load balancing, this has the disadvantage that the newly added container IP and the network need to be manually Add to nginx file
The k8s achieve load balancing service, no vessel IP change issue, the same label as long as the pod can be accessed through the service, the newly added container IP network and does not affect the load balancer
4.k8s support elastically stretchable
k8s according to the number of the CPU, memory Pod automatic adjustment of the Pod, to guarantee the availability of service, are not provided with such a function Swarm