Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add basic helm chart for ms deployment #181

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions charts/microservice/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
name: microservice
description: A Helm chart for a microservice in Kubernetes

type: application
version: 0.1.0
appVersion: "1.0"
24 changes: 24 additions & 0 deletions charts/microservice/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Basic Helm Template for Deploying Microservice on K8s

## Chart Structure
```
microservice/
├── Chart.yaml
├── values.yaml
├── charts/
└── templates/
├── deployment.yaml
└── service.yaml
```

## Usage

You can change the Docker image by modifying the values.yaml file. For example, to use a different image, update the `image.repository` and `image.tag` fields.

The Helm chart is specifically for deploying a microservice with a Kubernetes service and deployment. You can further customize and expand this chart as needed for your application.

## Installing the Chart on K8s

```bash
helm install my-release microservice/
```
24 changes: 24 additions & 0 deletions charts/microservice/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "microservice.fullname" . }}
labels:
{{- include "microservice.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "microservice.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "microservice.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
15 changes: 15 additions & 0 deletions charts/microservice/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "microservice.fullname" . }}
labels:
{{- include "microservice.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "microservice.selectorLabels" . | nindent 4 }}
10 changes: 10 additions & 0 deletions charts/microservice/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
replicaCount: 1

image:
repository: nginx # your microservice image name

Check failure on line 4 in charts/microservice/values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

4:21 [comments] too few spaces before comment

Check failure on line 4 in charts/microservice/values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

4:51 [trailing-spaces] trailing spaces
pullPolicy: IfNotPresent
tag: "latest" # your microservice image tag

service:
type: ClusterIP
port: 80
Loading