mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-02-14 09:39:56 +00:00
🪓 Split the Helm exercises in two parts
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
## Exercise - Helm Charts
|
||||
|
||||
- Create a Helm chart to deploy a generic microservice
|
||||
|
||||
- Deploy dockercoins by instanciating that chart multiple times
|
||||
|
||||
- Bonus: create a "meta" Helm chart to install the 5 components of dockercoins
|
||||
|
||||
- Bonus: use an external chart for the redis component
|
||||
@@ -1,82 +0,0 @@
|
||||
# Exercise - Helm Charts
|
||||
|
||||
- We want to deploy dockercoins with a Helm chart
|
||||
|
||||
- We want to have a "generic chart" and instantiate it 5 times
|
||||
|
||||
(once for each service)
|
||||
|
||||
- We will pass values to the chart to customize it for each component
|
||||
|
||||
(to indicate which image to use, which ports to expose, etc.)
|
||||
|
||||
- We'll use `helm create` as a starting point for our generic chart
|
||||
|
||||
---
|
||||
|
||||
|
||||
(using `helm create` to get a generic chart and tweaking that chart)
|
||||
|
||||
- Deploy dockercoins by instanciating that chart multiple times
|
||||
|
||||
(one time per service, so 5 times total)
|
||||
|
||||
- Create a "meta" Helm chart to install the 5 components of dockercoins
|
||||
|
||||
(using chart dependencies and aliases)
|
||||
|
||||
- Bonus: use Bitnami's redis chart for the dockercoins redis component
|
||||
|
||||
---
|
||||
|
||||
## Goal
|
||||
|
||||
- Have a directory with the generic chart
|
||||
|
||||
(e.g. `generic-chart`)
|
||||
|
||||
- Have 5 value files
|
||||
|
||||
(e.g. `hasher.yml`, `redis.yml`, `rng.yml`, `webui.yml`, `worker.yml`)
|
||||
|
||||
- Be able to install dockercoins by running 5 times:
|
||||
|
||||
`helm install X ./generic-chart --values=X.yml`
|
||||
|
||||
---
|
||||
|
||||
## Hints
|
||||
|
||||
- There are many little things to tweak in the generic chart
|
||||
|
||||
(service names, port numbers, healthchecks...)
|
||||
|
||||
- Check the training slides if you need a refresher!
|
||||
|
||||
---
|
||||
|
||||
## Bonus 1
|
||||
|
||||
- Create a "meta chart" or "umbrella chart" to install all 5 components
|
||||
|
||||
(so that dockercoins can be installed with a single `helm install` command)
|
||||
|
||||
- This will require expressing dependencies, and using the `alias` keyword
|
||||
|
||||
---
|
||||
|
||||
## Bonus 2
|
||||
|
||||
- Replace the `redis` component with an external chart
|
||||
|
||||
(e.g. Bitnami's redis chart)
|
||||
|
||||
- This will require to pass extra values to that chart
|
||||
|
||||
(to disable persistence, replication, password authentication)
|
||||
|
||||
- This will also require to either:
|
||||
|
||||
- import the chart and tweak it to change the service name
|
||||
|
||||
- add an ExternalName service pointing to the new redis component
|
||||
13
slides/exercises/helm-generic-chart-brief.md
Normal file
13
slides/exercises/helm-generic-chart-brief.md
Normal file
@@ -0,0 +1,13 @@
|
||||
## Exercise - Helm Charts
|
||||
|
||||
- Create a Helm chart to deploy a generic microservice
|
||||
|
||||
- Deploy dockercoins by instanciating that chart multiple times
|
||||
|
||||
- Bonus: have as little values as possible
|
||||
|
||||
- Bonus: handle healthchecks for HTTP services
|
||||
|
||||
- Bonus: make it easy to change image versions
|
||||
|
||||
- Bonus: make it easy to use images on a different registry
|
||||
86
slides/exercises/helm-generic-chart-details.md
Normal file
86
slides/exercises/helm-generic-chart-details.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# Exercise - Helm Charts
|
||||
|
||||
- We want to deploy dockercoins with a Helm chart
|
||||
|
||||
- We want to have a "generic chart" and instantiate it 5 times
|
||||
|
||||
(once for each service)
|
||||
|
||||
- We will pass values to the chart to customize it for each component
|
||||
|
||||
(to indicate which image to use, which ports to expose, etc.)
|
||||
|
||||
- We'll use `helm create` as a starting point for our generic chart
|
||||
|
||||
---
|
||||
|
||||
## Goal
|
||||
|
||||
- Have a directory with the generic chart
|
||||
|
||||
(e.g. `generic-chart`)
|
||||
|
||||
- Have 5 value files
|
||||
|
||||
(e.g. `hasher.yml`, `redis.yml`, `rng.yml`, `webui.yml`, `worker.yml`)
|
||||
|
||||
- Be able to install dockercoins by running 5 times:
|
||||
|
||||
`helm install X ./generic-chart --values=X.yml`
|
||||
|
||||
---
|
||||
|
||||
## Hints
|
||||
|
||||
- There are many little things to tweak in the generic chart
|
||||
|
||||
(service names, port numbers, healthchecks...)
|
||||
|
||||
- Check the training slides if you need a refresher!
|
||||
|
||||
---
|
||||
|
||||
## Bonus 1
|
||||
|
||||
- Minimize the amount of values that have to be set
|
||||
|
||||
- Option 1: no values at all for `rng` and `hasher`
|
||||
|
||||
(default values assume HTTP service listening on port 80)
|
||||
|
||||
- Option 2: no values at all for `worker`
|
||||
|
||||
(default values assume worker container with no service)
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Bonus 2
|
||||
|
||||
- Handle healthchecks
|
||||
|
||||
- Make sure that healthchecks are enabled in HTTP services
|
||||
|
||||
- ...But not in Redis or in the worker
|
||||
|
||||
---
|
||||
|
||||
## Bonus 3
|
||||
|
||||
- Make it easy to change image versions
|
||||
|
||||
- E.g. change `v0.1` to `v0.2` by changing only *one* thing in *one* place
|
||||
|
||||
---
|
||||
|
||||
## Bonus 4
|
||||
|
||||
- Make it easy to use images on a different registry
|
||||
|
||||
- We can assume that the images will always have the same names
|
||||
|
||||
(`hasher`, `rng`, `webui`, `worker`)
|
||||
|
||||
- And the same tag
|
||||
|
||||
(`v0.1`)
|
||||
9
slides/exercises/helm-umbrella-chart-brief.md
Normal file
9
slides/exercises/helm-umbrella-chart-brief.md
Normal file
@@ -0,0 +1,9 @@
|
||||
## Exercise - Umbrella Charts
|
||||
|
||||
- Create a Helm chart with dependencies on other charts
|
||||
|
||||
(leveraging the generic chart created earlier)
|
||||
|
||||
- Deploy dockercoins with that chart
|
||||
|
||||
- Bonus: use an external chart for the redis component
|
||||
77
slides/exercises/helm-umbrella-chart-details.md
Normal file
77
slides/exercises/helm-umbrella-chart-details.md
Normal file
@@ -0,0 +1,77 @@
|
||||
# Exercise - Umbrella Charts
|
||||
|
||||
- We want to deploy dockercoins with a single Helm chart
|
||||
|
||||
- That chart will reuse the "generic chart" created previously
|
||||
|
||||
- This will require expressing dependencies, and using the `alias` keyword
|
||||
|
||||
- It will also require minor changes in the templates
|
||||
|
||||
---
|
||||
|
||||
## Goal
|
||||
|
||||
- We want to be able to install a copy of dockercoins with:
|
||||
```bash
|
||||
helm install dockercoins ./umbrella-chart
|
||||
```
|
||||
|
||||
- It should leverage the generic chart created earlier
|
||||
|
||||
(and instanciate it five times, one time per component of dockercoins)
|
||||
|
||||
- The values YAML files created earlier should be merged in a single one
|
||||
|
||||
---
|
||||
|
||||
## Bonus
|
||||
|
||||
- We want to replace our redis component with a better one
|
||||
|
||||
- We're going to use Bitnami's redis chart
|
||||
|
||||
(find it on the Artifact Hub)
|
||||
|
||||
- However, a lot of adjustments will be required!
|
||||
|
||||
(check following slides if you need hints)
|
||||
|
||||
---
|
||||
|
||||
## Hints (1/2)
|
||||
|
||||
- We will probably have to disable persistence
|
||||
|
||||
- by default, the chart enables persistence
|
||||
|
||||
- this works only if we have a default StorageClass
|
||||
|
||||
- this can be disabled by setting a value
|
||||
|
||||
- We will also have to disable authentication
|
||||
|
||||
- by default, the chart generates a password for Redis
|
||||
|
||||
- the dockercoins code doesn't use one
|
||||
|
||||
- this can also be changed by setting a value
|
||||
|
||||
---
|
||||
|
||||
## Hints (2/2)
|
||||
|
||||
- The dockercoins code connects to `redis`
|
||||
|
||||
- The chart generates different service names
|
||||
|
||||
- Option 1:
|
||||
|
||||
- vendor the chart in our umbrella chart
|
||||
- change the service name in the chart
|
||||
|
||||
- Option 2:
|
||||
|
||||
- add a Service of type ExternalName
|
||||
- it will be a DNS alias from `redis` to `redis-whatever.NAMESPACE.svc.cluster.local`
|
||||
- for extra points, make the domain configurable
|
||||
Reference in New Issue
Block a user