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

问题描述 投票:0回答:1

即使在检查日志后 svc、pod 正在运行且运行正常,我也无法在浏览器上访问 http://localhost:4566/health。我尝试使用带有服务名称的端口转发,但仍然出现相同的错误

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

helm图表粘贴在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`

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

devops kubernetes-helm localstack
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.