Deploy and update an application from a chart that is stored in a catalog.
Outcomes
Deploy an application and its dependencies from a Helm chart.
Customize the deployment, including scaling and using a custom image.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command ensures that the cluster API is reachable.
[student@workstation ~]$ lab start packaged-charts
Instructions
Add the classroom Helm repository at the following URL and examine its contents.
http://helm.ocp4.example.com/charts
Use the helm repo list command to list the repositories that are configured for the student user.
[student@workstation ~]$ helm repo list
Error: no repositories to showIf the do280-repo repository is present, then continue to the next step.
Otherwise, add the repository.
[student@workstation ~]$ helm repo add do280-repo \
http://helm.ocp4.example.com/charts
"do280-repo" has been added to your repositoriesUse the helm search command to list all the chart versions in the repository.
[student@workstation ~]$ helm search repo --versions
NAME CHART VERSION APP VERSION ...
do280-repo/etherpad 0.0.7 latest ...
do280-repo/etherpad 0.0.6 latest ...
...output omitted...The etherpad chart has the 0.0.7 and 0.0.6 versions.
This chart is a copy of a chart from the https://github.com/redhat-cop/helm-charts repository.
Install the 0.0.6 version of the etherpad chart to a new packaged-charts-development project, with the example-app release name.
Use the registry.ocp4.example.com:8443/etherpad/etherpad:1.8.18 image in the offline classroom registry.
Expose the application at the https://development-etherpad.apps.ocp4.example.com URL.
Examine the values of the chart.
[student@workstation ~]$ helm show values do280-repo/etherpad --version 0.0.6
# Default values for etherpad.
replicaCount: 1
defaultTitle: "Labs Etherpad"
defaultText: "Assign yourself a user and share your ideas!"
image:
repository: etherpad
name:
tag:
pullPolicy: IfNotPresent
...output omitted...
route:
enabled: true
host: null
targetPort: http
...output omitted...
resources: {}
...output omitted...You can configure the image, the replica count, and other values.
By default, the chart creates a route.
You can customize the route with the route.host key.
With the default configuration, the chart uses the docker.io/etherpad/etherpad:latest image.
The classroom environment is designed for offline use.
Use the registry.ocp4.example.com:8443/etherpad/etherpad:1.8.18 image from the local registry instead.
Create a values.yaml file with the following content:
image: repository: registry.ocp4.example.com:8443/etherpad name: etherpad tag: 1.8.18 route: host: development-etherpad.apps.ocp4.example.com
Log in to the cluster as the developer user with the developer password.
[student@workstation ~]$ oc login -u developer -p developer \
https://api.ocp4.example.com:6443
...output omitted...Create a packaged-charts-development project.
[student@workstation ~]$ oc new-project packaged-charts-development
Now using project "packaged-charts-development" on server ...
...output omitted...Install the etherpad chart to the packaged-charts-development project.
Use the values.yaml file that you created in a previous step.
Use example-app as the release name.
[student@workstation ~]$ helm install example-app do280-repo/etherpad \
-f values.yaml --version 0.0.6
NAME: example-app
LAST DEPLOYED: Mon Jun 5 06:31:26 2023
NAMESPACE: packaged-charts-development
STATUS: deployed
REVISION: 1
TEST SUITE: NoneGet the route to verify that you customized the route correctly.
[student@workstation ~]$ oc get route
NAME HOST/PORT ...
example-app-etherpad development-etherpad.apps.ocp4.example.com ...Open a web browser and navigate to https://development-etherpad.apps.ocp4.example.com.
The application welcome page appears.
Upgrade a Helm chart by installing the 0.0.7 version of the chart.
Use the helm list command to verify the installed version.
[student@workstation ~]$helm listNAME NAMESPACE REVISION ... STATUS CHART example-app packaged-charts-development 1 ... deployedetherpad-0.0.6
Use the helm search command to verify that the repository contains a later version.
[student@workstation ~]$helm search repo --versionsNAME CHART VERSION APP VERSION ... do280-repo/etherpad0.0.7latest ... do280-repo/etherpad 0.0.6 latest ... ...output omitted...
Use the helm upgrade command to upgrade to the latest version of the chart.
[student@workstation ~]$ helm upgrade example-app do280-repo/etherpad \
-f values.yaml --version 0.0.7
Release "example-app" has been upgraded. Happy Helming!
NAME: example-app
LAST DEPLOYED: Mon Jun 5 06:41:00 2023
NAMESPACE: packaged-charts-development
STATUS: deployed
REVISION: 2
TEST SUITE: NoneUse the helm list command to verify the installed version.
[student@workstation ~]$helm listNAME NAMESPACE REVISION ... STATUS CHART example-app packaged-charts-development 2 ... deployedetherpad-0.0.7
Reload the application welcome page in the web browser.
The updates in the new version of the chart do not affect the deployment in this exercise. When you reload the application, the browser displays the same application welcome page.
Create a second deployment of the chart to a new packaged-charts-production project, with the example-app release name.
Expose the application at the https://etherpad.apps.ocp4.example.com URL, by customizing the route.host key.
Create a packaged-charts-production project.
[student@workstation ~]$ oc new-project packaged-charts-production
Now using project "packaged-charts-production" on server ...
...output omitted...Edit the values.yaml file to configure the host route to etherpad.apps.ocp4.example.com.
image: repository: registry.ocp4.example.com:8443/etherpad name: etherpad tag: 1.8.18route:host: etherpad.apps.ocp4.example.com
Install the 0.0.7 version of the etherpad chart to the packaged-review-production project.
Use the values.yaml file that you edited in a previous step.
Use production as the release name.
[student@workstation ~]$ helm install example-app do280-repo/etherpad \
-f values.yaml --version 0.0.7
...output omitted...Verify the deployment by opening a web browser and navigating to the application URL.
https://etherpad.apps.ocp4.example.com
This URL corresponds to the host that you specified in the values.yaml file.
The application welcome page appears in the production URL.
Reconfigure the production deployment to sustain heavier use. Change the number of replicas to 3.
Verify that the application has a single pod.
[student@workstation ~]$ oc get pods
NAME READY STATUS RESTARTS AGE
example-app-etherpad-6b85b94975-qfpqm 1/1 Running 0 12sEdit the values.yaml file.
Add a replicaCount key with the 3 value.
image:
repository: registry.ocp4.example.com:8443/etherpad
name: etherpad
tag: 1.8.18
route:
host: etherpad.apps.ocp4.example.com
replicaCount: 3Use the helm upgrade command to update the parameters.
[student@workstation ~]$ helm upgrade example-app do280-repo/etherpad \
-f values.yaml
...output omitted...Verify that the application has three pods.
[student@workstation ~]$ oc get pods
NAME READY STATUS RESTARTS AGE
example-app-etherpad-6b85b94975-h9qgz 1/1 Running 0 13s
example-app-etherpad-6b85b94975-lbr8h 1/1 Running 0 13s
example-app-etherpad-6b85b94975-qfpqm 1/1 Running 0 94sReload the application welcome page in the web browser.
The deployment continues working after adding replicas.
Remove the values.yaml file.
[student@workstation ~]$ rm values.yaml