Localstack 在使用 Helm 图表时无法在 localhost:4566 上访问。

huangapple go评论73阅读模式
英文:

Localstack not accessible on localhost:4566 using Helm chart

问题

我无法在浏览器上访问http://localhost:4566/health,尽管检查日志后,svc和pods正在运行且健康。我尝试使用服务名称进行端口转发,仍然出现相同的错误

无法访问此网站
curl http://localhost:4566/health
curl: (7) 无法在5毫秒后连接到localhost的4566端口:无法连接到服务器

以下是粘贴的helm chart localstack.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Release.Name }}
  labels:
    app: {{ .Release.Name }}
spec:
  replicas: {{ .Values.localstack.replicaCount }}
  selector:
    matchLabels:
      app: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ .Release.Name }}
    spec:
      containers:
        - name: localstack
          image: "{{ .Values.localstack.image.repository }}:{{ .Values.localstack.image.tag }}"
          ports:
            - containerPort: 4566
              protocol: TCP
          env:
            - name: AWS_ACCESS_KEY_ID
              value: {{ .Values.localstack.aws_access_key_id }}
            - name: AWS_SECRET_ACCESS_KEY
              value: {{ .Values.localstack.aws_secret_access_key }}
            - name: AWS_DEFAULT_REGION
              value: {{ .Values.localstack.aws_default_region }}
            - name: AWS_ENDPOINT_URL  
              value: {{ .Values.localstack.endpoint_url }}   
---
apiVersion: v1
kind: Service
metadata:
  name: {{ .Release.Name }}-localstack-service
spec:
  selector:
    app: {{ .Release.Name }}-localstack
  ports:
    - protocol: TCP
      port: {{ .Values.localstack.service.port }}
      targetPort: 4566

values.yaml如下:

localstack:
  fullnameOverride: localstack
  chart: localstack-chart
  nameOverride: localstack
  version: 1.0.0
  image:
    repository: localstack/localstack
    tag: latest
  aws_access_key_id: test
  aws_secret_access_key: test
  aws_default_region: eu-west-2
  service:
    type: NodePort
    port: 4566
  endpoint_url: http://localstack:4566

我希望能够在本地浏览器上访问localstack的端点。

英文:

I could not access the http://localhost:4566/health on the browser even though the svc, pods are running and healthy after checking the logs. I tried to use port-forwarding with the service name and still same error

This site can’t be reached

curl http://localhost:4566/health
curl: (7) Failed to connect to localhost port 4566 after 5 ms: Couldn't connect to server

The helm chart is pasted below localstack.yaml

`apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Release.Name }}
  labels:
    app: {{ .Release.Name }}
spec:
  replicas: {{ .Values.localstack.replicaCount }}
  selector:
    matchLabels:
      app: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ .Release.Name }}
    spec:
      containers:
        - name: localstack
          image: "{{ .Values.localstack.image.repository }}:{{ .Values.localstack.image.tag }}"
          ports:
            - containerPort: 4566
              protocol: TCP
          env:
            - name: AWS_ACCESS_KEY_ID
              value: {{ .Values.localstack.aws_access_key_id }}
            - name: AWS_SECRET_ACCESS_KEY
              value: {{ .Values.localstack.aws_secret_access_key }}
            - name: AWS_DEFAULT_REGION
              value: {{ .Values.localstack.aws_default_region }}
            - name: AWS_ENDPOINT_URL  
              value: {{ .Values.localstack.endpoint_url }}   
---
apiVersion: v1
kind: Service
metadata:
  name: {{ .Release.Name }}-localstack-service
spec:
  selector:
    app: {{ .Release.Name }}-localstack
  ports:
    - protocol: TCP
      port: {{ .Values.localstack.service.port }}
      targetPort: 4566`

The values.yaml is
`

localstack:
  fullnameOverride: localstack
  chart: localstack-chart
  nameOverride: localstack
  version: 1.0.0
  image:
    repository: localstack/localstack
    tag: latest
  aws_access_key_id: test
  aws_secret_access_key: test
  aws_default_region: eu-west-2
  service:
    type: NodePort
    port: 4566
  endpoint_url: http://localstack:4566`

I would want to be able top locally access the endpoint of the localstack on the browser.

答案1

得分: 0

我应该进行端口转发,以使其可访问,现在我可以执行 kubectl port-forward 4566:4566。

英文:

I should have done port-forward to make it accessible now I was able to do kubectl port-forward <pod name> 4566:4566

huangapple
  • 本文由 发表于 2023年8月10日 17:24:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76874351.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定