From 76bbed0d30d4ed3ac3e3254979336a0154991cc3 Mon Sep 17 00:00:00 2001 From: leaddevops <36464863+leaddevops@users.noreply.github.com> Date: Tue, 10 Oct 2023 22:28:58 +0530 Subject: [PATCH] create --- .../04-understand-NOTES.txt.md | 131 ++++++++++++++++++ ...t-in-objects.md => 05-built-in-objects.md} | 3 +- 05-create-helm-charts/README.md | 13 +- 3 files changed, 139 insertions(+), 8 deletions(-) create mode 100644 05-create-helm-charts/04-understand-NOTES.txt.md rename 05-create-helm-charts/{04-built-in-objects.md => 05-built-in-objects.md} (98%) diff --git a/05-create-helm-charts/04-understand-NOTES.txt.md b/05-create-helm-charts/04-understand-NOTES.txt.md new file mode 100644 index 0000000..37d5654 --- /dev/null +++ b/05-create-helm-charts/04-understand-NOTES.txt.md @@ -0,0 +1,131 @@ +## purpose of NOTES.txt + +* **can be created/found under `chartname/templates/NOTES.txt`** +* **OPTIONAL file** +* **its a A plain text file containing short usage notes** +* **when we install a chart with `helm install`, if the chart consist of NOTES.txt it prints all the data in NOTES.txt to terminal after chart installed successufly** +* **usefull to let know people understand the resources deployed, how to access the app deployed etc..** + +#### create required directories & files +```sh +# Note in this example we will create the mandatory files & directories only + +mkdir $HOME/noteschart # this is main(root) chart directory, the name can by anything as per your project or application etc.. +cd $HOME/noteschart +mkdir templates +touch Chart.yaml +``` + +#### write the chart metadata in Chart.yaml +```sh +vi $HOME/noteschart/Chart.yaml +``` +```yaml +# place the below content inside the Chart.yaml +apiVersion: v2 +type: application +name: noteschart +version: "0.1.0" # recomended to follow version as "MAJOR-Version.MINOR-Version.PATCH-Version" always +description: "A Helm chart to deploy all required kubernetes resources for noteschart" +appVersion: "1.0.0" # your application version / release version +# save the file with the above data +``` + +#### add/create the neccessary kubernetes resource yaml files under templates directory +```sh +cd $HOME/noteschart/templates +``` +```sh +vi deployment.yaml +``` +```yaml +# place the below content in deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: java-app + labels: + app: sampleapp +spec: + replicas: 2 + selector: + matchLabels: + app: sampleapp + template: + metadata: + labels: + app: sampleapp + spec: + containers: + - name: sampleapp + image: lerndevops/samples:java-app + ports: + - containerPort: 8080 +# save the file with the above data +``` + +```sh +vi service.yaml +``` +```yaml +# place the below content in service.yaml +apiVersion: v1 +kind: Service +metadata: + name: java-app-service +spec: + type: NodePort + selector: + app: sampleapp + ports: + - protocol: TCP + port: 8080 + nodePort: 32105 +# save the file with the above data +``` +```sh +vi NOTES.txt +``` +```sh +# place the below content in NOTES.txt +# the chart deployed the kubernetes resources as below + * deployment named java-app with 2 replicas + * a nodeport service named java-app-service +# inspect the resources using below commands + * kubectl get deployment -o wide + * kubectl get services -o wide +# you may access the application using the nodeport allocated as below + * curl http://localhost:32105 +``` + + +## install the chart + +```sh +helm install noteschart-rel $HOME/noteschart/ +``` +```t +# observe the output as below + +NAME: noteschart-rel +LAST DEPLOYED: Tue Oct 10 16:49:01 2023 +NAMESPACE: default +STATUS: deployed +REVISION: 1 +TEST SUITE: None + +NOTES: +# the chart deployed the kubernetes resources as below + * deployment named java-app with 2 replicas + * a nodeport service named java-app-service +# inspect the resources using below commands + * kubectl get deployment -o wide + * kubectl get services -o wide +# you may access the application using the nodeport allocated as below + * curl http://localhost:32105 +``` + +## uninstall the chart +```sh +helm uninstall noteschart-rel +``` \ No newline at end of file diff --git a/05-create-helm-charts/04-built-in-objects.md b/05-create-helm-charts/05-built-in-objects.md similarity index 98% rename from 05-create-helm-charts/04-built-in-objects.md rename to 05-create-helm-charts/05-built-in-objects.md index 38e8dd4..54e449c 100644 --- a/05-create-helm-charts/04-built-in-objects.md +++ b/05-create-helm-charts/05-built-in-objects.md @@ -240,5 +240,4 @@ File Glob: map[conf/app.props:[97 112 112 78 97 109 101 58 32 97 110 116 105 107 ## Additional Reference - [Helm Built-In Objects](https://helm.sh/docs/chart_template_guide/builtin_objects/) -- [Helm Chart.yaml Fields](https://helm.sh/docs/chart_template_guide/builtin_objects/) - +- [Helm Chart.yaml Fields](https://helm.sh/docs/topics/charts/#the-chartyaml-file) \ No newline at end of file diff --git a/05-create-helm-charts/README.md b/05-create-helm-charts/README.md index 6172da7..aac2975 100644 --- a/05-create-helm-charts/README.md +++ b/05-create-helm-charts/README.md @@ -4,12 +4,13 @@ - **we can create/develop these chart by using** * ***regular kubernetes manifest yaml files placed into the chart directory structure as they are*** - * **`OR`** + * ***`OR`*** * ***we can also templatize these yaml files to pass values dynamically by using `helm template language`*** --- -1. [understand-helm-chart-structure] -2. [create-helm-chart-manual] -3. [helm-create] -4. [helm-chart-templates] -5. [helm-chart-built-in-objects] \ No newline at end of file +1. [understand-helm-chart-structure](../05-create-helm-charts/00-helm-chart-structure.md) +2. [create-helm-chart-manual](../05-create-helm-charts/01-create-helm-chart-manual.md) +3. [helm-create](../05-create-helm-charts/02-helm-create.md) +4. [helm-chart-templates](../05-create-helm-charts/03-helm-chart-templates.md) +5. [understand-NOTES.txt](../05-create-helm-charts/04-understand-NOTES.txt.md) +6. [helm-chart-built-in-objects](../05-create-helm-charts/05-built-in-objects.md) \ No newline at end of file