K8s Operator

Custom K8s operator that offers LocalStack emulator as a native resource in Kubernetes environments.

Introduction

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.

Installation

To install the K8s operator, run the following commands:

$ 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.

apiVersion: api.localstack.cloud/v1alpha1
kind: LocalStack
metadata:
  name: env-0
  namespace: default
spec:
  image: localstack/localstack-pro:3.5.0
  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

API Reference

Resource Types

Hooks

Appears in:

FieldDescription
readyConfigName string
bootConfigName string
shutdownConfigName string
startConfigName string

Use as described in the Initialization Hooks reference.

LocalStack

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

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

LocalStackSpec defines the desired state of LocalStack

Appears in:

FieldDescription
dnsProvider string
dnsConfigName string
dnsConfigNamespace string
debug string
autoLoadPods string array
authToken string
hooks Hooks
image stringValidate docker inage name (with optional tag and registry address)
resources ResourceRequirements
readiness_probe Probe
liveness_probe Probe
envFrom EnvFromSource array
env EnvVar array
dnsPolicy DNSPolicy

LocalStackStatus

LocalStackStatus defines the observed state of LocalStack

Appears in:

FieldDescription
ready boolean
ip string
dns string

PodSpec

Appears in:

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