404 Not Found
  • Introduction
  • Monitoring related
    • K8s cluster monitoring
    • Monitor Jenkins with G.A.P on K8s cluster
    • Monitoring tools | projects
      • Grafana
      • AlertManager
      • Prometheus
      • Wavefront
  • Logging related
    • BOSH logs
    • How to gather systemd log
    • K8s cluster logging
    • Logging tools | projects
      • vRealize Log Insight
      • Fluentd
      • syslog vs fluentd
  • Having fun with docker
    • Using docker-compose for redmine
    • Customize Fluentd docker image
  • K8S or Apache Mesos
  • K8S Related
    • Main Architecture
      • Master components
        • API Server
        • etcd
        • Controller Manager
        • Kube Scheduler
      • Worker components
        • kubelet
        • kube-proxy
    • K8S Storage
      • Volume Provisioning
      • Understand CSI
      • How to write CSI
      • VMware CNS
      • K8S storage e2e experiment under VMware vSphere
      • Experiment on Persistent Volume Access Mode
      • Design: Storage in Cluster-API architecture
    • K8S Networking
      • Ingress
      • Endpoints
    • K8S Policies
      • Resource Quotas
    • K8S Management Platform
    • K8S Tests Tool
    • K8S Extension
      • CRDs
        • Custom Resources
        • Custom Controllers
        • How to user code-generator
        • K8S Operators
        • Operators Development Tools
          • Kubebuilder
          • Metacontroller
          • Operator SDK
      • Custom API Server
    • K8S Resource CRUD Workflow
    • K8S Garbage Collection
  • K8S CONTROLLER RELATED
    • IsController: true
    • Controller clients
  • PKS RELATED
    • How to Access VMs and Databases related to PKS
    • PKS Basics
    • BOSH Director
    • Backup and Restore on Ent. PKS with Velero
  • CICD RELATED
    • Configure Jenkins to run on K8S
    • Customize Jenkins JNLP slave image
    • Jenkins global shared libs
  • Google Anthos
    • Google Anthos Day from KubeCon 2019 San Diego
    • Migrate for Anthos
    • Config Connector
  • SYSTEM DESIGN RELATED
    • Design Data Intensive Application - Notes
      • RSM
        • Reliability
        • Scalability
      • Data models and Query Languages
      • Storage and Retrieval
    • How Alibaba Ensure K8S Performance At Large Scale
  • Miscellaneous
    • Knative
    • Serverless
    • Service Mesh
    • gRPC
    • Local persistent volumes
    • ownerReferences in K8S
    • File(NAS) vs Block(SAN) vs Object storage
    • KubeVirt
    • Why K8S HA chooses 3 instead of 5..6..7 as the size of masters?
    • goroutine & go channel
    • How to make docker images smaller
Powered by GitBook
On this page

Was this helpful?

  1. K8S Related
  2. K8S Networking

Endpoints

What is Endpoints in K8S

When we create a service in K8S, a Endpoint object is also created with the same name as the service. Service knows how to send traffic to corresponding Pods. This is done by a mapping within the Endpoint object.

Lets take a look at some examples

  • A wordpress service

    kubectl get svc -n wordpress-ns
    NAME              TYPE           CLUSTER-IP       EXTERNAL-IP                    PORT(S)        AGE
    wordpress         LoadBalancer   10.100.200.174   100.64.144.7,192.168.160.115   80:31895/TCP   3d23h
  • wordpress pods

    kubectl get pods -n wordpress-ns -o wide
    NAME                               READY   STATUS    RESTARTS   AGE     IP         NODE                                   NOMINATED NODE   READINESS GATES
    wordpress-dccb8668f-5dfjc          1/1     Running   0          24m     40.0.4.3   244dee94-bfa7-4413-9135-34f902040d7e   <none>           <none>
    wordpress-dccb8668f-ntbm8          1/1     Running   0          3d23h   40.0.4.4   9aeea30f-f08b-47b3-b7aa-ef45f3e800b0   <none>           <none>
  • wordpress endpoints

    kubectl get endpoints -n wordpress-ns
    NAME              ENDPOINTS                 AGE
    wordpress         40.0.4.3:80,40.0.4.4:80   3d23h
    kubectl get endpoints wordpress -n wordpress-ns -o yaml
    apiVersion: v1
    kind: Endpoints
    metadata:
      creationTimestamp: "2020-03-11T23:07:17Z"
      labels:
        app: wordpress
      name: wordpress
      namespace: wordpress-ns
      resourceVersion: "30785441"
      selfLink: /api/v1/namespaces/wordpress-ns/endpoints/wordpress
      uid: 0daa2245-63ed-11ea-bd75-005056a6497c
    subsets:
    - addresses:
      - ip: 40.0.4.3
        nodeName: 244dee94-bfa7-4413-9135-34f902040d7e
        targetRef:
          kind: Pod
          name: wordpress-dccb8668f-5dfjc
          namespace: wordpress-ns
          resourceVersion: "30785439"
          uid: edf43dd1-6708-11ea-bd75-005056a6497c
      - ip: 40.0.4.4
        nodeName: 9aeea30f-f08b-47b3-b7aa-ef45f3e800b0
        targetRef:
          kind: Pod
          name: wordpress-dccb8668f-ntbm8
          namespace: wordpress-ns
          resourceVersion: "30463686"
          uid: 0db65784-63ed-11ea-bd75-005056a6497c
      ports:
      - port: 80
        protocol: TCP

As we can see, the Endpoints object as the mapping with corresponding Pod IPs which let the service could know where to send the traffics to.

PreviousIngressNextK8S Policies

Last updated 5 years ago

Was this helpful?

We could also edit the Endpoints object to let the service sends traffics to some external services outside of the cluster. See this for more details.

post