Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/k8spatterns/examples

Examples for "Kubernetes Patterns - Reusable Elements for Designing Cloud Native Applications", Second Edition
https://github.com/k8spatterns/examples

Last synced: 7 days ago
JSON representation

Examples for "Kubernetes Patterns - Reusable Elements for Designing Cloud Native Applications", Second Edition

Awesome Lists containing this project

README

        

//pass:[Creative Commons License]
pass:[Kubernetes Patterns]

= Kubernetes Patterns - Examples

image:https://i.creativecommons.org/l/by/4.0/88x31.png[Creative Commons License, role="right", link="https://creativecommons.orgs/licenses/by/4.0/"]
image:https://github.com/k8spatterns/examples/actions/workflows/check_links.yml/badge.svg["Link Check", role="right", link="https://github.com/k8spatterns/examples/actions/workflows/check_links.yml"]

This GitHub project contains the examples from _Kubernetes Patterns - Reusable Elements for Designing Cloud Native Applications, Second Edition_ https://www.amazon.com/_/dp/1098131681?tag=oreilly20-20[book] by https://github.com/bibryam[Bilgin Ibryam] and https://hachyderm.io/@ro14nd[Roland Huß]

IMPORTANT: Most of the examples have been updated for this second edition of the book and examples have been added for the new chapters. However, we are not fully finished yet with updating everything. You can follow the status on the https://github.com/orgs/k8spatterns/projects/2[example roadmap]. We expect to be finished at the end of May 2023. Every pattern that has not yet been updated is listed below with an **[*]**. Thanks for your patience, and we hope you enjoy the book!

NOTE: All the examples that we have updated have been checked on minikube or kind with Kubernetes 1.26. If you run in any issues, please open a https://github.com/k8spatterns/examples/issues[issue] on this repository, we will take as soon as possible.

Installation instructions for the example prerequisites are summarized in link:INSTALL.adoc[INSTALL].
By default, you need access to a vanilla Kubernetes installation, like Minikube.
However, if add-ons are required, the example description explains this additional requirement.

All of these examples have been tested on Minikube on a macOS with ARM architecture (M1), but they should work on any Kubernetes installation. Be sure to explore the provided example resources, as they contain a wealth of comments and clarifications about the concepts explained in each pattern.

For feedback, issues, or questions in general, please use the https://github.com/bibryam/k8spatterns/issues[issue tracker] to open cases.
Also, we love contributions like spelling fixes, bug fixes, and improvements;... Please open pull requests; we are happy to review them!

== Patterns

All examples are categorized according to the Book's patterns category.
Each example is contained in a different directory per pattern and is self-contained. footnote:[Examples marked with an "*" are still in progress to be updated.]

=== Foundational Patterns

link:foundational/PredictableDemands/README.adoc[Predictable Demands]::
Explore our sample random generator with strict requirements on ConfigMap and PersistentVolumeClaims as well as resource limits.
link:foundational/DeclarativeDeployment/README.adoc[Declarative Deployment]::
Learn about rolling and fixed updates for the random generator Deployment from version 1.0 to 2.0.
link:foundational/HealthProbe/README.adoc[Health Probe]::
Discover Liveness, Readiness, and Startup probes for the random generator, along with an example of using readiness gates.
link:foundational/ManagedLifecycle/README.adoc[Managed Lifecycle]::
Examine the implementation of `postStart` and `preStop` hooks for the random generator application.
link:foundational/AutomatedPlacement/README.adoc[Automated Placement]::
Dive into examples demonstrating node selector, pod and node affinity, taints, and tolerations.

=== Behavioral Patterns

