Skip to content

K8s Operator

LocalStack K8s operator is a custom Kubernetes operator that offers LocalStack emulator as a native resource in Kubernetes environments. The operator is designed to simplify the deployment and management of LocalStack in Kubernetes clusters.

To install the K8s operator, run the following commands:

Terminal window
kubectl apply -f https://raw.githubusercontent.com/localstack/localstack-k8s-operator/v0.2.0/release/crds.yaml
kubectl apply -f https://raw.githubusercontent.com/localstack/localstack-k8s-operator/v0.2.0/release/controller.yaml

You can then deploy a LocalStack instance by storing the following file content as localstack.yml and applying it against the cluster via kubectl apply -f localstack.yml.

Terminal window
apiVersion: api.localstack.cloud/v1alpha1
kind: LocalStack
metadata:
name: env-0
namespace: default
spec:
image: localstack/localstack-pro:latest
debug: trace
authToken: "<my-auth-token>" # Set your LocalStack Auth Token here
autoLoadPods: ["<my-cloudpod>"] # Set your Cloud Pods to automatically load them here (optional)
dnsProvider: coredns
dnsConfigName: coredns
dnsConfigNamespace: kube-system

Appears in:

FieldDescription
readyConfigName string
bootConfigName string
shutdownConfigName string
startConfigName string

Use as described in the Initialization Hooks reference.

LocalStack is the Schema for the localstacks API

Appears in:

FieldDescription
apiVersion stringapi.localstack.cloud/v1alpha1
kind stringLocalStack
kind stringKind is a string value representing the REST resource this object represents.

Servers may infer this from the endpoint the client submits requests to.

Cannot be updated.

In CamelCase.

More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.

Servers should convert recognized schemas to the latest internal value, and

may reject unrecognized values.

More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
metadata ObjectMetaRefer to Kubernetes API documentation for fields of metadata.
spec LocalStackSpec
status LocalStackStatus

LocalStackList contains a list of LocalStack

FieldDescription
apiVersion stringapi.localstack.cloud/v1alpha1
kind stringLocalStackList
kind stringKind is a string value representing the REST resource this object represents.

Servers may infer this from the endpoint the client submits requests to.

Cannot be updated.

In CamelCase.

More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.

Servers should convert recognized schemas to the latest internal value, and

may reject unrecognized values.

More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
metadata ListMetaRefer to Kubernetes API documentation for fields of metadata.
items LocalStack array

LocalStackSpec defines the desired state of LocalStack

Appears in:

FieldDescription
dnsProvider string
dnsConfigName string
dnsConfigNamespace string
debug stringSelect one of the following: trace, trace-internal, debug, info, warn, error, warning.
autoLoadPods string array
authToken string
hooks Hooks
image stringValidate docker image name (with optional tag and registry address)
resources ResourceRequirements
readiness_probe Probe
liveness_probe Probe
envFrom EnvFromSource array
env EnvVar array
dnsPolicy DNSPolicy

LocalStackStatus defines the observed state of LocalStack

Appears in:

FieldDescription
ready boolean
ip string
dns string

Appears in:

FieldDescription
image stringValidate docker image name (with optional tag and registry address)
resources ResourceRequirements
readiness_probe Probe
liveness_probe Probe
envFrom EnvFromSource array
env EnvVar array
dnsPolicy DNSPolicy