kubernets之endpoints

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

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2019-05-08T14:51:55Z"
  labels:
    component: apiserver
    provider: kubernetes
  name: kubernetes
  namespace: default
  resourceVersion: "22"
  selfLink: /api/v1/namespaces/default/services/kubernetes
  uid: d29fe6aa-71a0-11e9-9000-3c4a9272da84
spec:
  clusterIP: 10.10.0.1
  ports:
  - name: https
    port: 443
    protocol: TCP
    targetPort: 6443
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}

[root@master01 redis]# kubectl get endpoints kubernetes -o yaml 
apiVersion: v1
kind: Endpoints
metadata:
  creationTimestamp: "2019-05-08T14:51:55Z"
  name: kubernetes
  namespace: default
  resourceVersion: "230793746"
  selfLink: /api/v1/namespaces/default/endpoints/kubernetes
  uid: d2bb5db6-71a0-11e9-9000-3c4a9272da84
subsets:
- addresses:
  - ip: 192.168.6.101
  - ip: 192.168.6.102
  - ip: 192.168.6.103
  ports:
  - name: https
    port: 6443
    protocol: TCP

posted @ 2021-03-10 10:34  ainimore  阅读(156)  评论(0编辑  收藏  举报