Error when running localstack in Kubernetes


I’ve installed the localstack helm chart using helmfile. These are the relevant parts:

  - name: localstack-charts

  - name: localstack
    namespace: localstack
    chart: localstack-charts/localstack
    version: 0.6.9
     - startupScriptContent: |
        awslocal sqs create-queue --queue-name calculation-requests-queue

Seems like installation went fine without any errors.

I’m also injecting the following environment variables via ConfigMap (my-app namespace):

AWS_REGION: us-east-1

My helmfile also contains a Spring Boot service (in my-app namespace) that needs to communicate with localstack’s SQS . This is the SqsService class:

public class SqsService {

private final SqsClient sqsClient;
private final ConfigProperties configProperties;

public SqsService(ConfigProperties configProperties) {
    this.configProperties = configProperties;
    this.sqsClient = SqsClient.builder()

Looking at my service logs I can see the following error:

Caused by: localstack

What exactly is missing here for the proper resolution of the localstack host? I can also use a different host as long as it works, I don’t mind.


Could you try using the FQDN of the service: localstack.<namespace>.svc.cluster.local? See the k8s docs on DNS of services.

@simon.walker Thanks. I replaced the override URL to http://localstack.localstack.svc.cluster.local and it made the UnknownHostException go away. However, there’s still an issue, because periodically I invoke my listQueues method, and all I get is:

List Queues:
SqsException: Service returned HTTP status code 403 (Service: Sqs, Status Code: 403, Request ID: null)

Here’s the method:

public void listQueues() {

    System.out.println("\nList Queues:");

    try {
        ListQueuesRequest listQueuesRequest = ListQueuesRequest.builder().build();
        ListQueuesResponse listQueuesResponse = sqsClient.listQueues(listQueuesRequest);

        for (String url : listQueuesResponse.queueUrls()) {
            System.out.println("Queue url: " + url);

    } catch (SqsException e) {
        System.err.println("SqsException: " + e.getMessage());

What’s causing the 403?
Here’s some extra data from the exception in e.awsErrorDetails():

sdkHttpResponse.statusText: Optional[connecting to localstack.localstack.svc.cluster.local:80: resolving host localstack.localstack.svc.cluster.local: lookup localstack.localstack.svc.cluster.local: no such host]


The code is trying to access LocalStack over port 80 (because you didn’t specify a port with your override URL). Could you set the override URL to http://localstack.localstack.svc.cluster.local:4566 instead?

After posting my response, I found that the DNS tool dig requires the FQDN of the service, but other tools such as curl or Python do not. I may have been wrong in suggesting using the FQDN, but let’s revisit that once we have something working for you.