Menu
Lessons Learned Building Kubernetes Controllers • Dave Cheney • YOW! 2018

Lessons Learned Building Kubernetes Controllers • Dave Cheney • YOW! 2018

GOTO Conferences

207 views 9 months ago Save 46 min 4 min read

Video Summary

The speaker explains Kubernetes as an open-source system for automating containerized application deployment, scaling, and management, acknowledging its perceived complexity. He breaks down Kubernetes into four layers: a replicated data store (like etcd), an API server, controllers and operators that manage state, and a container runtime. The focus then shifts to ingress controllers, which manage external traffic to applications within a Kubernetes cluster, providing services like HTTP/TLS management, load balancing, and reverse proxying.

Ingress controllers offer key benefits such as traffic consolidation to reduce the number of public IPs, simplified TLS management, abstract configuration for web applications, and path-based routing. The speaker introduces Contour as an ingress controller that utilizes Envoy proxy as its data plane, highlighting Envoy's dynamic configuration capabilities as a strong match for Kubernetes' declarative API. Contour acts as a translator, converting Kubernetes REST API information into the format Envoy requires, enabling real-time configuration updates without reloads.

The discussion delves into the software engineering aspects of building Contour. Key points include using Go as the programming language, maintaining a healthy code-to-test ratio (around 1:2.5 for Contour), keeping the main function concise by offloading business logic, and structuring packages effectively by naming them for their functionality. The use of an internal directory for non-exportable code is recommended to prevent unintended dependencies. The talk also covers Go routine management, dependency management using dep, and integrating Docker into the development workflow. Finally, the speaker advocates for optimizing the developer inner loop by avoiding frequent Docker builds and pushes, favoring faster iteration cycles and robust, non-flaky functional testing.

Short Highlights

Kubernetes Architecture Overview [1:52]

  • Kubernetes is described as an open-source system for automating deployment, scaling, and management of containerized applications.
  • The perceived complexity of Kubernetes is a matter of perspective, similar to the underlying complexity of simple devices.
  • Kubernetes can be understood in four layers:
    • Replicated data store: Defaults to etcd; considered a "live hand grenade" for operators due to its stateful nature.
    • API server: Sits on top of the data store, handles authentication, schema validation, CRUD operations, and crucially, "watch" capabilities.
    • Controllers and operators: Watch the API server and strive to match the current state of the world to the desired state in the database. The API server can be modeled as a message bus.
    • Container runtime: The component that actually runs containerized applications, with Docker being a common default.

This breakdown provides a foundational understanding of Kubernetes' core components and their interactions, essential for developers and operators.

"Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications."

Key Details

Ingress Controllers and Their Role [3:56]

  • Ingress controllers are responsible for directing external traffic to applications running inside a Kubernetes cluster.
  • They provide HTTP/TLS management, load balancing, and reverse proxying as a service to internal applications.
  • The design of a good ingress controller aims to handle the common 90% use case, replacing traditional external components like Apache or HAProxy for HTTP middleware tasks.
  • Four key contributions of ingress controllers to Kubernetes are highlighted:
    • Traffic consolidation: Reduces the need for numerous public IPs per application, mitigating rate limits and maintenance overhead. It also centralizes the security audit point for incoming web traffic.
    • TLS management: Essential for modern web security (HTTPS), ingress controllers handle certificate presentation and SNI negotiation.
    • Abstract web application structure: Allows describing application configurations (TLS, HTTP/2, websockets) in a standardized, abstract way, facilitating deployment across different Kubernetes clusters and ingress controllers without rewriting configurations.
    • Path-based routing: Enables routing traffic based on host and path to different services within the cluster, a feature typically handled at the application level when using simpler Layer 4 load balancers.

Ingress controllers streamline and abstract critical networking functions, making Kubernetes applications more accessible and manageable.

"Ingress controllers are responsible from getting the traffic from the outside world down to the applications your containers running inside a Kubernetes cluster."

Other People Also See