Adding frontend to helm chart

master
Drew Bednar 3 years ago
parent a3c89245b4
commit 64deeef8e2

@ -31,6 +31,12 @@ helm list
helm upgrade demo-helm-1633825301 charts/demo-helm helm upgrade demo-helm-1633825301 charts/demo-helm
``` ```
You can wait for successful deployment too.
```
helm upgrade demo-helm-1633825301 charts/demo-helm --wait
```
## Setting registry pull secrets ## Setting registry pull secrets
You have to have an image pull secret. So first you need the secrets: You have to have an image pull secret. So first you need the secrets:

@ -3,5 +3,5 @@ apiVersion: v2
name: demo-helm name: demo-helm
appVersion: 1.1.0 appVersion: 1.1.0
description: A Helm chart to practice helm description: A Helm chart to practice helm
version: 0.2.0 version: 0.3.0
type: application type: application

@ -1,3 +1,4 @@
---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata # https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata

@ -4,7 +4,7 @@ kind: Deployment
metadata: metadata:
# This allows us to ensure we have a unique config name. Which means we could have two of the same service # This allows us to ensure we have a unique config name. Which means we could have two of the same service
# in the same namespace. # in the same namespace.
name: {{ .Release.Name }}-{{ .Chart.Name}}-deployment name: {{ .Release.Name }}-{{ .Chart.Name}}-backend
labels: labels:
app: {{ .Release.Name }}-{{ .Chart.Name}}-backend app: {{ .Release.Name }}-{{ .Chart.Name}}-backend
spec: spec:
@ -29,4 +29,4 @@ spec:
- containerPort: 5000 - containerPort: 5000
imagePullSecrets: imagePullSecrets:
- name: {{ $.Values.image_pull_secret }} - name: {{ $.Values.image_pull_secret }}
{{- end }} {{- end }}

@ -0,0 +1,15 @@
---
apiVersion: v1
kind: Service
# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
metadata:
labels:
name: {{ $.Release.Name }}-{{ $.Chart.Name}}-frontend-service
name: {{ $.Release.Name }}-{{ $.Chart.Name}}-frontend-service
spec:
ports:
- protocol: 'TCP'
port: 80
targetPort: 80
selector:
app: {{ $.Release.Name }}-{{ $.Chart.Name}}-frontend

@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
metadata:
# This allows us to ensure we have a unique config name. Which means we could have two of the same service
# in the same namespace.
name: {{ .Release.Name }}-{{ .Chart.Name }}-frontend
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}-frontend
spec:
{{- with .Values.services.frontend }}
replicas: {{ .replicas }}
selector:
matchLabels:
app: {{ $.Release.Name }}-{{ $.Chart.Name }}-frontend
template:
metadata:
labels:
app: {{ $.Release.Name }}-{{ $.Chart.Name }}-frontend
# Here I am just demonstrating that you can pull values from Chart.yaml or Releases.
# Note the capital first letter in accessing the values
app_version: {{ $.Chart.AppVersion }}
spec:
containers:
- name: {{ $.Release.Name }}-{{ $.Chart.Name}}-frontend
image: {{ .image_name }}:{{ .image_version }}
imagePullPolicy: Always
ports:
- containerPort: 80
imagePullSecrets:
- name: {{ $.Values.image_pull_secret }}
{{- end }}

@ -1,3 +1,4 @@
---
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata # https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
@ -15,3 +16,21 @@ spec:
name: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend-service name: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend-service
port: port:
number: 80 number: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name}}-frontend-ingress
spec:
rules:
- host: frontend.runcible.io
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ $.Release.Name }}-{{ $.Chart.Name}}-frontend-service
port:
number: 80

Loading…
Cancel
Save