Localstack try to run Lambda function with ECR Image Pull from a Kubernetes Cluster

Hello,

I’m trying to run a Lambda function inside a kubernetes cluster with LocalStack Pro installed. I have used helm to install en configure everything.

When I created the ECR repository with the awslocal cli tool and pushed my docker image into it I can create a lambda function.

But when I try to run the lambda function as a kubernetes pod the pod can’t pull the image from the ECR repo. I receive the error 1.localhost.localstack.cloud:4566/v2/repo1/manifests/latest": dial tcp 127.0.0.1:4566: connect: connection refused

I have already tried several things, but nothing solved the problem.
Can someone help me with this error?

Hi @DKuijs,

Would you be able to elaborate on what you’ve attempted?
Additionally, please provide an example of how you are operating LocalStack, the steps you use to upload an image, and the actions you take to create and invoke a Lambda function.

Please read through our documentation Kubernetes | Docs (localstack.cloud) and Configuration | Docs (localstack.cloud) for specific Kubernetes setup.

First of all, I receive the following error when trying to execute the lambda function as a kubernetes pod.

exception while calling lambda with unknown operation: Could not start new environment: Missing the required parameter namespace when calling `create_namespaced_pod

This is my pod.yaml

apiVersion: v1
kind: Pod
metadata:
name: localstack
namespace: localstack
spec:
containers:

  • name: localstack-container
    image: localstack/localstack-pro
    env:
    • name: LOCALSTACK_AUTH_TOKEN
      value: EXAMPLE!!!
    • name: LAMBDA_RUNTIME_EXECUTOR
      value: kubernetes