generated from layer5io/academy-example
-
Notifications
You must be signed in to change notification settings - Fork 20
New Course Update: Kuberentes Multi Container Pods Course #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Namanv0509
wants to merge
23
commits into
layer5io:master
Choose a base branch
from
Namanv0509:k8s-multi-pods
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
571f870
Kuberentes Multi Container Pods Course
Namanv0509 fcea529
Merge branch 'master' into k8s-multi-pods
leecalcote 29fd7d2
Merge branch 'master' into k8s-multi-pods
leecalcote 950555c
Merge branch 'master' into k8s-multi-pods
leecalcote fe34821
Merge branch 'master' into k8s-multi-pods
leecalcote 8311c15
Merge branch 'master' into k8s-multi-pods
leecalcote 1ea92cb
Merge branch 'master' into k8s-multi-pods
Namanv0509 a358b8e
Update quiz.md
Namanv0509 f4a0350
Update and rename quiz.md to test.md
Namanv0509 9ce1980
Merge branch 'master' into k8s-multi-pods
Namanv0509 8202147
Update _index.md
Namanv0509 99e8f3f
Update _index.md
Namanv0509 89db310
Update content/learning-paths/11111111-1111-1111-1111-111111111111/ma…
miacycle b56bb00
Update content/learning-paths/11111111-1111-1111-1111-111111111111/ma…
ritzorama 8bbd84a
Update content/learning-paths/11111111-1111-1111-1111-111111111111/ma…
ritzorama e094d8e
Update content/learning-paths/11111111-1111-1111-1111-111111111111/ma…
ritzorama 0f0ab41
Update content/learning-paths/11111111-1111-1111-1111-111111111111/ma…
ritzorama 5af068d
Update content/learning-paths/11111111-1111-1111-1111-111111111111/ma…
ritzorama 191c83c
Update content/learning-paths/11111111-1111-1111-1111-111111111111/ma…
ritzorama 8150bf1
Update content/learning-paths/11111111-1111-1111-1111-111111111111/ma…
winkletinkle 1b5fef8
Merge branch 'master' into k8s-multi-pods
Namanv0509 2e7c695
Merge branch 'master' into k8s-multi-pods
vr-varad d3d88d5
Merge branch 'master' into k8s-multi-pods
Namanv0509 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...11/mastering-kubernetes-for-engineers/kubernetes-multi-container-pods/_index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
type: "course" | ||
title: "Kubernetes Multi-Container Pods" | ||
description: "Learn how to design and deploy multi-container Pods in Kubernetes using patterns like sidecars, ambassadors, and adapters to extend application functionality and share resources effectively." | ||
weight: 5 | ||
banner: "images/kubernetes-icon.svg" | ||
tags: [kubernetes, containers] | ||
categories: "kubernetes" | ||
level: "beginner" | ||
--- | ||
|
||
A course to help you design and deploy multi-container Pods in Kubernetes using sidecar, ambassador, and adapter patterns for shared resources and extended functionality. | ||
|
11 changes: 11 additions & 0 deletions
11
...g-kubernetes-for-engineers/kubernetes-multi-container-pods/conclusion/_index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
type: "module" | ||
id: "conclusion" | ||
description: "" | ||
title: "Conlusion" | ||
weight: 6 | ||
--- | ||
|
||
# Conclusions | ||
miacycle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
While sidecar patterns offer great flexibility, they're not a silver bullet. Each added sidecar introduces complexity, consumes resources, and potentially increases operational overhead. Always evaluate simpler alternatives first. The key is strategic implementation: use sidecars as precision tools to solve specific architectural challenges, not as a default approach. When used correctly, they can improve security, networking, and configuration management in containerized environments. Choose wisely, implement carefully, and let your sidecars elevate your container ecosystem. |
49 changes: 49 additions & 0 deletions
49
...rs/kubernetes-multi-container-pods/essential-multi-container-patterns/_index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
type: "module" | ||
id: "essential-multi-container-patterns" | ||
description: "" | ||
title: "Essential Multi-Container Patterns" | ||
weight: 5 | ||
--- | ||
|
||
# Essential Multi-Container Patterns | ||
|
||
Directions: To expand a category and view its details, select the plus (+) icon next to the category name. | ||
|
||
### Init container pattern | ||
|
||
The Init container pattern is used to execute (often critical) setup tasks before the main application container starts. Unlike regular containers, init containers run to completion and then terminate, ensuring that preconditions for the main application are met. It is ideal for: | ||
|
||
- Preparing configurations | ||
- Loading secrets | ||
- Verifying dependency availability | ||
- Running database migrations | ||
|
||
The init container ensures your application starts in a predictable, controlled environment without code modifications | ||
|
||
### Ambassador pattern | ||
|
||
An ambassador container provides Pod-local helper services that expose a simple way to access a network service. Typically, ambassador containers send network requests on behalf of an application container and handle challenges such as service discovery, peer identity verification, or encryption in transit. It is ideal when you need to: | ||
|
||
- Offload client connectivity concerns | ||
- Implement language-agnostic networking features | ||
- Add security layers like TLS | ||
- Create robust circuit breakers and retry mechanisms | ||
|
||
### Configuration helper | ||
|
||
A configuration helper sidecar dynamically provides configuration updates to an application, ensuring it always has access to the latest settings without disrupting the service. Often, the helper needs to provide an initial configuration before the application can start successfully. Use cases: | ||
|
||
1. Fetching environment variables and secrets | ||
2. Polling configuration changes | ||
3. Decoupling configuration management from application logic | ||
|
||
### Adapter pattern | ||
|
||
An adapter (or sometimes façade) container enables interoperability between the main application container and external services. It does this by translating data formats, protocols, or APIs. It is ideal for: | ||
|
||
1. Transforming legacy data formats | ||
2. Bridging communication protocols | ||
3. Facilitating integration between mismatched services | ||
|
||
|
24 changes: 24 additions & 0 deletions
24
...r-engineers/kubernetes-multi-container-pods/kubernetes-implementation/_index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
type: "module" | ||
id: "ubernetes-implementation" | ||
description: "" | ||
title: "Kubernetes Implementation" | ||
weight: 3 | ||
--- | ||
|
||
In Kubernetes, [sidecar containers](https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/) operate within the same Pod as the main application, enabling communication and resource sharing. Does this sound just like defining multiple containers along each other inside the Pod? It does, and this is how sidecar containers had to be implemented before Kubernetes v1.29.0, which introduced native support for sidecars. Sidecar containers can now be defined within a Pod manifest using the spec.initContainers field. What makes it a sidecar container is that you specify it with restartPolicy: Always. | ||
|
||
You can see an example of this below, which is a partial snippet of the full Kubernetes manifest: | ||
|
||
```yaml | ||
initContainers: | ||
- name: logshipper | ||
image: alpine:latest | ||
restartPolicy: Always | ||
command: ['sh', '-c', 'tail -F /opt/logs.txt'] | ||
volumeMounts: | ||
- name: data | ||
mountPath: /opt | ||
``` | ||
|
||
That field name, spec.initContainers may sound confusing. Why is it necessary to include an entry in the spec.initContainers array when defining a sidecar container? spec.initContainers are run to completion just before the main application starts, so they’re one-off. In contrast, sidecars often run in parallel to the main app container. It’s the spec.initContainers with restartPolicy:Always which differentiates classic [init containers](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) from Kubernetes-native sidecar containers and ensures they are always up. |
13 changes: 13 additions & 0 deletions
13
...ing-kubernetes-for-engineers/kubernetes-multi-container-pods/overview/_index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
type: "module" | ||
id: "overview" | ||
description: "" | ||
title: "Overview" | ||
weight: 1 | ||
--- | ||
|
||
|
||
As cloud native architectures continue to evolve, Kubernetes has become the go-to platform for deploying complex, distributed systems. One of the most powerful yet nuanced design patterns in this ecosystem is the sidecar pattern. This technique enables developers to extend application functionality without requiring in-depth knowledge of the source code. | ||
|
||
|
||
The microcourse provides an overview of multi-container Pods in Kubernetes, explaining how they enable closely coupled containers to share resources, such as storage and networking, within a single deployment unit. It highlights common patterns—such as sidecars, ambassadors, and adapters—and offers guidance on when and how to use multi-container Pods effectively in real-world applications. |
53 changes: 53 additions & 0 deletions
53
...1111/mastering-kubernetes-for-engineers/kubernetes-multi-container-pods/test.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: "Test" | ||
passing_percentage: 70 | ||
questions: | ||
- id: "q1" | ||
text: "What is one kye benefit of using multi-container Pods in Kubernetes ?" | ||
ritzorama marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type: "single-answer" | ||
marks: 2 | ||
options: | ||
- id: "a" | ||
text: "Improved logging for cluster nodes" | ||
- id: "b" | ||
text: "Shared storage and networking between containers" | ||
is_correct: true | ||
- id: "c" | ||
text: "Increased number of Pods per node" | ||
- id: "d" | ||
text: "Guaranteed low CPU usage" | ||
|
||
- id: "q2" | ||
text: "What is a sidecar container commonly used for" | ||
type: "single-answer" | ||
marks: 2 | ||
options: | ||
- id: "a" | ||
text: "Monitoring and logging support for the main container" | ||
is_correct: true | ||
- id: "b" | ||
text: "Managing RBAC roles" | ||
- id: "c" | ||
text: "Scheduling other Pods" | ||
- id: "d" | ||
text: "Limiting memory acccess" | ||
|
||
|
||
- id: "q3" | ||
text: "What should multi-container Pods be used cautiously" | ||
ritzorama marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type: "single-answer" | ||
marks: 2 | ||
options: | ||
- id: "a" | ||
text: "They always require manual scaling" | ||
ritzorama marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- id: "b" | ||
text: "They are not supported on managed Kuberenetes services" | ||
ritzorama marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- id: "c" | ||
text: "They can introduce complexity, latency, and tight coupling" | ||
winkletinkle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
is_correct: true | ||
- id: "d" | ||
text: "They use different network policies than single-container Pods" | ||
ritzorama marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
layout: "test" | ||
ritzorama marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type: "test" | ||
--- |
14 changes: 14 additions & 0 deletions
14
...rs/kubernetes-multi-container-pods/the-origins-of-the-sidecar-pattern/_index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
type: "module" | ||
id: "the-origins-of-the-sidecar-pattern" | ||
description: "" | ||
title: "The Origins of the Sidecar Pattern" | ||
weight: 2 | ||
--- | ||
|
||
Think of a sidecar like a trusty companion motorcycle attachment. Historically, IT infrastructures have always used auxiliary services to handle critical tasks. | ||
|
||
Before containers, we relied on background processes and helper daemons to manage logging, monitoring, and networking. The microservices revolution transformed this approach, making sidecars a structured and intentional architectural choice. With the rise of microservices, the sidecar pattern became more clearly defined, allowing developers to offload specific responsibilities from the main service without altering its code. | ||
Service meshes, such as Istio and Linkerd, have popularized sidecar proxies, demonstrating how these companion containers can elegantly handle observability, security, and traffic management in distributed systems. | ||
|
||
 |
