Skip to main content

Container Storage Interface (CSI)

In the past, Kubernetes only used Docker as a container runtime. All the code to work with Docker was inserted directly into the Kubernetes source code. With the arrival of new container runtimes like RKT and CRI-O, a way to support them without inserting them into the Kubernetes source code was needed.

Therefore, Docker was removed from the Kubernetes source code and a generic interface was created for this purpose called CRI (Container Runtime Interface) so that in the future new runtimes could be added to Kubernetes.

CRI establishes a clear and standardized interface between Kubernetes and container runtimes, allowing Kubernetes to be more flexible and agnostic regarding the underlying runtime.

alt text

Similarly, to support different networks, the Container Network Interface (CNI) was created, which defines the standards for network communication and allows various players to develop solutions for Kubernetes.

The CSI Driver is not exclusive to Kubernetes; it is an interface designed to connect systems that manage containers to external storage drivers. This storage volume integration is applicable in a variety of scenarios, from container orchestrators to isolated execution environments and any other situation where it is necessary to bind external storage to containers.

It simplifies the integration of new storage providers by establishing a standardized interface for volume drivers. This standardization allows various storage providers to develop CSI-compatible plugins, following the standards established by the interface. This promotes greater flexibility of choice for users and facilitates interoperability between different container orchestration systems and storage providers.

alt text

In programming, an interface defines a contract or set of methods that a class or object must implement. It is an abstraction that describes the operations an object can perform, but does not contain the implementation of those operations.

// Interface defines the contract
interface Animal {
void makeSound();
}

// Specific implementation of the interface
class Dog implements Animal {
public void makeSound() {
System.out.println("Woof woof!");
}
}