BLERG Kubernetes simulation: System-wide protocols

Kubernetes runs on protocols. This post describes the protocols, without enumerating the components that will actually implement them.

This works on top of the infrastructure defined in the last post.

This is system-wide protocols. When components are defined, additional intra-component protocols will be defined.

BLERG But these aren’t protocols, exactly. Need a better word.

Control plane API

The simulation will provide an endpoint at port 6443, the same port used for Kubernetes. This endpoint will process requests, which might include YAML manifests.

This API will mirror the outlines of the Kubernetes API, though it will be far smaller and simpler. The specific requests and their format will be defined as the detailed simulation is created.

Service discovery and routing and load balancing

Kubernetes specifies multiple protocols for service discovery and networking, used to define Services. Services can be of four types: NodePort, ClusterIP, LoadBalancer, and ExternalName. Kubernetes ExternalName Services will not be simulated, while the other three will be.

I will first describe the general infrastructure for all three service types and then go into their specifics.

Basic service discovery and routing

Kubernetes implements its service discovery and routing algorithms by defining rules in the kernel of each Node’s operating system. Services are represented by distinct IP addresses. When an addition or deletion of a Service Endpoint is detected, its IP address is broadcast to every Node, who then modify their kernel tables.

Load balancing is implemented in the Node operating system tables, selecting an Endpoint IP for each request to connect to a Service. The IP might be chosen by any number of algorithms, such as round-robin, random, or other approaches.

Note that even though Kubernetes detects crashes by an Endpoint and removes them from each Node’s list, Service implementations must still be prepared for connections to fail, whether due to overly long response times or crashes that have not yet been detected by Kubernetes.

ClusterIP:

In the simulation, when a ClusterIP Service is created, a unique ic number will be selected from the available entries. This value will be associated with the service name (for use in DNS lookup) and with an initially empty list of the ic numbers of Pods serving as EndPoints. An NodePort will also be allocated.

NodePort:

In the simulation, when an NodePort Service is created, a unique pc number will be selected from the available entries. This value will be associated with the service name (for use in DNS lookup) and with an initially empty list of the ic numbers of Pods serving as EndPoints.

BLERG also creates a ClusterIP. So ClusterIP is the basis.

LoadBalancer:

Calls another service to set up external LoadBalancer.

The second form of

  1. IPAM: In the Container Network Interface (CNI), the IPAM plugin is used to allocate available IP addresses. The simulation will run this as a separate process, responsible for allocating and deallocating the ic value of external port numbers. The process’s data structures will be persistently stored, so that a simulation can be shutdown and restarted, with its configuration intact.

    The IPAM simulator will support the following operations;

    1. Allocate an ic value: Select any available ic value and mark it as allocated and return the value to the caller.
    2. Release an ic value: Mark an ic component as unallocated.
  2. Node Port allocator: BLERG for NodePorts. Do we support NodePorts? If we make service ports cluster-unique, then we can use them as NodePorts as well. Note that given port value can be a service port when combined with the ic for the Service but a NodePort when combined with a Node ic.

    • Start the IP address (IP component) allocator, IPAM.

Container image distribution

Running containers