Kubernetes: Services and Ingress

Why a pod has no stable address, the Service and its three types, selector and endpoints, port and targetPort, a Service's DNS name and the Ingress that routes HTTP traffic by host and path.

  • 30 cards
  • 6 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. Sort and link
  4. On the diagram
  5. Scenarios
  6. Understand

A few cards from the deck

  • Service: what is it?

    Show the answer

    An object that gives a group of pods a stable address and DNS name, and spreads traffic across those its selector retains.

    Pods are born and die with new addresses; the Service stays, and clients always aim at the same name.

  • A client pod calls http://web. On which container port does the traffic arrive?

    ```yaml
    apiVersion: v1
    kind: Service
    metadata:
    name: web
    spec:
    selector:
    app: web
    ports:
    - port: 80
    targetPort: 8080
    `

    • 8080
    • 80
    • 30080
    • 443
    Show the answer

    8080

    The URL without a port aims at the Service's port, 80. The Service then redirects to the pods' targetPort: 8080. There is no nodePort here, so nothing on 30080.

  • A Service named db in the namespace data has the full DNS name …; a pod in the same namespace reaches it simply as db.

    Show the answer

    A Service named db in the namespace data has the full DNS name db.data.svc.cluster.local; a pod in the same namespace reaches it simply as db.

    The cluster DNS completes the name with the calling pod's namespace; from another namespace, write db.data.

  • Endpoints: what is it?

    Show the answer

    The list of addresses of the ready pods a Service selects; it is kept up to date automatically.

    If this list is empty (<none>), the Service has nobody to send traffic to: wrong selector, or no ready pod.