Kubernetes Patterns: 0. Introduction

This article is talking about the book of Kubernetes Patterns, Reuseable Elements for Designing Cloud-Native Applications by Bilgin Ibryam & Roland Huß.

Kubernetes Patterns: Reusable Elements for Designing Cloud-Native Applications

The Path to Cloud Native

  • Domain-Driven Design — approaches of software design.
  • Microservices architectural style — principles and practices for distributed applications.
  • Containers — as a standard way for packaging and running distributed applications.

Distributed Primitives

Local and Distributed Primitives


Containers are the build blocks for Kubernetes-based cloud native applications. As mentioned above, the container is like a runtime instance but could be place in multiple servers as the runtime instance could be launched in different processes in a single machine.


A Pod is the basic unit in Kubernetes for scheduling and deployment and provides runtime isolation for containers inside it. All the containers in the same Pod share filesystem, networking and process namespaces. Here are some charactoristics of a Pod:

  • A Pod ensure colocation of containers. The containers in the same Pod could communicate to each other via IPC, local filesystem and networking.
  • A Pod has an IP address, name and port range that are shared by all containers belonging to it. Therefore, it should be careful to configure the port number for the containers hosted in the same Pod to avoid port conflicts.


The Service is an Kubernetes abstraction that binds the Service name to an IP address and port number permanently so it represents a named entry point of an application.


A label is mostly like a tag for Kubernetes resources and it could be informational or for query filters. There are some examples for label usage:

  • The scheduler uses labels for colocating or spreading Pods to the proper Nodes.
  • A label can be used for marking some Pods as a logical group.
  • Some informational label can be also used as metadata.


Annotations are similar with informational labels and dedicated for indicating metadata. The biggest difference between annotations and labels is annotations are non-searchable.


Namespace is another important primitive in Kubernetes, which is a logical pool of resources inside a Kubernete cluster. Therefore, a more common use case is to representing difference software environments such as development, testing, integration testing and production. Some other characteristics of namespaces are:

  • A namespace can scope resources, like containers, Pods, Services and ReplicateSets. The name of those resources must be unique within a namespace.
  • Namespaces do NOT isolate the resources physically which means the resources in difference namespaces can access each other.
  • The resources of namespaces themself, Nodes and PersisitentVolumes are NOT scoped by namespaces and they have unique cluster-wide names.
  • Each Kubernetes Service gets a corresponding DNS address containing the namespace, like:

Cloud Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store