我有2个由nodejs编写的服务。
我将使用Helm将它们部署到AKS
喜欢:
service.js
app.get('/users', function(req,res){
res.send("Hello World");
});
并使用头盔部署了2个服务。
这是deployment.yaml文件
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "samplechart.fullname" . }}
labels:
{{ include "samplechart.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8081
protocol: TCP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "samplechart.fullname" . }}-test
labels:
{{ include "samplechart.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
containers:
- name: test
image: "{{ .Values.image.repository2 }}:{{ .Values.image.tag2 }}"
imagePullPolicy: {{ .Values.image.pullPolicy2 }}
ports:
- name: http
containerPort: 8082
protocol: TCP
如何配置ingress.yaml以访问我的服务。 示例外部IP是13.78.42.19,并使用13.78.42.19:8081或13.78.42.19:8082访问上述服务 我的默认ingress.yaml文件
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "samplechart.fullname" . -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{ include "samplechart.labels" . | indent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}
{{- end }}