edge-stack
by Helm
A Helm chart for Ambassador Edge Stack
About this chart
AES
Edge Stack - The Ambassador Edge Stack is a self-service, comprehensive edge stack that is Kubernetes-native and built on Envoy Proxy.
TL;DR;
$ helm repo add edge-stack https://s3.amazonaws.com/datawire-static-files/charts
$ helm repo update
$ helm install edge-stack --devel edge-stack/edge-stack -n ambassador
Introduction
This chart deploys Edge Stack on a Kubernetes cluster using the Helm package manager. This chart will install version 2.1 of Edge Stack. All future charts for the Edge Stack 2.X release line can be found here.
Versions in the 1.X release line of Edge Stack and Emissary Ingress share a single chart that can be found in the Emissary-Ingress repository here under the branch for the specific release.
Eg branch release/v1.14 for the latest 1.14 chart, release/v1.13 for 1.13 and so on.
Note that for 1.0 releases in the chart that can be found in the Emissary-Ingress repository, the
enableAEShelm value is used to control installing Edge-Stack or Emissary-Ingress.
As of version 2.0, Emissary-Ingress and Ambassador Edge Stack have separate charts. The helm chart for Emissary-ingress 2.X can be found in the master branch of the Emissary-Ingress repository linked above, and the chart for Ambassador Edge Stack 2.X lives in this repository.
As of version 3.8.0 (Helm chart v8.8.0) Edge Stack requires an Ambassador Labs license key or Cloud Connect token to operate. A license key is entered using licenseKey.value,
and a Cloud Connect token is entered using emissary-ingress.agent.cloudConnectToken.
Please see our Helm installation documentation for instructions on how to obtain these if you do not have them.
Prerequisites
- Kubernetes v1.11+
Helm Values
This helm chart inherits much of the config from the Emissary-Ingress 2.X Helm Chart.
Because of this, any value that you do not see in the default values.yaml file here specifically for the Edge Stack installation must be configured under the emissary-ingress value.
For example, if you would like to set the createDefaultListeners you would enable that setting in a values file like so for the Edge Stack chart:
emissary-ingress:
createDefaultListeners: true
If you were installing Emissary-ingress instead, using its chart, you would not need the top level emissary-ingress value.
createDefaultListeners: true
All the helm values that this chart inherits from the Emissary-ingress chart can be found here. If a value is specific to Edge Stack it can be found in this chart, otherwise for all values applicable to both Emissary-ingress and Edge Stack are inherited from the Emissary-ingress chart.
Installing the Chart
To install the chart with the release name edge-stack:
$ helm install edge-stack --devel edge-stack/edge-stack -n ambassador
The command deploys Edge Stack on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.
Tip: List all releases using
helm list
Uninstalling the Chart
To uninstall/delete the edge-stack:
$ helm delete edge-stack -n ambassador
The command removes all the Kubernetes components associated with the chart and deletes the release, except the Redis password Secret (<fullname>-redis-auth, see "Redis password" below), which is kept so that a reinstall reuses the password. If you are removing Edge Stack for good, delete it too: kubectl delete secret -n ambassador edge-stack-redis-auth.
Redis password
Edge Stack stores OAuth2 sessions and rate-limit counters in Redis. Starting with chart v8.15.0, the Redis instance that this chart creates requires a password by default.
Argo CD, Flux,
helm templateand other offline renders: set the password yourself. The chart generates the password once and then reads it back from the cluster withlookup, which returns nothing when the chart is rendered without access to the cluster. Every offline render then generates a new random password: the GitOps application never stops showing a diff, and each sync rewrites the Secret. Running pods keep the old password, so the next Edge Stack or Redis pod to start can no longer authenticate, and OAuth2 logins and rate limiting break. Before upgrading to v8.15.0 with such a tool, either setredis.auth.password(for example from your secret store), or create the<fullname>-redis-authSecret yourself (keypassword, non-empty) and setredis.auth.createSecret=false.
- On first install, the chart generates a random 32-character password and stores it in the Secret
<fullname>-redis-auth(keypassword) in the release namespace; for a release namededge-stackthat isedge-stack-redis-auth. You can provide your own withredis.auth.password, or create and manage the Secret yourself withredis.auth.createSecret=false. - Redis is started with
--requirepass, and Edge Stack receives the password as theREDIS_PASSWORDandREDIS_AUTHenvironment variables, both read from the Secret. The password is not written to any ConfigMap, Pod spec, or the install notes. Like any Secret the chart manages, it is also stored in the Helm release record, which with Helm's default storage driver is itself a Secret that only users who can read Secrets in the namespace can see. - On
helm upgrade, the chart reads the password back from the existing Secret, so it does not change between upgrades (but see the note above about offline renders). - With the password on, Redis refuses to start if the
passwordkey of the Secret is empty (for example a Secret you manage withredis.auth.createSecret=falseand left empty, or the chart's Secret emptied by an earlier revision with the password off): itscheck-redis-passwordinit container exits with an error instead of letting--requirepass ""start Redis without a password. Put a non-empty password in the Secret, or setredis.auth.enabled=false. - The Secret has the
helm.sh/resource-policy: keepannotation, sohelm uninstallleaves it in place, and reinstalling a release with the same name and namespace reuses the same password. To rotate the password, or to remove it after uninstalling, delete the Secret yourself (kubectl delete secret -n <namespace> <fullname>-redis-auth); with auth enabled, the nexthelm upgradeor install generates a new one. Run that upgrade straight away: until it has recreated the Secret, a restarted Redis pod cannot start and a restarted Edge Stack pod gets no password. Then restart Redis and Edge Stack as described below. - Edge Stack only receives the password from this chart's own Secret. The chart turns the password on only when
emissary-ingress.envRawreferences<fullname>-redis-authitself, as the default value does; a reference to another Secret, even one whose name also ends in-redis-auth, does not count, and the chart then leaves Redis without a password and prints a warning. If you write your own envRaw, include both theREDIS_PASSWORDand theREDIS_AUTHentries: the RateLimitService readsREDIS_AUTH, and rate limiting fails without it. If you instead add your ownREDIS_PASSWORD/REDIS_AUTHentries for another Secret to envRaw while keeping the default ones, put yours after the defaults: Kubernetes uses the last entry with a given name. - While the chart manages the Secret (
redis.auth.createSecret=true, the default), it always renders it, also when the password is off (redis.auth.enabled=false, an external or no chart-managed Redis, or Redis auth you manage yourself); the password in it is then empty. This way a Secret left over from an earlier revision, an uninstall or a rollback never hands Edge Stack an old password for a Redis that has none, which Redis would reject. If a Secret named<fullname>-redis-authalready exists that this release did not create (for example one you created for a YAML install, or for your own external Redis),helm install/helm upgradefails with an ownership error: setredis.auth.createSecret=false, or delete the Secret, or adopt it into the release.
Upgrade notes:
- If you deploy with a tool that renders the chart with
helm templaterather thanhelm install/helm upgrade(for example Argo CD), setredis.auth.password(for example from your secret store) or useredis.auth.createSecret=falsewith your own non-empty Secret before upgrading. Those tools cannot read the existing Secret and would generate a new password on every render; see the note at the top of this section. - The first upgrade to v8.15.0 restarts Redis with a password and rolls the Edge Stack pods. Redis is in-memory, so, as with any Redis restart, existing OAuth2 sessions and rate-limit counters are lost. An Edge Stack pod that starts while the old Redis pod is still serving can fail to set up rate limiting, so once the upgrade has finished, run
kubectl rollout restart -n <namespace> deployment/<fullname>. - Use
--reset-then-reuse-values(Helm 3.14+) rather than--reuse-valuesfor this upgrade. With--reuse-values, Helm keeps the previous chart'semissary-ingress.envRaw, which does not pass the password to Edge Stack, so the chart leaves Redis without a password and prints a warning. - If you override
emissary-ingress.envRaw, add theREDIS_PASSWORDandREDIS_AUTHentries from the default value to it. Until you do, the chart leaves Redis without a password and prints a warning. - If you already protect the chart-managed Redis yourself, with
--requirepassinredis.containerArgsorREDIS_PASSWORD/REDIS_AUTHinemissary-ingress.env, the chart leaves your configuration as it is. - If you enable
REDIS_PERSECONDand pointREDIS_PERSECOND_URLat the chart-managed Redis, also setREDIS_PERSECOND_PASSWORDandREDIS_PERSECOND_AUTHfrom the same Secret. - Edge Stack reads the password only when its pods start. After changing the password (
redis.auth.passwordor your own Secret), turningredis.auth.enabledon or off (including by addingREDIS_PASSWORD/REDIS_AUTHtoemissary-ingress.envor--requirepasstoredis.containerArgs, which hands Redis auth over to you), or ahelm rollbackbetween v8.15.0 or later revisions, restart Redis and Edge Stack:kubectl rollout restart -n <namespace> deployment/<fullname>-redis deployment/<fullname>. - Switching an existing release from
redis.auth.createSecret=truetofalseleaves the chart's Secret in place (because ofhelm.sh/resource-policy: keep) and stops managing it. Replace itspasswordwith your own, or adopt it into the tool that now manages it, then restart Redis and Edge Stack. WithcreateSecret=false, the chart never changes the Secret, so if you then turn the password off, empty or delete your Secret yourself. - Turning
redis.auth.enabledoff empties the password in the chart's Secret. Restart Redis and Edge Stack afterwards.
Opting out:
- External Redis: set
emissary-ingress.redisURL(and usuallyredis.create=false). The chart then sends no password (withredis.auth.createSecret=true, its Secret holds an empty one); to authenticate to your Redis, setREDIS_PASSWORDandREDIS_AUTHyourself, for example underemissary-ingress.env. Note that the top-levelredisURLvalue is not passed to Edge Stack; useemissary-ingress.redisURL. - Previous behaviour: set
redis.auth.enabled=falseto run the chart-managed Redis without a password (the chart still creates an empty<fullname>-redis-authSecret; also setredis.auth.createSecret=falseto avoid it). This is not recommended: anyone who can reach Redis on the network can then read and modify sessions and rate-limit state.
The published YAML manifests (aes.yaml and its variants) still run Redis without a password. They cannot carry a per-install password, so until you opt in as described below, anyone who can reach the Redis Service can read and change OAuth2 sessions and rate-limit state. That includes any workload in the cluster, and anyone who can create a Mapping or TCPMapping, who can route to edge-stack-redis:6379 through Edge Stack itself (see "Who can create Edge Stack resources"). If you install from the YAML manifests, enable the password, or switch to the Helm chart. The Edge Stack Deployment in those manifests already reads REDIS_PASSWORD and REDIS_AUTH from an optional edge-stack-redis-auth Secret. To enable a password on a YAML install, create that Secret, then start Redis with it, then restart Edge Stack. Do not create the Secret without also changing Redis, or Edge Stack will fail to authenticate to a Redis that has no password. The commands below use the ambassador namespace; use the namespace you installed into (default or emissary for those manifest variants):
$ kubectl create secret generic -n ambassador edge-stack-redis-auth --from-literal=password="$(openssl rand -hex 24)"
$ kubectl patch deployment -n ambassador edge-stack-redis --type=json -p '[
{"op":"add","path":"/spec/template/spec/containers/0/env","value":[{"name":"REDIS_PASSWORD","valueFrom":{"secretKeyRef":{"name":"edge-stack-redis-auth","key":"password"}}}]},
{"op":"add","path":"/spec/template/spec/containers/0/args","value":["--requirepass","$(REDIS_PASSWORD)"]}]'
$ kubectl rollout restart -n ambassador deployment/edge-stack # deployment/aes for the *-migration manifests
Who can create Edge Stack resources
Edge Stack does not decide who may configure it: Kubernetes
Deploy edge-stack with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has edge-stack on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartedge-stack is pinned at v8.15.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply