当前位置:网站首页>Analysis of kubernetes service types: from concept to practice

Analysis of kubernetes service types: from concept to practice

2020-11-07 20:15:58 InfoQ

stay Kubernetes in , A service always enables its network to access one or a group of Pod On . The service will be selected according to the tag Pod And when networking these services , It will select all services in the cluster selector A match Pod, And choose one of them , Then forward the network request to it .

source :

Kubernetes service vs Deployment

stay K8S How should we distinguish between Deployment And services ?

  • Deployment Mainly responsible for making a group pod Keep running in the cluster
  • Services are mainly responsible for enabling a group of pod Network access

We can use deployment Instead of using services , So we can keep a few of the same Pod stay K8S Running in cluster . Besides ,Deployment We can expand and shrink ,pod You can also copy . stay Kubernetes in , Single pod It can be accessed separately directly through the network request , So track pod There will be some difficulties .

We can also use a service type without having to deployment. If we do that , Will create a single pod, It's not like we're in deployment Create all of them together pod. however , We have another alternative , That is, our services can choose according to the tags assigned to them , To route network requests to these Pod.

How do we discover Kubernetes Service? ?

stay Kubernetes in , There are two ways to discover services :

Link to the original text :【https://www.infoq.cn/article/qCQWaB2ZzcUTc2LqXBpr】. Without the permission of the author , Prohibited reproduced .

版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