@@ -100,6 +100,83 @@ Start the service to view the web app in brower.
100100minikube service compare-helm
101101```
102102
103+ # Use helm with template
104+
105+ ## Use values.yaml
106+
107+ Edit the file in ` template ` folder, use ` Values ` variables and put the actual values in ` values.yaml ` .
108+
109+ ``` yaml
110+ appName : compare-helm
111+ namespace : default
112+
113+ configmap :
114+ name : compare-configmap
115+ data :
116+ ENV_NAME : ' DEV'
117+
118+ image :
119+ name : jojozhuang/text-compare-angular
120+ tag : latest
121+ ` ` `
122+
123+ Upgrade the deployment.
124+
125+ ` ` ` sh
126+ helm upgrade compare-helm deployment --values deployment/values.yaml
127+ W0107 21:30:02.019806 39661 warnings.go:70] unknown field "spec.ports[0].type"
128+ Release "compare-helm" has been upgraded. Happy Helming!
129+ NAME : compare-helm
130+ LAST DEPLOYED : Sun Jan 7 21:30:01 2024
131+ NAMESPACE : default
132+ STATUS : deployed
133+ REVISION : 3
134+ TEST SUITE : None
135+ ` ` `
136+
137+ After each upgrade, the revision number should be incremented.
138+
139+ ` ` ` sh
140+ helm ls
141+ NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
142+ compare-helm default 5 2024-01-07 21:38:03.669554 -0800 PST deployed deployment-0.1.0 1.16.0
143+ ```
144+
145+ ## Add notes
146+
147+ Create file ` NOTES.txt ` under ` deployment/templates ` directory with the following content.
148+
149+ ``` sh
150+ servicename=$( k get service -l " app={{ .Values.appName }}" -o jsonpath=" {.items[0].metadata.name}" )
151+ kubectl --namespace {{ .Values.namespace}} port-forward service/{{ .Values.appName }} 8888:80
152+ ```
153+
154+ Each time when you run the upgrade command, you will see the notes in the output.
155+
156+ ``` sh
157+ helm upgrade compare-helm deployment --values deployment/values.yaml
158+ W0107 21:49:34.774115 40283 warnings.go:70] unknown field " spec.ports[0].type"
159+ Release " compare-helm" has been upgraded. Happy Helming!
160+ NAME: compare-helm
161+ LAST DEPLOYED: Sun Jan 7 21:49:34 2024
162+ NAMESPACE: default
163+ STATUS: deployed
164+ REVISION: 6
165+ TEST SUITE: None
166+ NOTES:
167+ servicename=$( k get service -l " app=compare-helm" -o jsonpath=" {.items[0].metadata.name}" )
168+ kubectl --namespace default port-forward service/compare-helm 8888:80
169+ ```
170+
171+ Copy and paste the two lines and execute them in teminal.
172+
173+ ``` sh
174+ servicename=$( k get service -l " app=compare-helm" -o jsonpath=" {.items[0].metadata.name}" )
175+ kubectl --namespace default port-forward service/compare-helm 8888:80
176+ ```
177+
178+ Then, you are able to access your site through ` http://localhost:8888/ ` .
179+
103180- [ How to Create Helm Charts - The Ultimate Guide] ( https://www.youtube.com/watch?v=jUYNS90nq8U&ab_channel=DevOpsJourney )
104181
105182# Deployment
0 commit comments