Skip to content

Commit

Permalink
add docs on running ecs tasks on k3d (#1235)
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Walker <s.r.walker101@googlemail.com>
  • Loading branch information
HarshCasper and simonrw committed May 9, 2024
1 parent 9529b9b commit fd541a0
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions content/en/user-guide/aws/ecs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Amazon Elastic Container Service (Amazon ECS) is a fully managed container orche
It allows you to run, stop, and manage Docker containers on a cluster.
ECS eliminates the need for you to install, operate, and scale your own cluster management infrastructure.

LocalStack allows you to use the ECS APIs in your local environment to create & manage ECS clusters, tasks, and services.
The supported APIs are available on our [API coverage page](https://docs.localstack.cloud/references/coverage/coverage_ecs/), which provides information on the extent of ECS's integration with LocalStack.

## Getting Started

This guide is designed for users new to ECS and assumes basic knowledge of the AWS CLI and our [`awslocal`](https://github.com/localstack/awscli-local) wrapper script.
Expand Down Expand Up @@ -338,6 +341,47 @@ services:
Alternatively, you can download the image from the private registry before using it or employ an [Initialization Hook](https://docs.localstack.cloud/references/init-hooks/) to install the Docker client and use these credentials to download the image.
## Running ECS on Kubernetes
LocalStack Enterprise image allows you to run ECS tasks on Kubernetes. The tasks are added to ELB load balancer target groups.
You can do so by setting the `ECS_TASK_EXECUTOR` environment variable to `kubernetes` in the LocalStack container.

In this guide, you will learn how to run ECS tasks on Kubernetes by using [`k3d](https://k3d.io/), a lightweight Kubernetes distribution.

### Create a new cluster

After installing `k3d`, you can run the following commands to create a Kubernetes cluster:

{{< command >}}
$ export NODE_PORT=31566
$ k3d cluster create ls-cluster -p "4566:$NODE_PORT" --wait --timeout 5m
{{< / command >}}

### Install LocalStack in the cluster

You can now install LocalStack in the Kubernetes cluster by using LocalStack's Helm chart. The following command installs LocalStack with the `kubernetes` executor for ECS and sets the `LOCALSTACK_AUTH_TOKEN` environment variable:

{{< command >}}
$ helm upgrade --install localstack localstack/localstack \
--set debug=true \
--set image.repository=localstack/localstack-pro \
--set image.tag=latest \
--set readinessProbe.initialDelaySeconds=10 --set livenessProbe.initialDelaySeconds=10 \
--set service.edgeService.nodePort=$NODE_PORT \
--set "extraEnvVars[0].name=LOCALSTACK_AUTH_TOKEN" --set-string "extraEnvVars[0].value=${LOCALSTACK_AUTH_TOKEN}" \
--set "extraEnvVars[1].name=ECS_TASK_EXECUTOR" --set-string "extraEnvVars[1].value=kubernetes" \
--wait --timeout 5m
{{< / command >}}

After a successful installation, you can access the LocalStack running the following command:

{{< command >}}
$ curl http://localhost:4566/_localstack/health
{{< / command >}}

You can now create ECS tasks on Kubernetes by following the steps in the [Getting Started](#getting-started) section.

## Resource Browser

The LocalStack Web Application provides a Resource Browser for managing ECS clusters & task definitions.
Expand Down

0 comments on commit fd541a0

Please sign in to comment.