【发布时间】:2021-11-16 08:06:21
【问题描述】:
这是我的问题。 Y 有一个适用于 kubernetes 的 yamls 部署,效果很好。所以,我将这个 yamls 放在 Helm Chart 中,但是当我部署 de helm 时,我从 Nginx 收到了 5032 错误:
[error] 41#41: *1176907 connect() failed (111: Connection refused) while connecting to upstream, client: 79.144.175.25, server: envtest.westeurope.cloudapp.azure.com, request: "POST /es/api/api/v1/terminals/login/123456789/monitor HTTP/1.1", upstream: "http://10.0.63.136:80/v1/terminals/login/123456789/monitor", host: "envtest.westeurope.cloudapp.azure.com"
我是初学者,所以我对这个问题很困惑。我已经比较了我的原始文件和生成的 helm 文件,但我没有看到错误。 由于我原来的 yamls 工作正常,我只是要在这里复制我的 helms 文件:
部署.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "example.fullname" . }}
namespace: {{ .Values.namespace }}
labels:
{{- include "example.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "example.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "example.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.env }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
Service.yaml
apiVersion: v1
kind: Service
metadata:
name: {{ include "example.fullname" . }}
namespace: {{ .Values.namespace }}
labels:
{{- include "example.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
microservice: {{ .Values.microservice }}
{{- include "example.selectorLabels" . | nindent 4 }}
我有一个秘密。 yaml 也是:
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.secretname }}
namespace: {{ .Values.namespace }}
type: Opaque
data:
redis-connection-string: {{ .Values.redisconnectionstring | b64enc }}
event-hub-connection-string:
{{ .Values.eventhubconnectionstring | b64enc }}
blob-storage-connection-string:
{{ .Values.blobstorageconnectionstring | b64enc }}
#(ingesters) sql
sql-user-for-admin-user: {{ .Values.sqluserforadminuser | b64enc }}
sql-user-for-admin-password:
{{ .Values.sqluserforadminpassword | b64enc }}
另一方面,我仍然没有掌舵,在传统的 yaml 中,入口和外部服务(作为工作正常的 yaml 集的一部分)
外部服务
kind: Service
apiVersion: v1
metadata:
name: example
namespace: example-ingress
spec:
type: ExternalName
externalName: example.example-tpvs.svc.cluster.local
ports:
- port: 80
入口
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: example-logic
namespace: example-ingress
annotations:
kubernetes.io/ingress.class: nginx
cert-manager.io/issuer: letsencrypt
nginx.ingress.kubernetes.io/rewrite-target: /$1
labels:
version: "0.1"
spec:
rules:
- host: envtest.westeurope.cloudapp.azure.com
http:
paths:
- path: /es/example/api/(.*)
backend:
serviceName: example
servicePort: 80
所以,当我安装 helm 时,我知道 pod 已启动,并且我可以在 pod 日志中看到一些 backjobs 正在工作,所以我几乎可以肯定问题出在 heml 的服务中......因为当我部署原始 yamls 时,这个外部和入口正在工作。
我希望有人可以帮助我。谢谢!
【问题讨论】:
标签: yaml kubernetes-helm azure-aks