link:behavioral/BatchJob/README.adoc[Batch Job]::
Create thousands of random numbers in a file using a batch job.
link:behavioral/PeriodicJob/README.adoc[Periodic Job]::
Employ the link:behavioral/BatchJob/README.adoc[Batch Job] example to run periodic jobs according to a predefined schedule.
link:behavioral/DaemonService/README.adoc[Daemon Service]::
Investigate a sample maintenance script for executing maintenance tasks on every node in a cluster.
link:behavioral/SingletonService/README.adoc[Singleton Service]::
Delve into a PodDisruptionBudget example for managing voluntary disruptions.
link:behavioral/StatelessService/README.adoc[Stateless Service]::
Examine a stateless service deployed with a ReplicaSet.
link:behavioral/StatefulService/README.adoc[Stateful Service]::
Explore a StatefulSet example featuring our random-generator.
link:behavioral/ServiceDiscovery/README.adoc[Service Discovery]::
Uncover various ways to access our random-generator REST service.
link:behavioral/SelfAwareness/README.adoc[Self Awareness]::
Utilize the Downward API to set environment variables and mount resource fields as files within the random-generator service.

=== Structural Patterns

link:structural/InitContainer/README.adoc[Init Container]::
Initialize an HTTP server's HTML source by fetching it from a remote git repository.
link:structural/Sidecar/README.adoc[Sidecar]::
Inspect a git polling example implemented as a sidecar.
link:structural/Adapter/README.adoc[Adapter]::
Examine an adapter that exports timing information from the sample random-generator application in a Prometheus-compatible format.
link:structural/Ambassador/README.adoc[Ambassador]::
Investigate an ambassador for processing the log of the random-generator.

=== Configuration Patterns

link:configuration/EnvVarConfiguration/README.adoc[EnvVar Configuration]::
Learn how to use environment variables, both literal and sourced from ConfigMaps and Secrets, for our random-generator service.
link:configuration/ConfigurationResource/README.adoc[Configuration Resource]::
Discover how to configure the random-generator Spring Boot application using a ConfigMap.
link:configuration/ImmutableConfiguration/README.adoc[Immutable Configuration]::
Review examples that demonstrate using immutable configuration containers for application configuration in Docker and Kubernetes.
link:configuration/ConfigurationTemplate/README.adoc[Configuration Template]::
See how a template configuration `standalone.xml` is processed using a template processor and filled with data from ConfigMap before starting a Wildfly server.

=== Security Patterns

link:security/ProcessContainment/README.adoc[Process Containment]::
Explore how to restrict container privileges when running in Kubernetes.
link:security/NetworkSegmentation/README.adoc[Network Segmentation]::
Learn how to limit network access to Pods using Network Policies and control HTTP traffic with Istio's Authentication Policies.
link:security/SecureConfiguration/README.adoc[Secure Configuration] **[*]**::
Examine various techniques for securely storing configuration data in a Kubernetes Cluster.
link:security/AccessControl/README.adoc[Access Control] **[*]**::
Discover Kubernetes' RBAC access control subsystem for managing access to the Kubernetes API server.

=== Advanced Patterns

link:advanced/Controller/README.adoc[Controller]::
A simple shell-based controller watches ConfigMap resources for changes and restarts Pods using a label selector provided as an annotation. An additional link:advanced/Controller/expose-controller/README.adoc[example controller] exposes an Ingress route when it detects an `exposeService` label attached to the service.
link:advanced/Operator/README.adoc[Operator]::
Explore an operator based on the ConfigMap watch link:advanced/Controller/README.adoc[controller], introducing a CRD ConfigWatcher that connects a ConfigMap with a set of Pods to restart in case of a config change.
link:advanced/ElasticScale/README.adoc[Elastic Scale] **[*]**::
Investigate horizontal and vertical scaling examples with the random-generator service.
link:advanced/ImageBuilder/README.adoc[Image Builder] **[*]**::
Examine examples demonstrating the setup of a link:advanced/ImageBuilder/openshift/README.adoc[chained build] on OpenShift and using link:advanced/ImageBuilder/knative/README.adoc[Knative build] for performing builds within the cluster.

This work is licensed under a https://creativecommons.org/licenses/by/4.0/[Creative Commons Attribution 4.0 International License]