Skip to content

Commit

Permalink
Merge pull request #181 from rishops/basic-mircoservice-chart
Browse files Browse the repository at this point in the history
feat: add basic helm chart for ms deployment
  • Loading branch information
sandy724 authored Jan 30, 2024
2 parents c54e65c + 4b55fa8 commit a9c8caf
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
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
pullPolicy: IfNotPresent
tag: "latest" # your microservice image tag

service:
type: ClusterIP
port: 80

0 comments on commit a9c8caf

Please sign in to comment.