K8s Operator
3 minute read
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:
Field | Description |
---|---|
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:
Field | Description |
---|---|
apiVersion string | api.localstack.cloud/v1alpha1 |
kind string | LocalStack |
kind string | Kind 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 string | APIVersion 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 ObjectMeta | Refer to Kubernetes API documentation for fields of metadata . |
spec LocalStackSpec | |
status LocalStackStatus |
LocalStackList
LocalStackList contains a list of LocalStack
Field | Description |
---|---|
apiVersion string | api.localstack.cloud/v1alpha1 |
kind string | LocalStackList |
kind string | Kind 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 string | APIVersion 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 ListMeta | Refer to Kubernetes API documentation for fields of metadata . |
items LocalStack array |
LocalStackSpec
LocalStackSpec defines the desired state of LocalStack
Appears in:
Field | Description |
---|---|
dnsProvider string | |
dnsConfigName string | |
dnsConfigNamespace string | |
debug string | |
autoLoadPods string array | |
authToken string | |
hooks Hooks | |
image string | Validate 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:
Field | Description |
---|---|
ready boolean | |
ip string | |
dns string |
PodSpec
Appears in:
Field | Description |
---|---|
image string | Validate 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 |