7.Service.md 642 B

1.service的存在意义

  1. 防止Pod失联(服务发现)--更新Pod的IP
  2. 定义一组pod的访问规则(负载均衡)

    2.Pod和Service关系

    selector app:nginx

lable: app:nginx

service有一个对外暴露的虚拟IP,由endpoint管理 endpoint是k8s集群中的一个资源对象,存储在etcd中,用来记录一个service对应的所有pod的访问地址。service配置selector,endpoint controller才会自动创建对应的endpoint对象;否则,不会生成endpoint对象.

3.service类型

  1. clusterIP:集群内部使用
  2. NodePort:对外暴露使用
  3. LoadBalancer:对外访问使用,公有云