You run a small edge fleet on k3s — a node per branch office, one cluster per region — and the team you joined three weeks ago has the same tls.crt and db-password Secret hand-applied to every cluster with a script that nobody trusts. Someone rotates the password in production Vault and forgets to push to staging, staging stays on the old credential for two weeks, and a Sev-2 ticket eventually traces back to that drift. The cluster doesn’t need a copy of the secret. It needs a reference and a controller that fetches the live value on a schedule.
What’s happening
External Secrets Operator (ESO) reconciles a custom resource called ExternalSecret against a SecretStore (or ClusterSecretStore) and materializes a Kubernetes Secret from a remote source. Supported backends include HashiCorp Vault (KV v2, AppRole or Kubernetes auth), AWS Secrets Manager, GCP Secret Manager, Azure Key Vault, and roughly thirty more. The operator runs in its own namespace, watches ExternalSecret resources cluster-wide, hits the backend on a refreshInterval (default 1h, often tuned to 5–15m for rotated credentials), and writes the resulting Secret in the application namespace. The application reads it as a normal Secret — envFrom, volumeMounts, the lot.
Two patterns matter on day one. First, SecretStore is namespace-scoped, ClusterSecretStore is cluster-scoped — use the cluster variant for shared backends like a central Vault, and the namespace variant when each tenant has its own Vault path or AWS account. Second, auth-to-backend is its own secret problem. Vault AppRole role-id + secret-id and AWS access keys end up as Kubernetes Secrets inside the operator’s namespace. For Vault, prefer the Kubernetes auth method (the operator authenticates with its ServiceAccount token); for AWS, prefer IAM Roles for Service Accounts via IRSA when on EKS, or a node IAM role on managed instances. The installer below uses Vault Kubernetes auth and AWS access keys (which you stage as a Secret then reference) because that’s the most-portable combination for k3s on bare metal.
How to verify
After install, the operator pods should be Ready and the SecretStore should report a healthy connection:
kubectl -n external-secrets get pods
# NAME READY STATUS AGE
# external-secrets-7f8b5c8c44-abcde 1/1 Running 2m
# external-secrets-cert-controller-77d6f8b9-fghij 1/1 Running 2m
# external-secrets-webhook-7b8d6f7c5d-klmno 1/1 Running 2m
kubectl get clustersecretstore vault-kv -o json \
| jq '.status.conditions[] | {type, status, reason, message}'
# { "type": "Ready", "status": "True", "reason": "Validated", "message": "store validated" }
Apply a test ExternalSecret against Vault and confirm the materialized Secret:
kubectl apply -f - <<EOF
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: smoke-vault
namespace: default
spec:
refreshInterval: 1m
secretStoreRef:
name: vault-kv
kind: ClusterSecretStore
target:
name: smoke-vault
data:
- secretKey: token
remoteRef:
key: smoke/test
property: token
EOF
sleep 5
kubectl get secret smoke-vault -o jsonpath='{.data.token}' | base64 -d
For AWS Secrets Manager, the same pattern with secretStoreRef.name: aws-sm and remoteRef.key: /smoke/test/token.
The fix
Save the script as /root/install-eso-k3s.sh and run it on the k3s server node as root. It performs the full installer: prerequisite check (kubectl against the k3s cluster, helm 3.15 installed, Vault reachable), Helm chart install of External Secrets Operator 0.10 in HA mode (two replicas per deployment), webhook with cert-manager-less self-signed certs that the chart provisions, namespace creation with PSA restricted labels, a ClusterSecretStore for HashiCorp Vault using Kubernetes auth, a ClusterSecretStore for AWS Secrets Manager using a staged access-key Secret, RBAC for the operator’s ServiceAccount to read its own token, and a smoke ExternalSecret against each backend.
#!/usr/bin/env bash
set -euo pipefail
### k3s 1.30 — install External Secrets Operator + Vault + AWS Secrets Manager backends
### Run on the k3s server node as root
### Assumes: kubectl works (uses /etc/rancher/k3s/k3s.yaml), Vault reachable at VAULT_ADDR
if [[ "$(id -u)" -ne 0 ]]; then
echo "Run as root."
exit 1
fi
# === EDIT ===
ESO_CHART_VERSION="0.10.5"
ESO_NAMESPACE="external-secrets"
VAULT_ADDR="https://vault.internal.example.com:8200"
VAULT_PATH="kv" # KV v2 mount path
VAULT_ROLE="k3s-eso" # role inside Vault's k8s auth backend
VAULT_K8S_AUTH_MOUNT="kubernetes-edge-01"
AWS_REGION="us-east-1"
AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-}"
AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-}"
# ============
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
echo
echo "========================================"
echo "External Secrets Operator on k3s"
echo "========================================"
echo
echo "==> Prerequisite check"
command -v kubectl >/dev/null || { echo "kubectl missing"; exit 1; }
command -v helm >/dev/null || { echo "helm missing"; exit 1; }
kubectl cluster-info >/dev/null
if ! curl -fsS -m 5 "${VAULT_ADDR}/v1/sys/health" >/dev/null; then
echo "Vault unreachable at ${VAULT_ADDR}"
exit 1
fi
if [[ -z "${AWS_ACCESS_KEY_ID}" || -z "${AWS_SECRET_ACCESS_KEY}" ]]; then
echo "Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in env before running."
exit 1
fi
echo "==> Add Helm repo"
helm repo add external-secrets https://charts.external-secrets.io
helm repo update
echo "==> Create namespace with PSA restricted"
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Namespace
metadata:
name: ${ESO_NAMESPACE}
labels:
pod-security.kubernetes.io/enforce: restricted
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/warn: restricted
EOF
echo "==> Values file"
cat > /etc/eso-values.yaml <<EOF
installCRDs: true
replicaCount: 2
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 250m
memory: 256Mi
securityContext:
runAsNonRoot: true
runAsUser: 65534
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
webhook:
replicaCount: 2
certManager:
enabled: false # chart provisions its own cert by default
resources:
requests: { cpu: 30m, memory: 64Mi }
limits: { cpu: 200m, memory: 192Mi }
certController:
replicaCount: 2
resources:
requests: { cpu: 30m, memory: 64Mi }
limits: { cpu: 200m, memory: 192Mi }
serviceMonitor:
enabled: false # flip true once kube-prometheus-stack is installed
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app.kubernetes.io/instance: external-secrets
leaderElect: true
EOF
echo "==> Install External Secrets Operator"
helm upgrade --install external-secrets external-secrets/external-secrets \
--namespace "${ESO_NAMESPACE}" \
--version "${ESO_CHART_VERSION}" \
-f /etc/eso-values.yaml \
--wait --timeout 5m
kubectl -n "${ESO_NAMESPACE}" rollout status deploy/external-secrets --timeout=5m
kubectl -n "${ESO_NAMESPACE}" rollout status deploy/external-secrets-webhook --timeout=5m
kubectl -n "${ESO_NAMESPACE}" rollout status deploy/external-secrets-cert-controller --timeout=5m
echo "==> ServiceAccount for Vault auth"
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ServiceAccount
metadata:
name: external-secrets-vault
namespace: ${ESO_NAMESPACE}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: external-secrets-vault-tokenreview
rules:
- apiGroups: ["authentication.k8s.io"]
resources: ["tokenreviews"]
verbs: ["create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: external-secrets-vault-tokenreview
subjects:
- kind: ServiceAccount
name: external-secrets-vault
namespace: ${ESO_NAMESPACE}
roleRef:
kind: ClusterRole
name: external-secrets-vault-tokenreview
apiGroup: rbac.authorization.k8s.io
EOF
echo "==> ClusterSecretStore for Vault (KV v2, Kubernetes auth)"
cat <<EOF | kubectl apply -f -
apiVersion: external-secrets.io/v1beta1
kind: ClusterSecretStore
metadata:
name: vault-kv
spec:
provider:
vault:
server: "${VAULT_ADDR}"
path: "${VAULT_PATH}"
version: "v2"
auth:
kubernetes:
mountPath: "${VAULT_K8S_AUTH_MOUNT}"
role: "${VAULT_ROLE}"
serviceAccountRef:
name: external-secrets-vault
namespace: ${ESO_NAMESPACE}
EOF
echo "==> AWS access-key Secret"
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
name: aws-secrets-manager-creds
namespace: ${ESO_NAMESPACE}
type: Opaque
stringData:
access-key-id: "${AWS_ACCESS_KEY_ID}"
secret-access-key: "${AWS_SECRET_ACCESS_KEY}"
EOF
echo "==> ClusterSecretStore for AWS Secrets Manager"
cat <<EOF | kubectl apply -f -
apiVersion: external-secrets.io/v1beta1
kind: ClusterSecretStore
metadata:
name: aws-sm
spec:
provider:
aws:
service: SecretsManager
region: "${AWS_REGION}"
auth:
secretRef:
accessKeyIDSecretRef:
name: aws-secrets-manager-creds
namespace: ${ESO_NAMESPACE}
key: access-key-id
secretAccessKeySecretRef:
name: aws-secrets-manager-creds
namespace: ${ESO_NAMESPACE}
key: secret-access-key
EOF
echo "==> Wait for stores to report Ready"
for store in vault-kv aws-sm; do
for i in {1..30}; do
STATUS="$(kubectl get clustersecretstore "${store}" \
-o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' 2>/dev/null || echo "")"
if [[ "${STATUS}" == "True" ]]; then
echo "ClusterSecretStore/${store} Ready"
break
fi
sleep 2
done
if [[ "${STATUS:-}" != "True" ]]; then
echo "ClusterSecretStore/${store} did NOT reach Ready"
kubectl describe clustersecretstore "${store}" | tail -30
fi
done
echo "==> Smoke test ExternalSecret against Vault"
cat <<EOF | kubectl apply -f -
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: smoke-vault
namespace: default
spec:
refreshInterval: 1m
secretStoreRef:
name: vault-kv
kind: ClusterSecretStore
target:
name: smoke-vault
creationPolicy: Owner
data:
- secretKey: token
remoteRef:
key: smoke/test
property: token
EOF
echo "==> Smoke test ExternalSecret against AWS Secrets Manager"
cat <<EOF | kubectl apply -f -
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: smoke-aws
namespace: default
spec:
refreshInterval: 1m
secretStoreRef:
name: aws-sm
kind: ClusterSecretStore
target:
name: smoke-aws
creationPolicy: Owner
data:
- secretKey: token
remoteRef:
key: /smoke/test/token
EOF
sleep 10
echo
echo "========================================"
echo "DONE"
echo "========================================"
echo
echo "Operator pods:"
kubectl -n "${ESO_NAMESPACE}" get pods
echo
echo "Stores:"
kubectl get clustersecretstore
echo
echo "Smoke ExternalSecrets (status):"
kubectl get externalsecret -A
echo
echo "Materialized Secrets:"
kubectl get secret smoke-vault smoke-aws -o name 2>/dev/null || true
echo
echo "Next: configure Vault role ${VAULT_ROLE} with the policy that reads ${VAULT_PATH}/data/* and the bound SA external-secrets-vault@${ESO_NAMESPACE}"
Make it executable and run:
chmod 700 /root/install-eso-k3s.sh
export AWS_ACCESS_KEY_ID=AKIA... AWS_SECRET_ACCESS_KEY=...
/root/install-eso-k3s.sh
On the Vault side, you need a matching role. From a Vault client with vault CLI logged in:
vault auth enable -path=kubernetes-edge-01 kubernetes
vault write auth/kubernetes-edge-01/config \
kubernetes_host="https://<k3s-api>:6443" \
kubernetes_ca_cert=@/etc/rancher/k3s/server/tls/server-ca.crt
vault policy write eso-reader -<<'POL'
path "kv/data/*" { capabilities = ["read"] }
path "kv/metadata/*" { capabilities = ["read","list"] }
POL
vault write auth/kubernetes-edge-01/role/k3s-eso \
bound_service_account_names="external-secrets-vault" \
bound_service_account_namespaces="external-secrets" \
policies="eso-reader" \
ttl=1h
From there, every application namespace becomes a thin consumer: drop an ExternalSecret referencing vault-kv or aws-sm, the operator materializes the Secret, and the rotation cadence is whatever refreshInterval you set — five minutes for short-lived credentials, an hour for stable ones. The k3s clusters never hold the source of truth; they hold a reference.
We run External Secrets Operator wired to a central Vault for k3s edge fleets under Managed Cloud Ops. If you need help designing the auth boundary between clusters and the secret store, scope it with our platform team.