Binary file added
BIN
+307 KB
...ernetes-multi-container-pods/the-origins-of-the-sidecar-pattern/stock-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.12 KB
...s/kubernetes-multi-container-pods/when-to-embrace-or-avoid-sidecars/Caution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions
29
...ers/kubernetes-multi-container-pods/when-to-embrace-or-avoid-sidecars/_index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
type: "module" | ||
id: "when-to-embrace-or-avoid-sidecars" | ||
description: "" | ||
title: "When To Embrace (or Avoid) Sidecars" | ||
weight: 4 | ||
--- | ||
|
||
While the sidecar pattern can be helpful in many cases, it is generally not the preferred approach unless the use case justifies it. Adding a sidecar increases complexity, resource consumption, and potential network latency. Instead, simpler alternatives such as built-in libraries or shared infrastructure should be considered first. | ||
|
||
**Directions**: Select each tab below to learn more about when you should use or avoid sidecars. | ||
|
||
### Deploy A Sidecar When | ||
|
||
1. You need to extend application functionality without touching the original code | ||
2. Implementing cross-cutting concerns like logging, monitoring, or security | ||
3. Working with legacy applications requiring modern networking capabilities | ||
4. Designing microservices that demand independent scaling and updates8 | ||
|
||
 | ||
|
||
### Proceed with Caution If | ||
|
||
1. Resource efficiency is your primary concern | ||
2. Minimal network latency is critical | ||
3. Simpler alternatives exist | ||
4. You want to minimize troubleshooting complexity | ||
|
||
 |
Binary file added
BIN
+14.1 KB
...ineers/kubernetes-multi-container-pods/when-to-embrace-or-avoid-sidecars/ok.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.