Runbook: Docker to ECK Operator Migration & Elastic AutoOps Cloud Connect
This runbook documents the complete end-to-end migration of the LambertLab observability stack from standalone Docker containers on workstation to the Elastic Cloud on Kubernetes (ECK) Operator (v3.5.0) in the observability namespace, as well as the integration of Elastic AutoOps Cloud Connect.
ποΈ Architectural Overview & Transformation
Prior to migration, Elasticsearch 8.x, Logstash, and Fleet Server ran as standalone Docker containers on the workstation node. While functional, this introduced manual operational overhead, unmanaged TLS certificates, and lack of GitOps lifecycle management.
flowchart TD
subgraph Legacy["Legacy Docker Architecture (Decommissioned)"]
D_ES["Docker Elasticsearch :9200\nPlaintext HTTP / Static Passwords"]
D_LS["Docker Logstash :12201\nGELF Input"]
D_FS["Docker Fleet Server :8220\nHost Port"]
end
subgraph Target["Target ECK GitOps Architecture"]
K8S_ES[("ECK Elasticsearch 9.3.2\n16GB Heap / Local NVMe PV\nallow_mmap: false")]
K8S_KB["ECK Kibana 9.3.2\nkibana.lambertlab.us"]
K8S_LS["ECK Logstash 9.3.2\nhostNetwork 12201 GELF UDP/TCP"]
K8S_FS["ECK Fleet Server 9.3.2\nfleet.lambertlab.us"]
K8S_AG["Per-Node Elastic Agents\n4 Hosts (Lenovo, Workstation, Optiplex, Opti74)"]
K8S_AO["AutoOps Monitoring Agent\nautoops-agents namespace\nwolfi otel-collector"]
end
K8S_AG -->|Fleet Control :443| K8S_FS
K8S_AG -->|Log & Metric Shipping :443| K8S_ES
K8S_LS -->|mTLS Ingestion| K8S_ES
K8S_KB -->|Internal API| K8S_ES
K8S_AO -->|Scrape Diagnostics :443| K8S_ES
K8S_AO -->|OTLP Export :443| Cloud["Elastic Cloud AutoOps\n(us-east-2)"]
π Procedure 1: Backup & 50MB Config-Only Snapshot
To migrate all dashboards, saved searches, detection rules, alerts, and Fleet policies without copying 35+ GB of ephemeral container logs, a config-only snapshot was created.
1.1 Snapshot Parameter Specification
PUT _snapshot/migration_repo/homelab_config_v1?wait_for_completion=true
{
"indices": ".kibana*,.fleet*,.security*",
"include_global_state": true,
"feature_states": ["kibana", "fleet"]
}
indices: Captures.kibana*(~36 MB, 58 dashboards, 42 saved searches, Lens visualizations),.fleet*(agent policies), and.security*(API keys, service tokens, roles). Completely excludes data streams (homelab-logs-*,.ds-metrics-*).include_global_state: Preserves cluster metadata, index templates, and Index Lifecycle Management (ILM) retention policies.feature_states: Ensures transactional consistency for system indices during snapshot and restore.
1.2 Preparation on Workstation
Create host directories with proper UID ownership:
ssh workstation "sudo mkdir -p /home/chris/services/elasticsearch/data /home/chris/services/elasticsearch/snapshots && sudo chown -R 1000:1000 /home/chris/services/elasticsearch/data /home/chris/services/elasticsearch/snapshots"
1.3 Register Repository & Execute Snapshot in Docker
- Mount
/home/chris/services/elasticsearch/snapshotsto/usr/share/elasticsearch/snapshotsin the Docker Elasticsearch container and configurepath.repo: /usr/share/elasticsearch/snapshots. - Register the snapshot repository:
- Trigger the snapshot:
- Verify snapshot state:
π Procedure 2: Deploying ECK Elasticsearch to Kubernetes
2.1 PersistentVolume Configuration (kubernetes/observability/elasticsearch/storage.yaml)
A dedicated PersistentVolume locks the local NVMe storage to the exact pod instance:
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: elasticsearch-data-pv
spec:
capacity:
storage: 100Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: manual
hostPath:
path: /home/chris/services/elasticsearch/data
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- workstation
claimRef:
namespace: observability
name: elasticsearch-data-elasticsearch-es-default-0
2.2 Preserving the Master Password via Vault (external-secrets.yaml)
An ExternalSecret retrieves the existing elastic_password from HashiCorp Vault (secret/data/homelab) and provisions elasticsearch-es-elastic-user so the operator preserves the established master password:
---
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: elasticsearch-es-elastic-user
namespace: observability
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: vault-backend
target:
name: elasticsearch-es-elastic-user
creationPolicy: Owner
template:
engineVersion: v2
data:
elastic: "{{ .elastic_password }}"
data:
- secretKey: elastic_password
remoteRef:
key: secret/data/homelab
property: elastic_password
2.3 Elasticsearch Custom Resource (elasticsearch.yaml)
Key configurations include:
* node.store.allow_mmap: false: Bypasses the strict vm.max_map_count >= 262144 check, allowing unprivileged execution without requiring a privileged host-level sysctl initContainer.
* path.repo: [/mnt/snapshots]: Mounts the host snapshot folder.
* 16GB Heap: Configured via ES_JAVA_OPTS="-Xms16g -Xmx16g" backed by 20Gi container memory limit.
π Procedure 3: Restoring the Snapshot into ECK
Once elasticsearch-es-default-0 is in Running state:
-
Register the repository in ECK:
ES_PASS=$(kubectl get secret elasticsearch-es-elastic-user -n observability -o jsonpath="{.data.elastic}" | base64 -d) kubectl run es-init --rm -it --restart=Never --image=curlimages/curl -n observability -- \ curl -k -X PUT "https://elasticsearch-es-http:9200/_snapshot/migration_repo" \ -u "elastic:$ES_PASS" \ -H "Content-Type: application/json" \ -d '{ "type": "fs", "settings": { "location": "/mnt/snapshots" } }' -
Restore the configuration snapshot:
kubectl run es-restore --rm -it --restart=Never --image=curlimages/curl -n observability -- \ curl -k -X POST "https://elasticsearch-es-http:9200/_snapshot/migration_repo/homelab_config_v1/_restore?wait_for_completion=true" \ -u "elastic:$ES_PASS" \ -H "Content-Type: application/json" \ -d '{ "indices": ".kibana*,.fleet*,.security*", "include_global_state": true }' -
Strip replica requirements across restored indices to maintain
GREENcluster status on a single node:
π Procedure 4: Kibana & Logstash Cutover
4.1 Kibana Association (kibana.yaml)
Configured with native operator association:
spec:
version: 9.3.2
count: 1
elasticsearchRef:
name: elasticsearch
config:
server.publicBaseUrl: "https://kibana.lambertlab.us"
logging.root.level: "warn"
4.2 Logstash Ingestion via HostNetwork 12201 (logstash.yaml)
To ingest container logs from all Docker daemons over the Tailscale network without modifying Docker daemon logging configs, Logstash runs directly on the workstation host network with hostNetwork: true:
podTemplate:
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
nodeSelector:
kubernetes.io/hostname: workstation
containers:
- name: logstash
ports:
- name: gelf-udp
containerPort: 12201
protocol: UDP
- name: gelf-tcp
containerPort: 12201
protocol: TCP
hostNetwork: true, Logstash binds to all physical and virtual interfaces (including tailscale0 at 100.106.96.18:12201), while dnsPolicy: ClusterFirstWithHostNet preserves in-cluster DNS resolution for CoreDNS and Kubernetes services (elasticsearch-es-http.observability.svc). Incoming logs are tagged with received_at and indexed directly into logstash-%{+YYYY.MM.dd} with number_of_replicas: 0.
π‘οΈ Procedure 5: Fleet Server & Agent Ingress Architecture
5.1 The Kube-OVN HostNetwork Caveat
Homelab host agents (agent-pernode-elastic-agent) run with hostNetwork: true to capture bare-metal network, system, and kernel metrics. Because Kube-OVN isolates the overlay network, host-networked pods cannot route across nodes to Kubernetes ClusterIPs (10.96.0.0/12).
Resolution: Agents route to Fleet Server and Elasticsearch via Traefik Ingress:
* Fleet Endpoint: https://fleet.lambertlab.us
* Elasticsearch Endpoint: https://es.lambertlab.us
5.2 Traefik Backend Insecure Transport
Because ECK generates internal self-signed backend certificates, Traefik must communicate with the backend services using an insecure transport:
---
apiVersion: traefik.io/v1alpha1
kind: ServersTransport
metadata:
name: insecure-transport
namespace: observability
spec:
insecureSkipVerify: true
fleet-server-agent-http-service and elasticsearch-es-http-service) in observability reference this transport:
annotations:
traefik.ingress.kubernetes.io/service.serversscheme: https
traefik.ingress.kubernetes.io/service.serverstransport: observability-insecure-transport@kubernetescrd
5.3 Purging Stale Fleet API Keys
Restoring .kibana from the standalone Docker snapshot restores legacy API keys named Default that Elasticsearch does not recognize. Purge the stale keys via the Kibana Fleet API so Fleet Server generates valid active enrollment tokens:
curl -sk -u "elastic:$ES_PASS" -X DELETE "https://kibana.lambertlab.us/api/fleet/enrollment_api_keys/<stale_key_id>" \
-H "kbn-xsrf: true"
5.4 Elastic Agent Helm Chart vs. ECK CRD & Offline Agent Cleanup
Host telemetry agents run via the standalone elastic-agent Helm chart (kube-system, ArgoCD Wave 9, preset: perNode) rather than an ECK Agent CRD managed by eck-operator (observability, Wave 5):
- Why two ArgoCD apps:
eck-operatormanages the control-plane Elastic CRDs (Elasticsearch,Kibana,Logstash,fleet-server), whereas theelastic-agentchart ships theperNodeDaemonSet, RBAC, host mounts (/var,/proc,/sys,hostNetwork: true), andkube-state-metricsout of the boxβand keeps Wave 9 host enrollment cleanly ordered after Wave 5β7 control-plane components. - Why
Offlineagents accumulate in Fleet: Because theperNodeDaemonSet does not persist/usr/share/elastic-agent/stateacross pod recreations, restarted/recreated pods re-enroll with a newagent.idUUID, leaving previous pod IDs markedOffline. Enable Unenroll inactive agents in Kibana β Fleet β Agent policies β Settings with a short inactivity timeout (e.g.,15mβ1h) so stale pod entries clear automatically.
π§Ή Procedure 6: Decommissioning Docker Resources
Once the ECK stack is validated:
-
Target-destroy Docker ELK containers and resources on
workstation:terraform -chdir=terraform destroy \ -target=module.docker_apps.docker_container.elasticsearch \ -target=module.docker_apps.docker_container.logstash \ -target=module.docker_apps.docker_container.fleet_server \ -target=module.docker_apps.docker_image.elasticsearch \ -target=module.docker_apps.docker_image.logstash \ -target=module.docker_apps.docker_network.elk_bridge -
Move Terraform manifests into
docker/archived/usinggit mv: -
Remove decommissioned variables from
docker/workstation/variables.tf,terraform/main.tf, andterraform/vault.tf.
βοΈ Procedure 7: Elastic AutoOps Cloud Connect
Elastic AutoOps provides cloud-hosted diagnostic insights and proactive shard analysis for self-managed clusters.
7.1 Architecture & Kustomize Deployment
Instead of managing large static manifests or embedding plaintext secrets in Helm values, AutoOps is deployed via remote Kustomize in kubernetes/observability/autoops/:
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: autoops-agents
resources:
- https://raw.githubusercontent.com/elastic/autoops-install/main/k8s/autoops_agent_deployment.yaml
- external-secrets.yaml
patches:
- target:
kind: Deployment
name: autoops-elastic-agent
patch: |-
apiVersion: apps/v1
kind: Deployment
metadata:
name: autoops-elastic-agent
spec:
template:
spec:
containers:
- name: autoops-elastic-agent
livenessProbe:
exec:
command:
- /bin/sh
- -c
- curl -sf http://127.0.0.1:8888/metrics | grep -qE '^libbeat_pipeline_clients\{.*\} [1-9]'
initialDelaySeconds: 15
periodSeconds: 30
failureThreshold: 3
- Image:
docker.elastic.co/elastic-agent/elastic-otel-collector-wolfi(OpenTelemetry Collector with built-inotel_samples/autoops_es.yml). - Self-Healing Liveness Probe (
libbeat_pipeline_clients): Underotel_samples/autoops_es.yml, the embeddedmetricbeatreceiverlaunches 9autoops_esmetricset input streams (cat_shards,node_stats,tasks_managementevery 10s;cluster_health,cluster_settingsevery 1m;cat_template,component_template,index_template,licenseevery 24h), which reportlibbeat_pipeline_clients{receiver="metricbeatreceiver"} 9on internal telemetry endpointhttp://127.0.0.1:8888/metrics. If the pod starts while Elasticsearch is unreachable (503),metricbeatreceiverfails its initial Cloud Connected registration handshake and exits (libbeat_pipeline_clientsdrops to0) while the parentelastic-otel-collectorprocess stays alive. The KustomizelivenessProbechecks for[1-9]active pipeline clients and automatically restarts the container if the scraper streams drop to0. - Vault Integration: Sensitive cloud tokens (
autoops_token,elastic_cloud_connected_mode_api_key,temp-resource-id,es_password) are stored in Vault undersecret/data/autoopsand mapped intoautoops-secretviaExternalSecretwithcreationPolicy: Owner. - Telemetry Route: Scrapes diagnostics locally from
https://es.lambertlab.usand exports OTLP metrics over HTTPS to Elastic Cloud (https://otel-auto-ops.us-east-2.aws.svc.elastic.cloud).
7.2 Verification
Verify the agent has successfully registered:
Expected output confirms cluster registration:Registered cluster <cluster_id> for Cloud Connect: <resource_id>
autoops_es.cat_shards: success
autoops_es.cluster_health: success
events: acked by Elastic Cloud AutoOps