Skip to content

Commit 8aa8708

Browse files
authored
Merge pull request #38 from Bit-Developer/deploy-with-helm-charts
Deploy with helm charts - no template
2 parents 2ce15be + aa80d2b commit 8aa8708

7 files changed

Lines changed: 150 additions & 0 deletions

File tree

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,56 @@ minikube service text-compare-service
5252
# 4. Web browser will be opened automatically to access the site.
5353
```
5454

55+
# Use helm with k8s
56+
57+
Create helm chart with the following command.
58+
59+
```sh
60+
helm create deployment
61+
```
62+
63+
Then, edit the deployment file, service and config map file accordingly.
64+
65+
After editing all configuration files, install with helm.
66+
67+
```sh
68+
helm install compare-helm deployment
69+
```
70+
71+
Helm will create k8s components based on the configuration files. Use `kubectl get all | grep helm` to find them.
72+
73+
```sh
74+
kubectl get all | grep helm
75+
pod/compare-helm-76b67b5db6-r6jwq 1/1 Running 0 12m
76+
service/compare-helm ClusterIP 10.97.189.245 <none> 80/TCP 12m
77+
deployment.apps/compare-helm 1/1 1 1 12m
78+
replicaset.apps/compare-helm-76b67b5db6 1 1 1 12m
79+
```
80+
81+
If you make any change to the configuration files, use the following command to upgrade.
82+
83+
```sh
84+
helm upgrade compare-helm deployment
85+
```
86+
87+
List all deployed namespaces.
88+
89+
```sh
90+
helm ls --all-namespaces
91+
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
92+
compare-helm default 2 2024-01-07 21:05:52.849445 -0800 PST deployed deployment-0.1.0 1.16.0
93+
text-compare bit-developer 1 2024-01-07 20:50:29.372749 -0800 PST deployed deployment-0.1.0 1.16.0
94+
text-compare default 1 2024-01-07 20:42:49.758154 -0800 PST failed deployment-0.1.0 1.16.0
95+
```
96+
97+
Start the service to view the web app in brower.
98+
99+
```sh
100+
minikube service compare-helm
101+
```
102+
103+
- [How to Create Helm Charts - The Ultimate Guide](https://www.youtube.com/watch?v=jUYNS90nq8U&ab_channel=DevOpsJourney)
104+
55105
# Deployment
56106
Read tutorial [Deploying Text Compare Angular App to Docker](https://jojozhuang.github.io/tutorial/deploying-text-compare-angular-app-to-docker) to learn how this angular app is deployed to Docker.
57107

deployment/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

deployment/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: deployment
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "1.16.0"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: compare-configmap
5+
#namespace: bit-developer
6+
data:
7+
ENV_NAME: 'DEV'

deployment/templates/service.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: compare-helm
5+
#namespace: bit-developer
6+
labels:
7+
app: compare-helm
8+
spec:
9+
selector:
10+
app: compare-helm
11+
tier: frontend
12+
ports:
13+
- protocol: TCP
14+
port: 80
15+
type: NodePort
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: compare-helm
5+
#namespace: bit-developer
6+
labels:
7+
app: compare-helm
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: compare-helm
13+
tier: frontend
14+
template:
15+
metadata:
16+
labels:
17+
app: compare-helm
18+
tier: frontend
19+
spec: # Pod spec
20+
containers:
21+
- name: compare-helm
22+
image: jojozhuang/text-compare-angular
23+
ports:
24+
- containerPort: 80
25+
resources:
26+
requests:
27+
memory: "16Mi"
28+
cpu: "50m" # 500milliCPUs (1/2 CPU)
29+
limits:
30+
memory: "128Mi"
31+
cpu: "100m"

deployment/values.yaml

Whitespace-only changes.

0 commit comments

Comments
 (0)