Edge Stack quick start
1. Installation
We'll start by installing Edge Stack into your cluster.
We recommend using Helm but there are other options below to choose from.
# Add the Repo:helm repo add datawire https://app.getambassador.iohelm repo update# Create Namespace and Install:kubectl create namespace ambassador && \kubectl apply -f https://app.getambassador.io/yaml/edge-stack/latest/aes-crds.yamlkubectl wait --timeout=90s --for=condition=available deployment emissary-apiext -n emissary-systemhelm install edge-stack --namespace ambassador datawire/edge-stack && \kubectl -n ambassador wait --for condition=available --timeout=90s deploy -lproduct=aes
2. Routing traffic from the edge
Edge Stack uses Kubernetes Custom Resource Definitions (CRDs) to declaratively define its desired state. The workflow you are going to build uses a simple demo app, a Listener
CRD, and a Mapping
CRD. The Listener
CRD tells Edge Stack what port to listen on, and the Mapping
CRD tells Edge Stack how to route incoming requests by host and URL path from the edge of your cluster to Kubernetes services.
- Start by creating a
Listener
resource for HTTP on port 8080:
kubectl apply -f - <<EOF---apiVersion: getambassador.io/v3alpha1kind: Listenermetadata:name: edge-stack-listener-8080namespace: ambassadorspec:port: 8080protocol: HTTPsecurityModel: XFPhostBinding:namespace:from: ALL---apiVersion: getambassador.io/v3alpha1kind: Listenermetadata:name: edge-stack-listener-8443namespace: ambassadorspec:port: 8443protocol: HTTPSsecurityModel: XFPhostBinding:namespace:from: ALLEOF
Apply the YAML for the “Quote of the Moment" service.
shellkubectl apply -f https://app.getambassador.io/yaml/v2-docs/latest/quickstart/qotm.yamlApply the YAML for a
Mapping
to tell Edge Stack to route all traffic inbound to the/backend/
path to thequote
Service:yamlkubectl apply -f - <<EOF---apiVersion: getambassador.io/v3alpha1kind: Mappingmetadata:name: quote-backendspec:hostname: "*"prefix: /backend/service: quotedocs:path: "/.ambassador-internal/openapi-docs"EOFStore the Edge Stack load balancer IP address to a local environment variable. You will use this variable to test access to your service.
shellexport LB_ENDPOINT=$(kubectl -n ambassador get svc edge-stack \-o "go-template={{range .status.loadBalancer.ingress}}{{or .ip .hostname}}{{end}}")Test the configuration by accessing the service through the Edge Stack load balancer:
Terminal$ curl -Lki https://$LB_ENDPOINT/backend/HTTP/1.1 200 OKcontent-type: application/jsondate: Wed, 23 Jun 2021 16:49:46 GMTcontent-length: 163x-envoy-upstream-service-time: 0server: envoy{"server": "serene-grapefruit-gjd4yodo","quote": "The last sentence you read is often sensible nonsense.","time": "2021-06-23T16:49:46.613322198Z"}
ON THIS PAGE