Microgateway 10.7 | webMethods Microgateway Help | Kubernetes Support | Kubernetes Sidecar Deployment | Deploying a Kubernetes Sidecar using Helm Charts
 
Deploying a Kubernetes Sidecar using Helm Charts
If you are using helm charts for your Kubernetes deployments and management, then you can follow the outlined procedure for a convenient Microgateway Kubernetes deployment.
*To set up a Microgateway Kubernetes sidecar deployment with Helm charts
1. Install Helm and Tiller.
For details on installing Helm and Tiller, see Helm documentation and Tiller documentation.
2. Create your Helm chart.
helm create mg-helmchart
3. Replace deployment template data.
To achieve this, edit ./mg-helmchart/templates/deployment.yaml and replace the given content.
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
labels:
app: {{ .Release.Name }}
category: microgateway
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}
annotations:
prometheus.io/scrape: "{{ .Values.metrics.prometheus }}"
spec:
containers:
- name: {{ .Release.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.image.containerPort }}
protocol: TCP
livenessProbe:
exec:
command:
- /bin/sh
- -c
- /opt/softwareag/Microgateway/files/k8s-lifenesscheck.sh
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
exec:
command:
- /bin/sh
- -c
- /opt/softwareag/Microgateway/files/k8s-readinesscheck.sh
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
{{- if .Values.sidecarimage }}
- name: "{{ .Values.sidecarimage.name }}"
image: "{{ .Values.sidecarimage.repository }}:
{{ .Values.sidecarimage.tag }}"
imagePullPolicy: {{ .Values.sidecarimage.pullPolicy }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
4. Replace and adapt the values data.
To achieve this, edit ./mg-helmchart/values.yaml and adapt values (for example, the Microgateway Docker image or if a sidecar image is to be used).
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

# The Microgateway Docker image
image:
repository: localhost:5000/mg-node-tours
tag: latest
containerPort: 7072
pullPolicy: IfNotPresent

# The sidecar Docker image of the native service (if used, uncomment
and adapt values)
sidecarimage:
repository: localhost:5000/node-tours
tag: latest
name: sidecar-node
pullPolicy: IfNotPresent

metrics:
prometheus: true

service:
type: NodePort
# type: LoadBalancer
port: 7072

ingress:
enabled: false
paths: []
hosts: []
tls: []

resources: {}
# We usually recommend not to specify default resources and to leave this
as a conscious # choice for the user.

nodeSelector: {}

tolerations: []

affinity: {}
5. Check your environment.
helm install --dry-run --debug --name mg-test ./mg-helmchart
6. Deploy the chart to Kubernetes.
helm install --name mg-test ./mg-helmchart
7. Check the pods, deployment, and services for the resources created.
You can clear the entire deployment using the following command:
helm delete --purge mg-test
You have to restart the Kubernetes pods for the environment settings to be used.