Bitpath

Lesson 1 · Unit 02

Services

A stable name and address over Pods that keep changing.

12 exercisesabout 3 min

What you practise

  • A stable name and address over changing pods, selectors, ClusterIP, NodePort and LoadBalancer, DNS inside the cluster

Try a question from this lesson

Pick one

The web Pods call an api Pod at 10.244.1.7, an IP address written into their config. The api Pod crashes and its ReplicaSet replaces it. What happens to web's calls?

Hint

Recall what a replacement Pod keeps from the Pod it replaces.

The ideas

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

A Service: one name over changing Pods

A Service gives a set of Pods one stable address. It has a virtual IP that never changes while the Service exists, and a DNS name equal to its own name.

Its selector is a label query. Traffic sent to the Service is spread over the Pods that match right now and are ready: a load balancer in front of a list that updates itself.

port is where callers connect. targetPort is where the containers listen.

YAML
apiVersion: v1
kind: Service
metadata:
  name: api
spec:
  selector:
    app: api
  ports:
    - port: 80
      targetPort: 8080

Concept

Three types, each built on the last

ClusterIP (the default): a virtual IP reachable only inside the cluster.

NodePort: all of that, plus the same high port (30000 to 32767 by default) opened on every node. Anything that can reach a node can reach the Service.

LoadBalancer: all of that, plus a request to the cloud provider for an external load balancer with a public address, which forwards to the nodes.

Each type adds an outer door and keeps the inner ones.

LoadBalancer   public IP
  NodePort     every node, port 30080
    ClusterIP  10.96.4.20, inside only
      Pods     app: api

9 more exercises in the app

  • 1× fill the blanks
  • 4× multiple choice
  • 1× match the pairs
  • 1× type the answer
  • 1× true or false
  • 1× order the lines

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy