Skip to content

Deploy with helm template#39

Merged
jojozhuang merged 2 commits intomasterfrom
deploy-with-helm-template
Jan 8, 2024
Merged

Deploy with helm template#39
jojozhuang merged 2 commits intomasterfrom
deploy-with-helm-template

Conversation

@jojozhuang
Copy link
Copy Markdown
Collaborator

@jojozhuang jojozhuang commented Jan 8, 2024

Use helm with template

Use values.yaml

Edit the file in template folder, use Values variables and put the actual values in values.yaml.

appName: compare-helm
namespace: default

configmap:
  name: compare-configmap
  data:
    ENV_NAME: 'DEV'

image:
  name: jojozhuang/text-compare-angular
  tag: latest

Upgrade the deployment.

helm upgrade compare-helm deployment --values deployment/values.yaml
W0107 21:30:02.019806   39661 warnings.go:70] unknown field "spec.ports[0].type"
Release "compare-helm" has been upgraded. Happy Helming!
NAME: compare-helm
LAST DEPLOYED: Sun Jan  7 21:30:01 2024
NAMESPACE: default
STATUS: deployed
REVISION: 3
TEST SUITE: None

After each upgrade, the revision number should be incremented.

helm ls
NAME        	NAMESPACE	REVISION	UPDATED                             	STATUS  	CHART           	APP VERSION
compare-helm	default  	5       	2024-01-07 21:38:03.669554 -0800 PST	deployed	deployment-0.1.0	1.16.0

Add notes

Create file NOTES.txt under deployment/templates directory with the following content.

servicename=$(k get service -l "app={{ .Values.appName }}" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace {{ .Values.namespace}} port-forward service/{{ .Values.appName }} 8888:80

Each time when you run the upgrade command, you will see the notes in the output.

helm upgrade compare-helm deployment --values deployment/values.yaml
W0107 21:49:34.774115   40283 warnings.go:70] unknown field "spec.ports[0].type"
Release "compare-helm" has been upgraded. Happy Helming!
NAME: compare-helm
LAST DEPLOYED: Sun Jan  7 21:49:34 2024
NAMESPACE: default
STATUS: deployed
REVISION: 6
TEST SUITE: None
NOTES:
servicename=$(k get service -l "app=compare-helm" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace default port-forward service/compare-helm 8888:80

Copy and paste the two lines and execute them in teminal.

servicename=$(k get service -l "app=compare-helm" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace default port-forward service/compare-helm 8888:80

Then, you are able to access your site through http://localhost:8888/.

@jojozhuang jojozhuang merged commit fd9e2a4 into master Jan 8, 2024
@jojozhuang jojozhuang deleted the deploy-with-helm-template branch November 8, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant